Bug 1228631 - No DHCP lease file for default network
Summary: No DHCP lease file for default network
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-05 11:05 UTC by Michal Sekletar
Modified: 2017-12-26 06:36 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-06-05 11:10:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michal Sekletar 2015-06-05 11:05:29 UTC
Description of problem:

If you add VM via virt-manager on F22, then default network to which VM is attached has dnsmasq configuration which doesn't specify dhcp-leasefile option.


Version-Release number of selected component (if applicable):
libvirt-1.2.13.1-1.fc22.x86_64

How reproducible:
always

Steps to Reproduce:
1. add VM via virt-manager
2. start the VM, connect via virsh console and verify that VM has an IP assigned
3. cat /var/lib/libvirt/dnsmasq/default.leases

Actual results:
no DHCP lease recorded

Expected results:
DHCP lease is added to /var/lib/libvirt/dnsmasq/default.leases

Additional info:
I am not sure whether this issue is bug in virt-manager or libvirt. Please change component if appropriate.

Comment 1 Daniel Berrangé 2015-06-05 11:10:58 UTC
This is intentional - libvirt does not use the dnsmasq managed lease file any more, instead it uses the dhcp script facility.

Comment 2 Michal Sekletar 2015-06-05 11:25:32 UTC
(In reply to Daniel Berrange from comment #1)

> This is intentional - libvirt does not use the dnsmasq managed lease file
> any more, instead it uses the dhcp script facility.

Can you please point me to some documentation/ML discussion where I could learn more about this change.

Comment 3 Daniel Berrangé 2015-06-05 11:29:19 UTC
It was done because dnsmasq's lease file did not store enough info for us to report IPv6 addresses assigned to guests.


commit baafe668fa56767c031468ccd5df3e62eaa11370
Author: Nehal J Wani <nehaljw.kkd1>
Date:   Mon Jun 2 11:19:26 2014 +0100

    Add helper program to create custom leases
    
    Introduce helper program to catch events from dnsmasq and maintain a custom
    lease file per network. It supports dhcpv4 and dhcpv6. The file is saved as
    "<interface-name>.status".
    
    Each lease contains the following info:
    <expiry-time (epoch time)> <mac> <iaid> <ip-address> <hostname> <clientid>
    
    Example of custom leases file content:
    [
        {
            "iaid": "1221229",
            "ip-address": "2001:db8:ca2:2:1::95",
            "mac-address": "52:54:00:12:a2:6d",
            "hostname": "Fedora20",
            "client-id": "00:04:1a:c1:d9:6b:5a:0a:e2:bc:f8:4b:1e:37:2e:38:22:55",
            "expiry-time": 1393244216
        },
        {
            "ip-address": "192.168.150.208",
            "mac-address": "52:54:00:11:56:b3",
            "hostname": "Wani-PC",
            "client-id": "01:52:54:00:11:56:b3",
            "expiry-time": 1393244248
        }
    ]
    
    src/Makefile.am:
       * Add options to compile the helper program
    
    src/network/bridge_driver.c:
       * Introduce networkDnsmasqLeaseFileNameCustom()
       * Invoke helper program along with dnsmasq
       * Delete the .status file when corresponding n/w is destroyed.
    
    src/network/leaseshelper.c
       * Helper program to create the custom lease file


commit 0f87054b61d73493fb505ecb97bd16615bc53699
Author: Nehal J Wani <nehaljw.kkd1>
Date:   Tue Nov 18 22:46:25 2014 +0530

    leaseshelper: improvements to support all events
    
    This patch enables the helper program to detect event(s) triggered when
    there is a change in lease length or expiry and client-id. This
    transfers complete control of leases database to libvirt and obsoletes
    use of the lease database file (<network-name>.leases). That file will
    not be created, read, or written.  This is achieved by adding the option
    --leasefile-ro to dnsmasq and passing a custom env var to leaseshelper,
    which helps us map events related to leases with their corresponding
    network bridges, no matter what the event be.
    
    Also, this requires the addition of a new non-lease entry in our custom
    lease database: "server-duid". It is required to identify a DHCPv6
    server.
    
    Now that dnsmasq doesn't maintain its own leases database, it relies on
    our helper program to tell it about previous leases and server duid.
    Thus, this patch makes our leases program honor an extra action: "init",
    in which it sends the known info in a particular format to dnsmasq
    by printing it to stdout.
    
    The drawback of this change is that upgrade to this new approach does
    not transfer the existing leases for the network if the leaseshelper
    wasn't already used.

Comment 4 John 2017-12-26 06:36:00 UTC
I love coming to BugZilla for "documentation".


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