RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1095774 - 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 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-08 13:41 UTC by Laine Stump
Modified: 2016-04-26 14:42 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.10.2-36.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 878394
Environment:
Last Closed: 2014-10-14 04:21:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1374 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2014-10-14 08:11:54 UTC

Description Laine Stump 2014-05-08 13:41:46 UTC
+++ This bug was initially created as a clone of Bug #878394 +++

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

--- Additional comment from Laine Stump on 2014-04-07 06:33:14 EDT ---

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.

--- Additional comment from Laine Stump on 2014-04-07 09:35:23 EDT ---

This is fixed upstream with the following commit:

commit 7284c499e54e538fd0ab35a1f09e358f06fc23b0
Author: Laine Stump <laine>
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 1 Laine Stump 2014-05-08 14:16:10 UTC
When backporting to RHEL6, the following patch is also required to avoid writing new code:

commit 50f5468c960f4fe491399d5a495426e6cb6b41f1
Author: Michal Privoznik <mprivozn>
Date:   Tue Dec 10 18:56:57 2013 +0100

    interface: Introduce netcfInterfaceObjIsActive
    
    This function barely wraps ncf_if_status() and error handling code.

Comment 4 zhoujunqin 2014-05-23 07:54:19 UTC
Enviroment: host with 1 ethernet is ok.

I can reporduce it on below version,detail steps as below.
version:
libvirt-0.10.2-35.el6.x86_64
netcf-0.2.4-1.el6.x86_64

1. Prepare the following xml:
# cat bond3.xml 
<interface type='bond' name='bond3'>
   <start mode='none'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
  <bond>
      <interface type='ethernet' name='eth0'>
    </interface>
  </bond>
</interface>

2. Define and start new  bond3.
# virsh iface-define bond3.xml 
Interface bond3 defined from bond3.xml

# virsh iface-start bond3
Interface bond3 started

# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
bond3                active     18:03:73:bc:d1:7b
lo                   active     00:00:00:00:00:00

3. Check the interface information
# virsh iface-dumpxml bond3 --inactive
<interface type='bond' name='bond3'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond>
    <interface type='ethernet' name='eth0'>
    </interface>
  </bond>
</interface>

4. Destroy the bond3 interface
# virsh iface-destroy bond3 
Interface bond3 destroyed

# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
bond3                inactive   00:00:00:00:00:00
lo                   active     00:00:00:00:00:00

# virsh iface-dumpxml bond3 
error: XML error: bond interface misses the bond element


But I can not reproduce it on the new version, verify the bug as below:

Version:
netcf-0.2.4-1.el6.x86_64
libvirt-0.10.2-36.el6.x86_64

1. Repeate step 1,2,and 3 as above.
2. Destroy the bond3 interface
# virsh iface-destroy bond3
Interface bond3 destroyed
# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
bond3                inactive   00:00:00:00:00:00
lo                   active     00:00:00:00:00:00
3. Check the iface-dumpxml file.
# virsh iface-dumpxml bond3 
<interface type='bond' name='bond3'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond>
    <interface type='ethernet' name='eth0'>
    </interface>
  </bond>
</interface>

can dump an inactive interface successfully without no error.

With "virt-manager" it also works well as following steps:
1. Make sure NetworkManager is stopped
# service NetworkManager stop
2. #virt-manager --debug -> Edit -> Connection details -> Network Interface -> "+"(Add) -> "Interface type"-> "Bond" -> Forward

3. Configure the bond like this:
    Start mode: none
    Active now:  check on
    IP setting: IPv4: DHCP
    Choose interfaces to bond:  eth0.
   Click "Finish" with no error.
4. bond0 can be stopped and deleted with no error "bond interface misses the bond element" showed.

2014-05-23 15:47:03,267 (Interface:237): Creating interface 'bond0' with xml:
<interface type='bond' name='bond0'>
  <start mode='none'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond>
    <interface type='ethernet' name='eth0'>
      <mac address='18:03:73:bc:d1:7b'/>
      <protocol family='ipv4'>
        <ip address='10.66.5.15' prefix='22'/>
      </protocol>
      <protocol family='ipv6'>
        <ip address='fe80::1a03:73ff:febc:d17b' prefix='64'/>
      </protocol>
    </interface>
  </bond>
</interface>

2014-05-23 15:47:04,891 (engine:426): Tick is slow, not running at requested rate.
2014-05-23 15:47:11,324 (createinterface:1147): Install completed
2014-05-23 15:47:21,259 (host:909): Stopping interface 'bond0'
2014-05-23 15:47:24,711 (host:939): Deleting interface 'bond0'

see above steps, move to verified.

Comment 6 errata-xmlrpc 2014-10-14 04:21:48 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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html


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