Bug 537335 - Virtual network driver should configure dnsmasq dhcp lease file
Summary: Virtual network driver should configure dnsmasq dhcp lease file
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Laine Stump
QA Contact:
URL:
Whiteboard:
: 663664 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-11-13 08:34 UTC by Tomas Mraz
Modified: 2011-03-12 15:11 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-03-12 15:09:55 UTC
Embargoed:


Attachments (Terms of Use)

Description Tomas Mraz 2009-11-13 08:34:03 UTC
If I have multiple virtual networks on a host multiple instances of dnsmasq are running. These instances will step over their toes and overwrite the /var/lib/dnsmasq/dnsmasq.leases file. The libvirt should use the --dhcp-leasefile option to set up a different lease file preferably containing the network id in the name.

Comment 1 Daniel Berrangé 2009-11-13 10:43:50 UTC
According to the manual page the DHCP lease file is for reading persistent leases, not writing allocated lease out. In addition its use is deprecated and 
not available in many distros, hence we removed it from libvirt.

[quote]
Use the  specified file to store DHCP lease information. If this option is given but no dhcp-range option is given then dnsmasq version 1 behaviour is activated. The file given is assumed to be an ISC dhcpd lease file  and parsed for  leases  which  are  then  added  to  the  DNS system if they have a hostname. This functionality may have been excluded from dnsmasq at compile time, in which case an error will occur. In any case note that ISC leasefile integration is a deprecated feature. It should not be used in new installations, and will be removed in a future release.
[/quote]

Comment 2 Tomas Mraz 2009-11-13 11:22:52 UTC
I think you read the man page wrong. If you give the dhcp-range option as you do when invoking dnsmasq when the range is defined the dnsmasq uses the file to store the transient leases and the deprecated ISC leasefile integration is not used. So at least in cases when you pass the dhcp-range option you should pass the dhcp-leasefile option as well.

Comment 3 Laine Stump 2011-03-12 15:09:55 UTC
A patch to provide a separate leases file for each instance of dnsmasq has been pushed to upstream libvirt, so this problem will be fixed.

   commit 13c00dde3171b3a38d23cceb3f9151cb6cac3dad
   Author: Laine Stump <laine>
   Date:   Fri Mar 11 13:20:48 2011 -0500

   network driver: Use a separate dhcp leases file for each network


This fix will be in libvirt-0.9.0.

(I notice that the paragraph of the dnsmasq manpage that Daniel quotes has been removed from recent dnsmasq versions, and examination of the leases files does show that it's used as Tomas describes. Re-examining the old manpage, I agree with Tomas' interpretation; even in this case, the patch that's been applied to libvirt only specifies a leasefile if a dhcp-range has also been specified, so old versions of dnsmasq should also be safe with this patch)

Note also:

Bug 663664
Bug 674356

Comment 4 Laine Stump 2011-03-12 15:11:10 UTC
*** Bug 663664 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.