Bug 736920 - [netcf][Regression] Command "virsh iface-dumpxml $BOND" will got an error with netcf-0.1.9-1, but not other version
Summary: [netcf][Regression] Command "virsh iface-dumpxml $BOND" will got an error wit...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: netcf
Version: 6.2
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: 6.2
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-09 05:47 UTC by kjia
Modified: 2011-12-06 15:19 UTC (History)
5 users (show)

Fixed In Version: netcf-0.1.9-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 855572 (view as bug list)
Environment:
Last Closed: 2011-12-06 15:19:20 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1631 normal SHIPPED_LIVE netcf bug fix and enhancement update 2011-12-06 00:50:45 UTC

Description kjia 2011-09-09 05:47:33 UTC
Description of problem:

Command "virsh iface-dumpxml ..." will got an error like "error: XML error: bond interface misses the bond element" when we want to check the bond interface's xml file. It happened when netcf's version is 0.1.9-1. The version of 0.1.8-1 and 0.1.7-1 have no this problem.

Version-Release number of selected component (if applicable):

libvirt-0.9.4-10.el6.x86_64
netcf-0.1.9-1.el6.x86_64

How reproducible:

always

Steps to Reproduce:

Need two NIC, eth0 and eth1

1.Create a file with content below, assuming the name is bond0.xml:
<interface type='bond' name='bond0'>
   <start mode='none'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
   <bond mode='active-backup'>
    <miimon freq='100' updelay='10' carrier='ioctl'/>
    <interface type='ethernet' name='eth0'>
   </interface>
    <interface type='ethernet' name='eth1'>
    </interface>
   </bond>
</interface>

2.stop NetworkManager service
# service NetworkManager stop
  and restart network service.
# service network restart

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

4. Check the new bond0
# virsh iface-dumpxml bond0

Actual results:

Actually, we will got "error: XML error: bond interface misses the bond element"


Expected results:

Show the detail information about the bond0. It should be the same with bond0.xml.


Additional info:

Comment 3 Laine Stump 2011-09-22 12:36:49 UTC
The following has been posted for review upstream (not showing up in the archives yet, so I can't just paste a link):

commit 2637ff98c0cd1ff6712068d990bc7f8e6ad13c30
Author: Laine Stump <laine@laine.org>
Date:   Thu Sep 22 01:40:48 2011 -0400

    Fix missing vlan/bond/ethernet info in dumpxml --live
    
    This patch addresses:
    
      https://bugzilla.redhat.com/show_bug.cgi?id=736920
      https://bugzilla.redhat.com/show_bug.cgi?id=739505
    
    Commit 38f44cf (pushed between 0.1.8 and 0.1.9) put a check for an
    invalid ifindex into the functions that add type-specific status data
    to the xml document (e.g. the mac address of an ethernet, or tag of a
    vlan). This check was inadvertently done incorrectly ("ifindex !=
    RTNL_LINK_NOT_FOUND" rather than "ifindex == RTNL_LINK_NOT_FOUND").
    This patch corrects that error.
    
    Because these functions are a part of the code to gather info from the
    kernel via libnl (netlink) calls, there is unfortunately no simple way
    to incorporate a build-time test to prevent similar regressions in the
    future; we will instead have to rely on separate testing.

diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 75492ba..730be45 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -909,7 +909,7 @@ static void add_ethernet_info(struct netcf *ncf,
     struct rtnl_link *filter_link = NULL;
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex != RTNL_LINK_NOT_FOUND)
+    if (ifindex == RTNL_LINK_NOT_FOUND)
         return;
 
     filter_link = rtnl_link_alloc();
@@ -998,7 +998,7 @@ static void add_vlan_info(struct netcf *ncf,
     struct rtnl_link *filter_link = NULL;
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex != RTNL_LINK_NOT_FOUND)
+    if (ifindex == RTNL_LINK_NOT_FOUND)
         return;
 
     filter_link = rtnl_link_alloc();
@@ -1113,7 +1113,7 @@ static void add_bond_info(struct netcf *ncf,
         = { doc, root, NULL, ifindex, ncf };
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex != RTNL_LINK_NOT_FOUND)
+    if (ifindex == RTNL_LINK_NOT_FOUND)
         return;
 
     nl_cache_foreach(ncf->driver->link_cache, add_bond_info_cb, &cb_data);

Comment 5 Laine Stump 2011-09-26 19:02:55 UTC
A fix for this bug is available in a new netcf build for RHEL6:

  https://brewweb.devel.redhat.com/buildinfo?buildID=180923

Comment 7 Vivian Bian 2011-09-27 03:33:36 UTC
tested with 
libvirt-0.9.4-13.el6.x86_64
netcf-0.1.9-2.el6.x86_64

Steps:
1.Create a file with content below, assuming the name is bond0.xml:
<interface type='bond' name='bond0'>
   <start mode='none'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
   <bond mode='active-backup'>
    <miimon freq='100' updelay='10' carrier='ioctl'/>
    <interface type='ethernet' name='eth0'>
   </interface>
    <interface type='ethernet' name='eth1'>
    </interface>
   </bond>
</interface>

2.stop NetworkManager service
# service NetworkManager stop
  and restart network service.
# service network restart

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

4. Check the new bond0
# virsh iface-dumpxml bond0
<interface type='bond' name='bond0'>
 <bond>
    <interface type='ethernet' name='eth0'>
       <mac address='00:21:9b:57:9f:58'/>
    </interface>
    <interface type='ethernet' name='eth1'>
       <mac address='00:21:9b:57:9f:59'/>
    </interface>
 </bond>
</interface>

According to above , set bug status to VERIFIED

Comment 8 errata-xmlrpc 2011-12-06 15:19:20 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-2011-1631.html


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