[2.3] Controller refresh can fail in a container with a static IP address

Bug #1705774 reported by Lee Trager on 2017-07-21
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mike Pontillo

Bug Description

My MAAS test environment is an LXD container with a static IP which I configure in e/n/i before installing MAAS. I was unable to rebuild my environment today due to region registration failing. This appears to be because MAAS is unable to find the VLAN for the subnet I am on, returns None which is invalid on the subnet object.

This appears to of been introduced in 48efa8062b866c9b1b82fdca6be2c0e7067e472e as reverting that commit resolves the issue.

2017-07-21 18:48:15 maasserver.rpc.regionservice: [critical] Failed to register rack controller 'None' into the database. Connection will be dropped.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1184, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/maasserver/rpc/regionservice.py", line 630, in _register
    is_loopback=is_loopback, create_fabrics=create_fabrics)
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 246, in inContext
    result = inContext.theWork()
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 875, in callInContext
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 232, in wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 642, in call_with_connection
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/__init__.py", line 164, in call_with_lock
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 686, in call_within_transaction
    return func_outside_txn(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 504, in retrier
    return func(*args, **kwargs)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3/dist-packages/maasserver/rpc/rackcontrollers.py", line 160, in register
    rackcontroller.update_interfaces(interfaces, create_fabrics=create_fabrics)
  File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 4679, in update_interfaces
    name, settings, create_fabrics=create_fabrics)
  File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 4128, in _update_interface
    return self._update_bridge_interface(name, config)
  File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 4372, in _update_bridge_interface
    return self._update_child_interface(name, config, BridgeInterface)
  File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 4352, in _update_child_interface
    interface, links, use_interface_vlan=found_vlan)
  File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 4531, in _update_links
    "vlan": vlan,
  File "/usr/lib/python3/dist-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 407, in get_or_create
    return self._create_object_from_params(lookup, params)
  File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 439, in _create_object_from_params
    obj = self.create(**params)
  File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 346, in create
    obj = self.model(**kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/models/subnet.py", line 360, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 468, in __init__
    setattr(self, field.name, rel_obj)
  File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 634, in __set__
    (instance._meta.object_name, self.field.name)
builtins.ValueError: Cannot assign None: "Subnet.vlan" does not allow null values.
2017-07-21 18:48:15 maasserver.rpc.regionservice: [info] Rack controller 'None' disconnected.
2017-07-21 18:48:15 RegionServer,55,::ffff: [info] RegionServer connection lost (HOST:IPv6Address(TCP, '::ffff:', 5251) PEER:IPv6Address(TCP, '::ffff:', 44144))

Related branches

Lee Trager (ltrager) wrote :

I tried using https://code.launchpad.net/~mpontillo/maas/+git/maas/+merge/327859 but still ran into the same issue.

Changed in maas:
milestone: none → 2.3.0
assignee: nobody → Mike Pontillo (mpontillo)
Mike Pontillo (mpontillo) wrote :

Can you please attach the output of `maas-rack support-dump --networking` on the machine where this fails, so we can create a unit test? Thanks in advance.

Changed in maas:
status: New → Incomplete
Lee Trager (ltrager) wrote :
Download full text (3.2 KiB)

Sorry I forgot to upload that!

# maas-rack support-dump --networking
### get_ip_addr() ###
{'eth0': {'flags': ['BROADCAST', 'MULTICAST', 'UP', 'LOWER_UP'],
          'index': 71,
          'inet': [''],
          'mac': '00:16:3e:99:01:3b',
          'name': 'eth0',
          'parent': 'if72',
          'settings': {'group': 'default',
                       'mtu': '1500',
                       'qdisc': 'noqueue',
                       'qlen': '1000',
                       'state': 'UP'},
          'type': 'ethernet'},
 'lo': {'flags': ['LOOPBACK', 'UP', 'LOWER_UP'],
        'index': 1,
        'inet': [''],
        'inet6': ['::1/128'],
        'name': 'lo',
        'settings': {'group': 'default',
                     'mtu': '65536',
                     'qdisc': 'noqueue',
                     'qlen': '1000',
                     'state': 'UNKNOWN'},
        'type': 'loopback'},
 'virbr0': {'bridged_interfaces': ['virbr0-nic'],
            'flags': ['NO-CARRIER', 'BROADCAST', 'MULTICAST', 'UP'],
            'index': 2,
            'inet': [''],
            'mac': '52:54:00:3a:01:36',
            'name': 'virbr0',
            'settings': {'group': 'default',
                         'mtu': '1500',
                         'qdisc': 'noqueue',
                         'qlen': '1000',
                         'state': 'DOWN'},
            'type': 'ethernet.bridge'},
 'virbr0-nic': {'flags': ['BROADCAST', 'MULTICAST'],
                'index': 3,
                'mac': '52:54:00:3a:01:36',
                'name': 'virbr0-nic',
                'settings': {'group': 'default',
                             'master': 'virbr0',
                             'mtu': '1500',
                             'qdisc': 'pfifo_fast',
                             'qlen': '1000',
                             'state': 'DOWN'},
                'type': 'ethernet'}}

### get_ip_route() ###
{'default': {'dev': 'eth0', 'via': ''}}

### get_all_interfaces_definition() ###
{'eth0': {'enabled': True,
          'index': 71,
          'links': [{'address': '',
                     'gateway': '',
                     'mode': 'static'}],
          'mac_address': '00:16:3e:99:01:3b',
          'monitored': True,
          'parents': [],
          'source': 'ipaddr',
          'type': 'physical'},
 'virbr0': {'enabled': True,
            'index': 2,
            'links': [{'address': '', 'mode': 'static'}],
            'mac_address': '52:54:00:3a:01:36',
            'monitored': False,
            'parents': ['virbr0-nic'],
            'source': 'ipaddr',
            'type': 'bridge'},
 'virbr0-nic': {'enabled': False,
                'index': 3,
                'links': [],
                'mac_address': '52:54:00:3a:01:36',
                'monitored': False,
                'parents': [],
                'source': 'ipaddr',
                'type': 'physical'}}

# cat /etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet static
    # dns-* op...


Changed in maas:
status: Incomplete → Triaged
summary: - Controller refresh fails when a static IP address is used
+ [2.3] Controller refresh can fail in a container with a static IP
+ address
Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
milestone: 2.3.0 → 2.3.0alpha1
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers