"failed to detect a valid IP address" when trying to view node details

Bug #1519918 reported by Andreas Hasenack on 2015-11-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description


While in a situation that shows bug #1519527, I get a backtrace in regiond.log when trying to view the bootstrap node details in the MAAS UI:
2015-11-25 18:46:01 [-] Error on request (25) subnet.list: failed to detect a valid IP address from u','
        Traceback (most recent call last):
          File "/usr/lib/python2.7/threading.py", line 783, in __bootstrap
          File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
          File "/usr/lib/python2.7/threading.py", line 763, in run
            self.__target(*self.__args, **self.__kwargs)
          File "/usr/lib/python2.7/dist-packages/provisioningserver/utils/twisted.py", line 791, in _worker
            return super(ThreadPool, self)._worker()
        --- <exception caught here> ---
          File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 191, in _worker
            result = context.call(ctx, function, *args, **kwargs)
          File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
            return func(*args,**kw)
          File "/usr/lib/python2.7/dist-packages/maasserver/utils/orm.py", line 501, in call_within_transaction
            return func_outside_txn(*args, **kwargs)
          File "/usr/lib/python2.7/dist-packages/maasserver/utils/orm.py", line 328, in retrier
            return func(*args, **kwargs)
          File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 339, in inner
            return func(*args, **kwargs)
          File "/usr/lib/python2.7/dist-packages/maasserver/websockets/base.py", line 338, in list
            for obj in objs
          File "/usr/lib/python2.7/dist-packages/maasserver/websockets/base.py", line 205, in full_dehydrate
            return self.dehydrate(obj, data, for_list=for_list)
          File "/usr/lib/python2.7/dist-packages/maasserver/websockets/handlers/subnet.py", line 45, in dehydrate
            full_range = subnet.get_iprange_usage()
          File "/usr/lib/python2.7/dist-packages/maasserver/models/subnet.py", line 470, in get_iprange_usage
            reserved_ranges = self.get_ipranges_in_use()
          File "/usr/lib/python2.7/dist-packages/maasserver/models/subnet.py", line 455, in get_ipranges_in_use
            ranges |= self._get_ipranges_in_use_on_related_clusters()
          File "/usr/lib/python2.7/dist-packages/maasserver/models/subnet.py", line 442, in _get_ipranges_in_use_on_related_clusters
            self.get_ipnetwork(), include_static_range=False)
          File "/usr/lib/python2.7/dist-packages/maasserver/models/nodegroupinterface.py", line 671, in get_ipranges_in_use_on_ipnetwork
            if make_ipaddress(server) in ipnetwork:
          File "/usr/lib/python2.7/dist-packages/provisioningserver/utils/network.py", line 292, in make_ipaddress
            return IPAddress(input)
          File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 315, in __init__
            'address from %r' % addr)
        netaddr.core.AddrFormatError: failed to detect a valid IP address from u','

Related branches

description: updated
Changed in maas:
status: New → Triaged
importance: Undecided → Critical
milestone: none → 1.9.0
tags: removed: kanban-cross-team
description: updated
description: updated
description: updated
Mike Pontillo (mpontillo) wrote :

Andres and I tracked this down to a possibly-incorrectly-migrated field.

The dns_servers column in the Subnet table is supposed to be a list (postgresql array). However, looking at the output of "subnets list", Andres saw that the dns_servers list was in the form:

dns_servers: [","]

Whereas, we would expect it to be:

dns_servers: ["", ""]

So, two issues we need to solve here:

(1) See if we can fix the migrations to correctly migrate this field (if that was indeed the issue); requires installing 1.7 or 1.8, specifying multiple DNS servers within a cluster interface configuration, and then migrating to 1.9.

(2) Make the code more robust by checking wherever we read this field if there is a comma, and if so, split it by commas, then strip the whitespace off of all split sections. (maybe create a property or helper method in the Subnet model class to do this.)

I think fix (2) may be required even if we do fix (1), because people who have already migrated to a more recent MAAS 1.9 RC could already have a corrupt field.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers