Bug 1205045
| Summary: | Command net-dhcp-leases enhancement | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yanbing du <ydu> |
| Component: | libvirt | Assignee: | Pavel Hrdina <phrdina> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, mzhan, rbalakri, shyu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:24:45 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
At first, you should have filed those two issues as separated bugs.
Both issues has been fixed in v1.2.11 by commit:
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.
Verify this bug with libvirt-1.2.17-8.el7.x86_64 # virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2015-09-10 11:34:42 52:54:00:18:95:1f ipv4 192.168.122.147/24 - - 2015-09-10 11:35:07 52:54:00:40:2b:42 ipv4 192.168.122.217/24 test - # virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2015-09-10 12:00:59 52:54:00:18:95:1f ipv4 192.168.122.147/24 - - 2015-09-10 12:21:16 52:54:00:40:2b:42 ipv4 192.168.122.217/24 test - For the second issue, I have file one new bug to track. Bug 1261432 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |
Description of problem: Version-Release number of selected component (if applicable): 1. Keep the lease during VM running 2. If the status file not exist, it should be treat as no lease yet, but filter with a specific MAC address should report error. How reproducible: libvirt-1.2.8-16.el7_1.2.x86_64 Steps to Reproduce: Issue 1: 1. Start a VM, which using the 'default' network: # virsh dumpxml virt-tests-vm1 ... <interface type='network'> <mac address='52:54:00:11:b5:47'/> <source network='default' bridge='virbr0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> ... 2. Check the dhcp leases info # virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2015-03-20 12:37:17 52:54:00:11:b5:47 ipv4 192.168.122.107/24 vm2-ydu1 - # cat /var/lib/libvirt/dnsmasq/virbr0.status [ { "ip-address": "192.168.122.107", "mac-address": "52:54:00:11:b5:47", "hostname": "vm2-ydu1", "expiry-time": 1426826237 } ] Then, keep the VM running and after the time count down to '2015-03-20 12:37:17', and run the command again, there's no lease info return. But the VM do have the lease, and the 'default.leases' file keep update the expiry time(The value in this example is not update yet) # cat /var/lib/libvirt/dnsmasq/default.leases 1426750046 52:54:00:11:b5:47 192.168.122.107 vm2-ydu1 * and the status file not update automatically. Issue 2: 1. Create/Define start a network(Using the 'default' network a temple) Just edit network name, bridge name and ip/dhcp range # virsh net-dumpxml virttestnet <network> <name>virttestnet</name> <uuid>34ff4355-ccb8-4a77-98f6-48a0efe477c8</uuid> <forward mode='nat'> <nat> <port start='1024' end='65533'/> </nat> </forward> <bridge name='virbr2' stp='on' delay='0'/> <mac address='52:54:00:26:33:12'/> <domain name='virttestnet'/> <ip address='192.168.110.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.110.2' end='192.168.110.254'/> </dhcp> </ip> </network> As no VM use this network, so the dhcp lease should be empty, and not 'virbr2.status' file create. There' an error in libvirtd.log: Mar 23 10:16:20 localhost journal: Failed to open file '/var/lib/libvirt/dnsmasq/virbr2.status': No such file or directory 2. Run command to check the dhcp leases # virsh net-dhcp-leases virttestnet Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 3. Run it again by using an invalid MAC address(Expect command fail) # virsh net-dhcp-leases virttestnet --mac 0000000000000000000000000 Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- # echo $? 0 Actual results: Expected results: 1. command return leases info if there's active interfaces 2. # virsh net-dhcp-leases virttestnet --mac 0000000000000000000000000 error: Failed to get leases info for virttestnet error: internal error: no lease with matching MAC address: 0000000000000000000000000 Additional info: