Bug 1001078 - virsh net-update delete ip-dhcp-host fails with incomplete XML
virsh net-update delete ip-dhcp-host fails with incomplete XML
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity low
: rc
: ---
Assigned To: Ján Tomko
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-26 09:02 EDT by Ján Tomko
Modified: 2014-06-17 20:54 EDT (History)
5 users (show)

See Also:
Fixed In Version: libvirt-1.1.1-3.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 07:50:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ján Tomko 2013-08-26 09:02:05 EDT
Description of problem:
deleting a host with incomplete XML 

Version-Release number of selected component (if applicable):
libvirt-1.1.1-2.el7.x86_64

How reproducible:
You may rely on it.

Steps to Reproduce:
1. Have a network with a host in the dhcp section:
<network>
  <name>default</name>
...
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
      <host mac='12:34:56:78:90:ab' name='aaa' ip='192.168.122.123' />
    </dhcp>
  </ip>
</network>

2. virsh # net-update default delete ip-dhcp-host "<host ip='192.168.122.123'/>"
error: Failed to update network default
error: XML error: Static host definition in IPv4 network 'default' must have mac or name attribute

Expected results:
The host is deleted since it's uniquely identified by the IP.

Additional info:
Fixed upstream by:
commit cf602e7c597830a2d949017fe71f06b5f542c805
Author:     Ján Tomko <jtomko@redhat.com>
AuthorDate: 2013-07-31 13:25:59 +0200
Commit:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2013-08-07 16:31:12 +0200

    Reverse logic allowing partial DHCP host XML
    
    Before, missing attributes were only OK when adding entries;
    modification and deletion required all of them.
    
    Now, only deletion works with missing attributes, as long as
    the host is uniquely identified.

git describe: v1.1.1-76-gcf602e7

The commit message is not completely accurate: Even though partial entries were parsed as correct when adding hosts by the function the commit is fixing, they were rejected later when the whole network XML was verified.
Comment 3 Jincheng Miao 2013-09-03 02:27:11 EDT
# rpm -q libvirt
libvirt-1.1.1-3.el7.x86_64

# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>a04a5f8f-1f1a-45f6-ad95-e9d7cc07cf5f</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:71:f8:62'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
      <host mac='12:34:56:78:90:ab' name='aaa' ip='192.168.122.123' />
    </dhcp>
  </ip>
</network>

# virsh net-update default delete ip-dhcp-host "<host ip='192.168.122.123'/>"
Updated network default live state

# virsh net-dumpxml default<network>
  <name>default</name>
  <uuid>a04a5f8f-1f1a-45f6-ad95-e9d7cc07cf5f</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:71:f8:62'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

host part is removed correctly, so I change the status to VERIFIED.
Comment 4 Ludek Smid 2014-06-13 07:50:47 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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