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.
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]
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.
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
*** Bug 663664 has been marked as a duplicate of this bug. ***