Bug 855571 - dumpxml for a vlan will get error
Summary: dumpxml for a vlan will get error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: netcf
Version: 17
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Laine Stump
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-09 03:08 UTC by Laine Stump
Modified: 2012-10-15 03:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 739505
Environment:
Last Closed: 2012-10-15 03:40:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Laine Stump 2012-09-09 03:08:38 UTC
+++ This bug was initially created as a clone of Bug #739505 +++

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.

--- Additional comment from pm-rhel on 2011-09-19 06:32:47 EDT ---

Since this issue was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from pm-rhel on 2011-09-19 06:41:40 EDT ---

This bugzilla has Keywords: Regression or TestBlocker.

Since no regressions or test blockers are allowed between releases,
it is also being [proposed|marked] as a blocker for this release.

Please resolve ASAP.

--- Additional comment from ydu on 2011-09-19 08:37:17 EDT ---

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.

--- Additional comment from laine on 2011-09-22 08:37:00 EDT ---

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>
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);

--- Additional comment from veillard on 2011-09-26 11:29:37 EDT ---

Giving devel_ack as the patch is upstream and that would be seen as a
regression,

Daniel

--- Additional comment from laine on 2011-09-26 15:02:50 EDT ---

A fix for this bug is available in a new netcf build for RHEL6:

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

--- Additional comment from errata-xmlrpc on 2011-09-26 15:06:04 EDT ---

Bug report changed to ON_QA status by Errata System.
A QE request has been submitted for advisory RHBA-2011:11532-02
http://errata.devel.redhat.com/errata/show/11532

--- Additional comment from vbian on 2011-09-26 23:26:30 EDT ---

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

--- Additional comment from errata-xmlrpc on 2011-12-06 10:19:23 EST ---

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

Comment 1 Fedora Update System 2012-09-09 03:27:29 UTC
netcf-0.2.2-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/netcf-0.2.2-1.fc17

Comment 2 Fedora Update System 2012-09-10 22:23:15 UTC
Package netcf-0.2.2-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing netcf-0.2.2-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-13735/netcf-0.2.2-1.fc17
then log in and leave karma (feedback).


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