Red Hat Bugzilla – Bug 991290
Fail to modify the name attribute of ipv6 dhcp host via virsh net-update
Last modified: 2016-04-26 11:04:44 EDT
Description of problem: Fail to modify the name attribute of ipv6 dhcp host via virsh net-update. The following error occurs. error: Requested operation is not valid: couldn't locate an existing dhcp host entry with "mac='(null)'" in network 'net7' An IPv6 host element differs slightly from that for IPv4: there is no mac attribute since a MAC address has no defined meaning in IPv6. Instead, the name attribute is used to identify the host to be assigned the IPv6 address. It works fine for ipv4 ip-dhcp-host. Version-Release number of selected component (if applicable): libvirt-1.1.1-1.el7.x86_64 How reproducible: 100% Steps to Reproduce: # virsh net-start net7 Network net7 started # virsh net-list Name State Autostart Persistent ---------------------------------------------------------- net7 active no yes # virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c191e1a3-bb51-491f-b63f-5c4a87af2adf</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0' /> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff' /> <host name='lucas' ip='2001:db8:ca2:2:3::4' /> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> # virsh net-update net7 modify ip-dhcp-host "<host name='lucas.redhat' ip='2001:db8:ca2:2:3::5' />"error: Failed to update network net7 error: Requested operation is not valid: couldn't locate an existing dhcp host entry with "mac='(null)'" in network 'net7' Actual results: Fail to modify the name attribute of ipv6 dhcp host via virsh net-update Expected results: Successfully modify the name attribute of ipv6 dhcp host via virsh net-update Additional info:
Could reproduce with component: libvirt-1.1.1-1.el7.x86_64 Here are reproduce steps: 1. Create a xml file contained following contents, and named it wtih network.xml <network> <name>net7</name> <uuid>c191e1a3-bb51-491f-b63f-5c4a87af2adf</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0' /> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff' /> <host name='lucas' ip='2001:db8:ca2:2:3::4' /> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> 2. issue the following command to define net7: #virsh net-define network.xml 3. issue the following command to start net7: # virsh net-start net7 Network net7 started 4. check the network net7: # virsh net-list 5. dump xml file for network net7 by: # virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c191e1a3-bb51-491f-b63f-5c4a87af2adf</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0' /> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff' /> <host name='lucas' ip='2001:db8:ca2:2:3::4' /> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> 6. modify dhcp host by: # virsh net-update net7 modify ip-dhcp-host "<host name='lucas.redhat' ip='2001:db8:ca2:2:3::5' />" Result: error: Failed to update network net7 error: Requested operation is not valid: couldn't locate an existing dhcp host entry with "mac='(null)'" in network 'net7'
Proposed upstream patch: https://www.redhat.com/archives/libvir-list/2014-July/msg00429.html Note: in the reproducer steps both the host name and the ip address are changed in the last step. An error is expected in that case (but it needs to be improved too).
Now pushed upstream: commit 2d49518a53cd589c5e6cda9d4dbf07c5304e1c28 Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2014-07-09 09:23:02 +0200 Allow updating names in DHCP hosts by matching IPs. Also fix the error message if an IPv6 host with no MAC is not found. https://bugzilla.redhat.com/show_bug.cgi?id=991290 git describe: v1.2.6-90-g2d49518
I can not reproduce the bug on libvirt-1.2.8-6.el7.x86_64 [root@localhost ~]# rpm -q libvirt libvirt-1.2.8-6.el7.x86_64 [root@localhost ~]# virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c34ea3f7-c3b0-4bfc-8e5b-1d14196766ba</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0'/> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff'/> <host name='lucas' ip='2001:db8:ca2:2:3::99'/> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> [root@localhost ~]# virsh net-update net7 modify ip-dhcp-host "<host name='lucas' ip='2001:db8:ca2:2:3::33' />" Updated network net7 live state [root@localhost ~]# virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c34ea3f7-c3b0-4bfc-8e5b-1d14196766ba</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0'/> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff'/> <host name='lucas' ip='2001:db8:ca2:2:3::33'/> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> [root@localhost ~]# virsh net-destroy net7 Network net7 destroyed [root@localhost ~]# virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c34ea3f7-c3b0-4bfc-8e5b-1d14196766ba</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0'/> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff'/> <host name='lucas' ip='2001:db8:ca2:2:3::99'/> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> [root@localhost ~]# virsh net-update net7 modify ip-dhcp-host "<host name='lucas' ip='2001:db8:ca2:2:3::55' />" Updated network net7 persistent config [root@localhost ~]# virsh net-dumpxml net7 <network> <name>net7</name> <uuid>c34ea3f7-c3b0-4bfc-8e5b-1d14196766ba</uuid> <forward mode='route'/> <bridge name='virbr7' stp='on' delay='0'/> <mac address='52:54:00:a0:45:87'/> <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:8::100' end='2001:db8:ca2:8::fff'/> <host name='lucas' ip='2001:db8:ca2:2:3::55'/> </dhcp> </ip> <route family='ipv6' address='2001:db8:ca2:8::' prefix='64' gateway='2001:db8:ca2:7::4'/> </network> Can get expected results, changed to Verified.
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/RHSA-2015-0323.html