find_ip_via_arp() results in unpredictable, and in some cases, incorrect IP addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Dustin Kirkland | ||
maas (Ubuntu) |
Triaged
|
High
|
Unassigned | ||
Trusty |
Triaged
|
High
|
Unassigned |
Bug Description
MAAS was changed recently to have the AMT power template require MAC addresses rather than IP addresses, in that there is a race condition, when AMT is expecting DHCP to provide an address, and the MAAS DHCP server may not be running yet.
The solution was to create a function, find_ip_via_arp() in src/provisionin
Unfortunately, the output of this function is somewhat unpredictable, particularly in a MAC address resolves to multiple IP addresses.
That's easily reproducible, if you set AMT to use a static IP address, while the OS running on the system draws its own DHCP address from MAAS. In this case, there are actually multiple MAC addresses with the same IP address.
To at least provide consistent results by this function, I strongly recommend that this code sorts the results, so that the lowest IP address is returned. While not perfect, it's at least predictable, and we can work with that.
=== modified file 'src/provisioni
--- src/provisionin
+++ src/provisionin
@@ -819,7 +819,7 @@
output = call_capture_
- for line in output:
+ for line in sorted(output):
columns = line.split()
if len(columns) == 5 and columns[2] == mac:
return columns[0]
Related branches
- MAAS Maintainers: Pending requested
-
Diff: 12 lines (+1/-1)1 file modifiedsrc/provisioningserver/utils/__init__.py (+1/-1)
tags: | added: patch |
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
milestone: | none → 1.6.0 |
assignee: | nobody → Dustin Kirkland (kirkland) |
Changed in maas: | |
status: | Fix Committed → Fix Released |
Changed in maas (Ubuntu): | |
milestone: | trusty-updates → none |
Proposing this for trusty-updates. This one-line fix solves a big problem I'm having using AMT systems with MAAS in trusty right now.