maas api "device claim-sticky-ip-address" does not allocate an address when there are existing IPs assigned

Bug #1441013 reported by Dimiter Naydenov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Dimiter Naydenov

Bug Description

Same scenario as described in bug 1441002. I've tried using "device claim-sticky-ip-address" for a device I've previously assigned several IPs using set-sticky-ip-address. If I don't specify a "requested_address=" (only mac_address= or without it), it appears to succeed, but the list of IPs for the device in the result output is unchanged (only 3 I've previously set with set-sticky-ip-address are visible, but in the web UI after reloading the Devices page I can see the IP Assignedment column shows Static IP, rather than External IP as before). If I specify an available IP from the static range for "requested_address=" I get the same 500 INTERNAL SERVER ERROR ('bool' object has no attribute 'uuid') as described in the bug above, but the operation seems to succeed, as the address shows in a subsequent "devices list". Here's a paste of the steps I did and the results: http://paste.ubuntu.com/10759226/

Raphaël Badin (rvb)
Changed in maas:
status: New → Triaged
importance: Undecided → High
milestone: none → 1.8.0
Changed in maas:
assignee: nobody → Mike Pontillo (mpontillo)
Revision history for this message
Mike Pontillo (mpontillo) wrote :

I think one of Raphael's commits fixed the UUID problem you describe.

Regarding calling the claim-sticky-ip-address API more than once, let me see if I understand the use case: you want to claim X number of IP addresses for a device. In that situation, rather than calling the API X times, would it be better to call the API once to say (basically) something like:

device claim-sticky-ip-address count=5

:param count: (positive integer) Optional count of addresses to allocate. If specified, attempts to ensure that the device claims at least 'count' addresses. If the 'count' specifies is less than or equal to the number of IP addresses the device (or device+mac) has already allocated, the operation will return success, but will not allocate any additional IP addresses.

Thoughts?

Revision history for this message
Mike Pontillo (mpontillo) wrote :

We were talking about this in the standup this morning; we aren't sure there is a use case for claiming multiple IP addresses for a single MAC. What are you trying to accomplish?

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

I didn't explain well perhaps, I wasn't trying to claim multiple IPs for the same MAC, just running the command a few times and commenting on the results. So, no need to add count=X. If we need multiple IPs for the same device, we'll most likely call the API several times with different MACs for each IP (it could be useful to be able to do this in one API call, but it's not required for now at least - e.g. claim-sticky-ip-address mac_address=X mac_address=Y ... -> resulting in IP1 for X, IP2 for Y etc.)

I'll retest the original issue and add feedback. Thanks!

Changed in maas:
assignee: Mike Pontillo (mpontillo) → Dimiter Naydenov (dimitern)
Revision history for this message
Mike Pontillo (mpontillo) wrote : Re: [Bug 1441013] Re: maas api "device claim-sticky-ip-address" does not allocate an address when there are existing IPs assigned

Thanks. I think it's simpler not to allow multiple mac_address parameters
for this API. In the event that one of the "claims" fails, it may be
complex to determine which MAC failed to assign.

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

Retested with 1.8.0~beta2+bzr3814-0ubuntu1~trusty1 - now ip addresses in the result is updated and it works as expected AFAICS.

Changed in maas:
status: Triaged → Fix Committed
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.