Bug 878394 - virsh iface-dumpxml or virt-manager reports "bond interface misses the bond element" for inactive bond interfaces
Summary: virsh iface-dumpxml or virt-manager reports "bond interface misses the bond e...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1057964 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-20 10:55 UTC by zhenfeng wang
Modified: 2016-04-26 13:38 UTC (History)
11 users (show)

Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1095774 (view as bug list)
Environment:
Last Closed: 2015-03-05 07:19:57 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description zhenfeng wang 2012-11-20 10:55:29 UTC
Description of problem:
It reported an error when I dump the bond0 interface which has been destroyed

Version-Release number of selected component (if applicable):
libvirt-0.10.2-8.el6.x86_64
package qemu-kvm is not installed
kernel-2.6.32-338.el6.x86_64

How reproducible:
100%
1 prepare a host with 2 ethernet, eth0 and eth1
2 Prepare the following xml:

<interface type='bond' name='bond0'>
   <start mode='none'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.50.1' validate='active'/>

    <interface type='ethernet' name='eth0'>

     </interface>
    <interface type='ethernet' name='eth1'>
    </interface>
   </bond>
</interface>

3  Define new bond0
# virsh iface-define bond0.xml

# virsh iface-start bond0
# virsh iface-list
Name                 State      MAC Address
--------------------------------------------
bond0                active     b8:ac:6f:3e:63:87
lo                   active     00:00:00:00:00:00

4 check the interface information
# virsh iface-dumpxml bond0 --inactive
<interface type='bond' name='bond0'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.50.1' validate='active'/>
    <interface type='ethernet' name='eth0'>
    </interface>
    <interface type='ethernet' name='eth1'>
    </interface>
  </bond>
</interface>
5 destroy the bond0 interface
 # virsh iface-destroy bond0
Interface bond0 destroyed

# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
bond0                inactive   00:00:00:00:00:00
lo                   active     00:00:00:00:00:00
# virsh iface-dumpxml bond0
error: XML error: bond interface misses the bond element

Actual results:
It reported an error when I dump the bond0 interface which has been destroyed

Expected results:
the bond0 interface should be dumped successfully and no reporting any error

Comment 6 Jiri Denemark 2014-04-04 21:37:14 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 7 Laine Stump 2014-04-07 10:33:14 UTC
The problem here is that when --inactive isn't specified on the commandline, libvirt *always* calls the function ncf_if_xml_state() (which provides xml of the live status of the interface) rather than ncf_if_xml_desc() (which provides the xml for the configuration of the interface), and when a bond interface isn't up, there is no useful information to put in the <bond> element, so it isn't included in the status xml.

The solution is for netcfInterfaceGetXMLDesc() to behave more like other drivers (e.g. the network driver of qemu driver) - if the object is currently inactive, it should report the inactive XML even if the --inactive flag isn't specified.

Comment 8 Laine Stump 2014-04-07 13:35:23 UTC
This is fixed upstream with the following commit:

commit 7284c499e54e538fd0ab35a1f09e358f06fc23b0
Author: Laine Stump <laine@laine.org>
Date:   Mon Apr 7 15:32:00 2014 +0300

    interface: dump inactive xml when interface isn't active
    
    Other drivers in libvirt (e.g. network, qemu) will automatically
    return the "inactive" (persistent configuration) XML of an object when
    that object is inactive. The netcf backend of the interface driver
    would always try to return the live status XML of the interface, even
    when it was down. Although netcf does return valid XML in that case,
    for bond interfaces it is missing almost all of its content, including
    the <bond> subelement itself, leading to this error message from
    "virsh iface-dumpxml" of a bond interface that is inactive:
    
      error: XML error: bond interface misses the bond element
    
    (this is because libvirt's validation of the XML returned by netcf
    always requires a <bond> element be present).
    
    This patch modifies the interface driver netcf backend to check if the
    interface is inactive, and in that case always return the inactive XML
    (which will always have a <bond> element, thus eliminating the error
    message, as well as making operation more in line with other drivers.

Comment 11 Laine Stump 2014-08-13 21:25:29 UTC
*** Bug 1057964 has been marked as a duplicate of this bug. ***

Comment 12 Hu Jianwei 2014-12-03 03:37:45 UTC
Verify as below:

[root@localhost 878394]# rpm -q libvirt netcf
libvirt-1.2.8-10.el7.x86_64
netcf-0.2.6-2.el7.x86_64

[root@localhost 878394]# cat bond0.xml 
<interface type='bond' name='bond0'>
   <start mode='none'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.7.130' validate='active'/>
    <interface type='ethernet' name='eno1'>
     </interface>
    <interface type='ethernet' name='enp2s0'>
    </interface>
   </bond>
</interface>

[root@localhost 878394]# virsh iface-define bond0.xml 
Interface bond0 defined from bond0.xml

[root@localhost 878394]# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 bond0                inactive   de:fc:3a:d8:90:df
 lo                   active     00:00:00:00:00:00

[root@localhost 878394]# virsh iface-start bond0
Interface bond0 started

[root@localhost 878394]# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 bond0                active     de:fc:3a:d8:90:df
 lo                   active     00:00:00:00:00:00

[root@localhost 878394]# virsh iface-dumpxml bond0 --inactive
<interface type='bond' name='bond0'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.7.130' validate='active'/>
    <interface type='ethernet' name='eno1'>
    </interface>
    <interface type='ethernet' name='enp2s0'>
    </interface>
  </bond>
</interface>


[root@localhost 878394]# virsh iface-dumpxml bond0 
<interface type='bond' name='bond0'>
  <protocol family='ipv4'>
    <ip address='10.66.4.186' prefix='22'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::26be:5ff:fe18:81ce' prefix='64'/>
  </protocol>
  <link speed='1000' state='up'/>
  <bond>
    <interface type='ethernet' name='eno1'>
      <link speed='1000' state='up'/>
      <mac address='24:be:05:18:81:ce'/>
    </interface>
    <interface type='ethernet' name='enp2s0'>
      <link speed='1000' state='up'/>
      <mac address='24:be:05:18:81:ce'/>
    </interface>
  </bond>
</interface>

[root@localhost 878394]# virsh iface-destroy bond0 
Interface bond0 destroyed

[root@localhost 878394]# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 bond0                inactive   de:fc:3a:d8:90:df
 lo                   active     00:00:00:00:00:00

[root@localhost 878394]# virsh iface-dumpxml bond0 
<interface type='bond' name='bond0'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.7.130' validate='active'/>
    <interface type='ethernet' name='eno1'>
    </interface>
    <interface type='ethernet' name='enp2s0'>
    </interface>
  </bond>
</interface>

[root@localhost 878394]# virsh iface-dumpxml bond0 
<interface type='bond' name='bond0'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond mode='active-backup'>
    <arpmon interval='100' target='192.168.7.130' validate='active'/>
    <interface type='ethernet' name='eno1'>
    </interface>
    <interface type='ethernet' name='enp2s0'>
    </interface>
  </bond>
</interface>


Try it using virt-manager, in "Network Interfaces" window, the information of bond0 can be displayed normally during inactive status.

Move to Verified.

Comment 14 errata-xmlrpc 2015-03-05 07:19:57 UTC
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


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