Several IPs assigned to the same iface in the DB due to 'free' leases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| MAAS |
Critical
|
Mike Pontillo |
Bug Description
Using MAAS 1.9.4, when the dhcpd.leases file contains a 'free' lease, it is parsed and inserted in the DB as an 'active' lease would be. If the deployed server uses only 'DHCP' interfaces, it might trigger DNS issues (the FQDN could change IPs).
For instance, this is an affected DB:
maasdb=# SELECT node.id, node.hostname, iface.id, iface.name, mac_address, sip.id, ip, alloc_type FROM maasserver_
id | hostname | id | name | mac_address | id | ip | alloc_type
----+--
1 | node1 | 2 | eth0 | fa:16:3e:45:da:d8 | 28 | 10.12.1.100 | 6
1 | node1 | 2 | eth0 | fa:16:3e:45:da:d8 | 29 | 10.12.1.102 | 6
1 | node1 | 2 | eth0 | fa:16:3e:45:da:d8 | 10 | | 5
1 | node1 | 3 | eth1 | fa:16:3e:a2:8e:84 | 24 | 10.12.1.101 | 6
1 | node1 | 3 | eth1 | fa:16:3e:a2:8e:84 | 11 | | 1
2 | node2 | 6 | eth0 | fa:16:3e:09:82:db | 24 | 10.12.1.101 | 6
2 | node2 | 6 | eth0 | fa:16:3e:09:82:db | 16 | 10.12.1.103 | 6
2 | node2 | 6 | eth0 | fa:16:3e:09:82:db | 17 | | 5
2 | node2 | 7 | eth1 | fa:16:3e:ee:bc:2e | 29 | 10.12.1.102 | 6
2 | node2 | 7 | eth1 | fa:16:3e:ee:bc:2e | 18 | | 1
3 | node3 | 8 | eth0 | fa:16:3e:9e:fa:80 | 16 | 10.12.1.103 | 6
3 | node3 | 8 | eth0 | fa:16:3e:9e:fa:80 | 20 | 10.12.1.105 | 6
And a 'free' lease that ended up in the table:
lease 10.12.1.100 {
starts 4 2016/12/22 06:39:09;
cltt 4 2016/12/22 06:39:09;
binding state free;
hardware ethernet fa:16:3e:45:da:d8;
}
I'm still testing, but changing get_expiry_
--- 1/src/provision
+++ 2/src/provision
@@ -126,7 +126,15 @@
"""
assert is_lease(lease)
ends = getattr(lease, 'ends', None)
- if ends is None or len(ends) == 0 or ends.lower() == 'never':
+ if ends is None or len(ends) == 0:
+ state = getattr(lease, 'binding state', None)
+ if state.lower() == 'active':
+ return None
+ else:
+ # Free leases have starts but not ends
+ starts = getattr(lease, 'starts', None)
+ return datetime.
+ if ends.lower() == 'never':
return None
else:
return datetime.
Related branches
- Blake Rouse (community): Approve on 2017-02-07
-
Diff: 449 lines (+192/-51)5 files modifiedsrc/maasserver/rpc/leases.py (+2/-0)
src/maasserver/rpc/tests/test_regionservice.py (+6/-1)
src/provisioningserver/dhcp/leases_parser.py (+32/-11)
src/provisioningserver/dhcp/leases_parser_fast.py (+24/-6)
src/provisioningserver/dhcp/tests/test_leases_parser.py (+128/-33)
Mike Pontillo (mpontillo) wrote : | #2 |
We're revisiting this, since some critical bugs with the DHCP lease parser were found when looking at this. (Thanks for the patch; it was a good starting point.) See the linked branch for more details.
Note that even with these fixes, there are still potential issues with IP addressing in MAAS 1.9 that can only be fixed by design (by upgrading to MAAS 2.x).
Changed in maas: | |
status: | Won't Fix → In Progress |
importance: | Undecided → Critical |
assignee: | nobody → Mike Pontillo (mpontillo) |
milestone: | none → 1.9.5 |
Victor Tapia (vtapia) wrote : | #3 |
Hi Mike, Andres:
We've been testing the suggested branch and the reported issue disappears, so +1 to merging :).
Thanks again!
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
As per the discussion, MAAS 2.0 addresses the issues related to IP addressing and 2.0 is not backportable to trusty.