Bug 687551

Summary: Defining multiple libvirt networks causes dnsmasq to hit DHCP lease max prematurely
Product: Red Hat Enterprise Linux 6 Reporter: Laine Stump <laine>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: dallan, dyuan, eblake, mjenner, xhu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.7-13.el6 Doc Type: Bug Fix
Doc Text:
In previous releases, libvirt set a maximum lease limit for DHCP leases on each virtual network according to the number of addresses available on that network. However, all networks shared the same leasefile, so the maximum lease limit was reached long before all networks had given out all of their addresses. This meant that some guests were unable to obtain IP addresses. With this release of libvirt, each virtual network uses its own leasefile, so there is sufficient space for all configured addresses to be allocated.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:29:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Laine Stump 2011-03-15 15:08:23 UTC
dnsmasq has an option (--dhcp-lease-max) which allows specifying the maximum number of leases allowed in the dhcp leases file. libvirt runs a separate instance of dnsmasq for each network, and sets this option to exactly the number of addresses in the dhcp range for the given network.

However, by default all instances of dnsmasq (including any non-libvirt instances serving the physical network) share the same lease file, so if multiple copies of dnsmasq have all given out addresses, the lease file can fill up to the limit allowed by a particular instance long before it has actually allocated that many addresses.

The solution is to use the --dhcp-leasefile argument on each dnsmasq instance to specify a separate leasefile for each. This fix has already been applied upstream:

   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

There are multiple upstream bugs filed against this problem:

Bug 537335
Bug 663664
Bug 674356

Comment 2 Laine Stump 2011-03-15 15:47:03 UTC
A rebase of the upstream patch has been sent to rhvirt-patches for
consideration:

  http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-March/msg00335.html

Comment 3 Laine Stump 2011-03-15 17:18:26 UTC
v1 of the patch series was missing a prerequisite. New posting to
rhvirt-patches: 

http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-March/msg00340.html

Comment 6 Laine Stump 2011-05-03 18:10:20 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
In previous releases, libvirt was setting a "maximum leases" limit for dhcp leases on each virtual network according to the number of addresses available on that network, but all the networks were sharing the same leasefile, so the "max lease" limit would be reached far before all the networks had given out all their addresses. This could lead to the failure of guests to acquire an IP address.

With this release of libvirt, each virtual network uses its own leasefile, so there are exactly enough slots in the leasefiles to allow all configured addresses to be allocated.

Comment 9 Laura Bailey 2011-05-04 02:38:45 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,3 +1 @@
-In previous releases, libvirt was setting a "maximum leases" limit for dhcp leases on each virtual network according to the number of addresses available on that network, but all the networks were sharing the same leasefile, so the "max lease" limit would be reached far before all the networks had given out all their addresses. This could lead to the failure of guests to acquire an IP address.
+In previous releases, libvirt set a maximum lease limit for DHCP leases on each virtual network according to the number of addresses available on that network. However, all networks shared the same leasefile, so the maximum lease limit was reached long before all networks had given out all of their addresses. This meant that some guests were unable to obtain IP addresses. With this release of libvirt, each virtual network uses its own leasefile, so there is sufficient space for all configured addresses to be allocated.-
-With this release of libvirt, each virtual network uses its own leasefile, so there are exactly enough slots in the leasefiles to allow all configured addresses to be allocated.

Comment 10 errata-xmlrpc 2011-05-19 13:29:04 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html