Bug 739505 - dumpxml for a vlan will get error
Summary: dumpxml for a vlan will get error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: netcf
Version: 6.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-19 10:21 UTC by yanbing du
Modified: 2011-12-06 15:19 UTC (History)
6 users (show)

Fixed In Version: netcf-0.1.9-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 855571 (view as bug list)
Environment:
Last Closed: 2011-12-06 15:19:23 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 yanbing du 2011-09-19 10:21:12 UTC
Description of problem:
There's no problem when using virsh command to define and start a vlan, but dumpxml for the active vlan, will get an error.
When downgrade netcf to netcf-0.1.8-1.el6, still get the problem, but downgrade libvirt to libvirt-0.8.7-18.el6, there's no problem, so it's a regression bug.

Version-Release number of selected component (if applicable):
libvirt-0.9.4-11.el6.x86_64
netcf-0.1.9-1.el6

How reproducible:
always

Steps to Reproduce:
1.Define and start a vlan from vlan.xml.
# cat vlan.xml
<interface type='vlan' name='eth0.1'>
   <start mode='onboot'/>
   <protocol family='ipv4'>
      <ip address='192.168.177.1' prefix='24'/>
   </protocol>
   <vlan tag='1'>
     <interface name='eth0'/>
   </vlan>
</interface>
# virsh iface-define vlan.xml 
Interface eth0.1 defined from vlan.xml
# virsh iface-start eth0.1
Interface eth0.1 started

2.Try to get the xml of the active vlan
# virsh iface-dumpxml eth0.1
error: XML error: vlan interface misses the vlan element

3.Destroy the vlan and dumpxml again
# virsh iface-destroy eth0.1
Interface eth0.1 destroyed
# virsh iface-dumpxml eth0.1
<interface type='ethernet' name='eth0.1'>
</interface>

  
Actual results:
error: XML error: vlan interface misses the vlan element


Expected results:
# virsh iface-dumpxml eth0.1
<interface type='vlan' name='eth0.1'>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::baac:6fff:fe3a:f6f4' prefix='64'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eth0'/>
  </vlan>
</interface>

Additional info:
libvirt.log
------
17:51:30.787: 2107: error : virInterfaceDefParseXML:814 : XML error: vlan interface misses the vlan element
------

BTW, when encounter this bug, it also affect virt-manager to install a new guest.

Comment 3 yanbing du 2011-09-19 12:37:17 UTC
retried with libvirt-0.9.4-11.el6.x86_64 + netcf-0.1.8-1.el6, after downgrade netcf and restart libvirtd, #virsh iface-dumpxml $vlan can get the correct result. So it's a netcf regression. 
There's already a Bug 736920 - [netcf][Regression] Command "virsh iface-dumpxml $BOND" will got an error with netcf-0.1.9-1, but not other version, which error is:
error: XML error: bond interface misses the bond element
both these two bugs belong to the same series. So please close it if it's a duplicate bug, thanks.

Comment 4 Laine Stump 2011-09-22 12:37:00 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 6 Laine Stump 2011-09-26 19:02:50 UTC
A fix for this bug is available in a new netcf build for RHEL6:

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

Comment 8 Vivian Bian 2011-09-27 03:26:30 UTC
tested with 
libvirt-0.9.4-13.el6.x86_64
netcf-0.1.9-2.el6.x86_64

Steps
[root@dhcp-93-106 ~]# virsh iface-define vlan.xml
Interface eth0.1 defined from vlan.xml

[root@dhcp-93-106 ~]# virsh iface-start eth0.1
Interface eth0.1 started

[root@dhcp-93-106 ~]# virsh iface-dumpxml eth0.1
<interface type='vlan' name='eth0.1'>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::221:9bff:fe57:9f58' prefix='64'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eth0'/>
  </vlan>
</interface>

[root@dhcp-93-106 ~]# virsh iface-destroy eth0.1
Interface eth0.1 destroyed

[root@dhcp-93-106 ~]# virsh iface-dumpxml eth0.1
<interface type='ethernet' name='eth0.1'>
</interface>


According to above steps , set bug status to VERIFIED

Comment 9 errata-xmlrpc 2011-12-06 15:19:23 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.