Bug 1398143

Summary: netcf: ncftool dumpxml vlan1292 leads libvirt throw error
Product: Red Hat Enterprise Linux 7 Reporter: Leno Hou <lenohou>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED DUPLICATE QA Contact: Jingjing Shao <jishao>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dyuan, houqy, jishao, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-28 15:12:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
This is patch for this bug none

Description Leno Hou 2016-11-24 08:12:09 UTC
Description of problem:


Version-Release number of selected component (if applicable):
netcf-0.2.8-1.el7_2


How reproducible:


Steps to Reproduce:

1) Define the vlan interface with ifcfg-vlan1292

VLAN=yes
VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD
DEVICE=vlan1292
PHYSDEV=en5sp0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.254.5.254
NETMASK=255.255.255.0
TYPE=Ethernet
NM_CONTROLLED=no


2) setup active and dumpxml
# ifup ifcfg-vlan1292 
# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 en5sp0               active     02:38:53:00:76:00
 lo                   active     00:00:00:00:00:00
 vlan1292             active     02:38:53:00:76:00

# virsh iface-dumpxml vlan1292
<interface type='vlan' name='vlan1292'>
  <protocol family='ipv4'>
    <ip address='10.254.5.254' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::38:53ff:fe00:7600' prefix='64'/>
  </protocol>
  <link speed='1000' state='up'/>
  <vlan tag='1292'>
    <interface name='en5sp0'/>
  </vlan>
</interface>

3) setup active and dumpxml
# ifdown ifcfg-vlan1292
# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 en5sp0               active     02:38:53:00:76:00
 lo                   active     00:00:00:00:00:00
 vlan1292             inactive   

# virsh iface-dumpxml vlan1292
error: XML error: vlan interface misses the tag attribute
#

Actual results:

[root@s38lp53 SOURCES]# ncftool dumpxml vlan1292
<?xml version="1.0"?>
<interface type="vlan" name="vlan1292">
  <start mode="onboot"/>
  <protocol family="ipv4">
    <ip address="10.254.5.254" prefix="24"/>
  </protocol>
  <vlan tag="">
    <interface name=""/>
  </vlan>
</interface>

Expected results:
[root@s38lp53 SOURCES]# ncftool dumpxml vlan1292
<?xml version="1.0"?>
<interface type="vlan" name="vlan1292">
  <start mode="onboot"/>
  <protocol family="ipv4">
    <ip address="10.254.5.254" prefix="24"/>
  </protocol>
  <vlan tag="1292">
    <interface name="en5sp0"/>
  </vlan>
</interface>

Additional info:

Comment 1 Leno Hou 2016-11-24 10:45:58 UTC
If we don't support this functionality, I think we should change the User Guide as shown below directly

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Naming_Scheme_for_VLAN_Interfaces.html

If we want to support this functionality, just modify the code in netcf/data/xml/redhat-put.xsl between line 57-64 as shown below:

  <xsl:template name="vlan-device">
    <xsl:variable name="name" select="node[@label = 'DEVICE']/@value"/>
    <xsl:variable name="device" select="substring-before($name, '.')"/>
    <xsl:variable name="tag" select="substring-after($name, '.')"/>
    <vlan tag="{$tag}">
      <interface name="{$device}"/>
    </vlan>
  </xsl:template>

Comment 3 Leno Hou 2016-11-28 03:25:39 UTC
Created attachment 1225096 [details]
This is patch for this bug

Hi all,

Could anyone help me to review this patch? Thanks.

Comment 4 Leno Hou 2016-12-13 09:21:32 UTC
Hi Laine,

I've pushed the patch that fixed this issue including testcase in the netcf mail list. Could you help to me merge it into upstream? Thanks

commit d59c5aa7e6d40a7b4ec6116b30784e06b53ef231
Author: Leno Hou <lenohou>
Date:   Sat Nov 26 01:24:07 2016 +0800

    vlan: fix vlan interface misses tag attribute when inactive
    
    This patch fixes the problem as shown below.
    * virsh dumpxml failed with vlan1292 in inactive status
    * virt-manager failed to view vlan1292 interface details.
    RedHat Bugzilla:#1398143

Comment 5 Laine Stump 2016-12-13 16:31:42 UTC
yes, it's been at the top of my list all week, but other things keep distracting me.

Comment 6 Laine Stump 2016-12-15 19:48:12 UTC
Leno's patch has been pushed upstream:

commit 0f6596c3e2f914fd36a771421151f409924f65e2
Author: Leno Hou <lenohou>
Date:   Thu Dec 8 21:04:15 2016 +0800

    redhat: support vlan devices named as "vlan${TAG}"
    


Sometime between now and RHEL7.4 I will either backport that patch to the current RHEL7 netcf package, or I will rebase netcf for RHEL7.

Comment 7 Leno Hou 2016-12-16 03:05:04 UTC
Thanks Laine! ;-)

Comment 8 Laine Stump 2017-03-28 15:12:12 UTC
I hadn't noticed that this is the same as Bug 1286890, and that one has already been moved to MODIFIED.

*** This bug has been marked as a duplicate of bug 1286890 ***