Wrong expire date in nova-dhcpbridge init output
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
New
|
Undecided
|
Unassigned | ||
nova (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
TL; DR;
nova-dhcpbridge init generated leases file with instance updated_at instead of fixed_ips updated_at, causing every leases to be expired for several month. So everytime dnsmasq is restarted will sent DHCPNAK the first time a client ask for renew its lease.
Long version:
dnsmasq expected the leases format to have:
* one line per lease
* first column is the expire date in second since epoc.
* we don’t care about other column for this issue :)
This is the case for dnsmasq 2.59 and 2.65 (precise version and raring version).
But the output of nova-dhcpbridge init (which is called by dnsmasq to load the leases):
1352420950 xx:xx:3e:01:7d:xx 10.0.0.3 app01.domain *
1352421657 xx:xx:3e:7e:0a:xx 10.0.0.4 app02.domain *
[...]
So the expire date for those entry are: 9 November 2012 around 1am. The script was run the 25 January 2013 at 9am (UTC). With our lease time of 1 day, we expected an expire date at 25 January 2013 at 10am.
So when loaded dnsmasq read all leases and found all leases expired and then discard all leases. This cause dnsmasq to reply DHCPNAK for DHCPREQUEST (since for dnsmasq the lease requested didn’t exist because it’s expired). Hopefully, when client come with a DHCPDISCOVER, dnsmasq will get information form configuration file (/var/lib/
At the end everytime dnsmasq is restarted, when client try to renew a lease it will get a DHCPNAK and it’s interface goes down (loss all IP). Even if the DHCPDISCOVER send right after will re-add the IP, this can trouble some services (in our case, pacemaker which manage a virtual IP).
Digging a bit on how nova-dhcpbridge generated the leases file, it seems to come from:
* _host_lease function in nova/network/
if data['instance_
timestamp = data['instance_
else:
timestamp = data['instance_
seconds_
return '%d %s %s %s *' % (seconds_
data[‘instance_
From my understanding of how nova-dhcpbridge works, every time dnsmasq reply to a client with a new lease, it call the nova-dhcpbridge script which update the database (table fixed_ips, column updated_at). So I think instead of “instance_updated”, we sould use “fixed_
Version of software (Ubuntu version):
* Ubuntu 12.04 (precise) amd64
* nova-* 2012.1.
* dnsmasq 2.65-1~precise1
The way leases file are generated by nova-dhcpbridge (_host_lease function in nova/network/
Status changed to 'Confirmed' because the bug affects multiple users.