AttributeError: 'NoneType' object has no attribute 'get_managed_cluster_interface'

Bug #1509077 reported by Andres Rodriguez on 2015-10-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blake Rouse

Bug Description

I upgraded from MAAS 1.8.3 to 1.9.0a5.

MAAS 1.8.3 initially had 2 cluster interface s(eth0, eth1), and as such, 2 network were created. However, eth1 got removed from the cluster.

After upgrade from 1.9.0, we now have 2 subnets, however, only 1 clsuter interface (eth0), which remains MANAGED for DNS/DHCP. We see the following error when trying to deploy the machine.

2015-10-22 20:04:16 [-] - - [22/Oct/2015:20:04:15 +0000] "POST /MAAS/api/1.0/nodes/node-81ec0a24-737c-11e5-b89b-00163e35cf93/?op=start HTTP/1.1" 500 66 "-" "Go 1.1 package http"
2015-10-22 20:04:18 [maasserver] ERROR: ################################ Exception: 'NoneType' object has no attribute 'get_managed_cluster_interface' ################################
2015-10-22 20:04:18 [maasserver] ERROR: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/utils/", line 189, in view_atomic_with_post_commit_savepoint
    return view_atomic(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/", line 339, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/", line 53, in __call__
    response = upcall(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/", line 167, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/usr/lib/python2.7/dist-packages/piston/", line 165, in __call__
    result = meth(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/", line 201, in dispatch
    return function(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/", line 490, in start
    node.start(request.user, user_data=user_data, comment=comment)
  File "/usr/lib/python2.7/dist-packages/maasserver/utils/", line 464, in call_within_transaction
    return func_within_txn(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/", line 339, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/models/", line 2316, in start
    return self._start(user, user_data)
  File "/usr/lib/python2.7/dist-packages/maasserver/utils/", line 464, in call_within_transaction
    return func_within_txn(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/", line 339, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/models/", line 2356, in _start
  File "/usr/lib/python2.7/dist-packages/maasserver/models/", line 1998, in claim_auto_ips
  File "/usr/lib/python2.7/dist-packages/maasserver/models/", line 965, in claim_auto_ips
    auto_ip, exclude_addresses)
  File "/usr/lib/python2.7/dist-packages/maasserver/models/", line 977, in _claim_auto_ip
    ngi = subnet.get_managed_cluster_interface()
AttributeError: 'NoneType' object has no attribute 'get_managed_cluster_interface'

Related branches

description: updated
Changed in maas:
milestone: none → 1.9.0
importance: Undecided → Critical
description: updated
Andres Rodriguez (andreserl) wrote :

Looking at the screenshot:

It seems that eth0 has subnet unconfigured and the IP address assigned field is empty, which might be the reason why this error was shown.

Mike Pontillo (mpontillo) wrote :

It seems like this bug could occur if you upgrade MAAS, and then try to redeploy a node without recommissioning first. More specifically, if the node has a static IP address assigned, and we never updated its subnet to link to the appropriate one, we'll hit this bug.

A possible fix is to change _claim_auto_ip() so that it attempts to locate the proper subnet (if the IP address does not have an associated subnet).

Mike Pontillo (mpontillo) wrote :

One possible way to reproduce this bug without upgrading from 1.8 (although it may have other side effects) is to do something like this from maas-region-admin dbshell:

update maasserver_staticipaddress set subnet_id=null;

This may cause additional improper behavior, so it may be a good idea to restrict this only to IP addresses of a certain type.

Gavin Panella (allenap) on 2015-10-27
Changed in maas:
status: New → Triaged
Blake Rouse (blake-rouse) wrote :

This needs to be fixed with a data migration because we cannot update the subnet in _claim_auto_ip because there will be not IP address assigned yet. Without having the IP address that should be assigned we don't know what subnet this interface should be connected to.

We could use the nodegroup that the node is connected to, but that will be removed in 2.0 which will cause that simple fix to break as well. The best thing to do is make sure that the subnet is linked in a data migration on upgrade.

Changed in maas:
assignee: nobody → Blake Rouse (blake-rouse)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
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