getRandomNetwork() setting upper bound IP lower than lower bound

Bug #1336617 reported by Julian Edwards
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Graham Binns

Bug Description

ERROR: maasserver.models.tests.test_nodegroupinterface.TestNodeGroupInterface.test_clean_ip_ranges_works_with_ipv6_ranges
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/tmp/tarmac/branch.Y6nZqV/src/maasserver/models/tests/test_nodegroupinterface.py", line 242, in test_clean_ip_ranges_works_with_ipv6_ranges
    ValidationError, interface.full_clean)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 396, in assertRaises
    self.assertThat(our_callable, matcher)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 408, in assertThat
    mismatch = matcher.match(matchee)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/matchers/_exception.py", line 99, in match
    mismatch = self.exception_matcher.match(exc_info)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/matchers/_higherorder.py", line 62, in match
    mismatch = matcher.match(matchee)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 388, in match
    reraise(*matchee)
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/matchers/_exception.py", line 92, in match
    result = matchee()
  File "/home/ubuntu/.buildout/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 885, in __call__
    return self._callable_object(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 928, in full_clean
    self.clean_fields(exclude=exclude)
  File "/tmp/tarmac/branch.Y6nZqV/src/maasserver/models/nodegroupinterface.py", line 263, in clean_fields
    self.clean_ip_ranges()
  File "/tmp/tarmac/branch.Y6nZqV/src/maasserver/models/nodegroupinterface.py", line 232, in clean_ip_ranges
    static_ip_range_high)
  File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 1293, in __init__
    raise AddrFormatError('lower bound IP greater than upper bound!')
AddrFormatError: lower bound IP greater than upper bound!

Tags: tech-debt

Related branches

Changed in maas:
status: New → Triaged
importance: Undecided → Critical
tags: added: tech-debt
Revision history for this message
Graham Binns (gmb) wrote :

This is because it uses randomly-generated octets rather than an IPNetwork (which is what the v6 version uses).

Changed in maas:
status: Triaged → In Progress
assignee: nobody → Graham Binns (gmb)
summary: - getRandomNetwork() setting upper bound IP lower than lowqer bound
+ getRandomNetwork() setting upper bound IP lower than lower bound
Revision history for this message
Graham Binns (gmb) wrote :

I was wrong, that's not the problem at all. It looks like make_ip_range() is returning ranges with low > high in some cases, despite there being a test against this. That seems very, very suspicious to me.

Changed in maas:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.