find_ip_via_arp() results in unpredictable, and in some cases, incorrect IP addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| MAAS |
High
|
Dustin Kirkland | ||
| maas (Ubuntu) |
High
|
Unassigned | ||
| Trusty |
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 2014-04-21
-
Diff: 12 lines (+1/-1)1 file modifiedsrc/provisioningserver/utils/__init__.py (+1/-1)
Dustin Kirkland (kirkland) wrote : | #1 |
Changed in maas (Ubuntu): | |
importance: | Undecided → High |
Changed in maas: | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in maas (Ubuntu): | |
status: | New → Triaged |
milestone: | none → trusty-updates |
Dustin Kirkland (kirkland) wrote : | #2 |
tags: | added: patch |
Julian Edwards (julian-edwards) wrote : Re: [Bug 1310844] Re: find_ip_via_arp() results in unpredictable, and in some cases, incorrect IP addresses | #3 |
> 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.
Don't you mean a single MAC with multiple IPs? The other way around would be
absurd and break your network.
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.