claim_static_ip does not work for IPADDRESS_TYPE.USER_RESERVED

Bug #1336709 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Raphaël Badin

Bug Description

Tests for claim_static_ip pass a random "IP type." If the random IP type is USER_RESERVED, claim_static_ip will call StaticIPAddress.objects.allocate_new with that type, but without a ‘user’ argument — which triggers an assertion failure.

Example failure (but several tests in the same test case do this):

FAIL: maasserver.models.tests.test_macaddress.TestMACAddressForStaticIPClaiming.test_claim_static_ip_returns_existing_if_claiming_same_type
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "src/maasserver/models/tests/test_macaddress.py", line 129, in test_claim_static_ip_returns_existing_if_claiming_same_type
    ip = mac.claim_static_ip(alloc_type=iptype)
  File "src/maasserver/models/macaddress.py", line 142, in claim_static_ip
    sip = StaticIPAddress.objects.allocate_new(low, high, alloc_type)
  File "src/maasserver/models/staticipaddress.py", line 71, in allocate_new
    "Must provide user for USER_RESERVED alloc_type")
AssertionError: Must provide user for USER_RESERVED alloc_type

Related branches

description: updated
description: updated
Raphaël Badin (rvb)
Changed in maas:
status: Triaged → Fix Committed
assignee: nobody → Raphaël Badin (rvb)
Changed in maas:
milestone: none → 1.6.0
Changed in maas:
status: Fix Committed → 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.