Bug 1286890 - interface name can't be changed when define a vlan type interface
interface name can't be changed when define a vlan type interface
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: netcf (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Laine Stump
Jingjing Shao
:
: 1398143 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-30 22:04 EST by Shanzhi Yu
Modified: 2017-12-01 12:04 EST (History)
8 users (show)

See Also:
Fixed In Version: netcf-0.2.8-3.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 17:46:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2220 normal SHIPPED_LIVE netcf bug fix update 2017-08-01 14:42:27 EDT

  None (edit)
Description Shanzhi Yu 2015-11-30 22:04:08 EST
Description of problem:

interface name can't be changed when define a vlan type interface

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

libvirt-1.2.17-13.el7.x86_64
netcf-0.2.8-1.el7.x86_64


How reproducible:

100%

Steps to Reproduce:

1. Define vlan type interface with name "vlan"

# virsh iface-define /dev/stdin <<EOF
<interface type='vlan' name='vlan'>
   <start mode='onboot'/>
   <protocol family='ipv4'>
     <ip address='192.168.132.1' prefix='24'/>
   </protocol>
   <vlan tag='1'>
     <interface name='eth0'/>
   </vlan>
</interface>
EOF


2. Get the defined interface in step 1
# virsh iface-list --inactive
  Name                 State      MAC Address
---------------------------------------------------
  eth0.1               inactive



3. Rename the interface name from "eth0.1" to "test" with "iface-edit"

# virsh iface-edit eth0.1
Interface test XML configuration edited.

4. Get the interface

# virsh iface-list --inactive
  Name                 State      MAC Address
---------------------------------------------------
  eth0.1               inactive




Actual results:


Expected results:

1. current the name is a combination of interface name and vlan tag in
section <vlan></vlan>, so libvirt should post error when try to rename
it with 'iface-edit' if doesn't support rename.

or

2. users can rename the interface whatever he wanna.

Additional info:
Comment 2 Laine Stump 2016-04-18 10:16:29 EDT
This is a limitation of netcf, and isn't easy to change due to both netcf's assumption that the name of the ifcfg file will always be based on the device name, and that netcf doesn't support the ifcfg file parameter for naming a vlan device differently from "$physdev.$vlantag".
Comment 5 Leno Hou 2016-11-23 04:26:21 EST
How about add support the ifcfg file parameter for naming a vlan device differently from "$physdev.$vlantag" ? 

We have a case of:  error: XML error: vlan interface misses the tag attribute

by below steps.

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)ifup and ifdown this vlan1292
#ifup ifcfg-vlan1292
#ifdown ifcfg-vlan1292

3)# 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

4) setup active and dumpxml
# ifup ifcfg-vlan1292 
[root@s38lp53 network-scripts]# 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>
Comment 6 Laine Stump 2017-02-06 10:19:59 EST
Leno kindly made a patch for this which was pushed upstream last December, so we may as well get it into the next release of RHEL.

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

    redhat: support vlan devices named as "vlan${TAG}"
Comment 7 Laine Stump 2017-03-28 10:53:58 EDT
Resolved in this RHEL7.4-candidate build:

https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=546862
Comment 8 Laine Stump 2017-03-28 11:12:12 EDT
*** Bug 1398143 has been marked as a duplicate of this bug. ***
Comment 10 Jingjing Shao 2017-04-07 03:31:33 EDT
Hi Laine,

According to the user guide,
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Naming_Scheme_for_VLAN_Interfaces.html


I did seven test scenarios  and got the issues as below

(1) In the scenario 4 and 5, I got the info "Interface eno1.0001 defined from eno1.0001.xml" and "Interface eth0.1 defined from eth0.1.xml"
but the interface turn to eno1.1 

(2) In the scenario 6, I got the error info "vlan interface misses the tag attribute", if so, we should forbid to define this interface

(3) In the scenario 7, if I edit the name of the interface, it will create another interface instead. Is it expected ?




# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00


(1) # cat vlan1.xml
<interface type='vlan' name='vlan1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-define vlan1.xml
Interface vlan1 defined from vlan1.xml

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00
 vlan1                inactive   

# virsh iface-dumpxml vlan1
<interface type='vlan' name='vlan1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-start vlan1
Interface vlan1 started

# virsh iface-dumpxml vlan1
<interface type='vlan' name='vlan1'>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::4637:e6ff:fe95:3e4' prefix='64'/>
  </protocol>
  <link speed='100' state='up'/>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-destroy vlan1
Interface vlan1 destroyed

# virsh iface-undefine vlan1
Interface vlan1 undefined


(2)# cat vlan0001.xml
<interface type='vlan' name='vlan0001'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='192.168.177.2' prefix='24'/>
</protocol>
<vlan tag='1'>
<interface name='eno1'/>
</vlan>
</interface>

# virsh iface-define vlan0001.xml
Interface vlan0001 defined from vlan0001.xml

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00
 vlan0001             inactive  

# virsh iface-dumpxml vlan0001
<interface type='vlan' name='vlan0001'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.2' prefix='24'/>
  </protocol>
  <vlan tag='0001'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-start vlan0001
Interface vlan0001 started

# virsh iface-dumpxml vlan0001
<interface type='vlan' name='vlan0001'>
  <protocol family='ipv4'>
    <ip address='192.168.177.2' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::4637:e6ff:fe95:3e4' prefix='64'/>
  </protocol>
  <link speed='100' state='up'/>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

(3)# cat  eno1.1.xml
<interface type='vlan' name='eno1.1'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='192.168.177.4' prefix='24'/>
</protocol>
<vlan tag='1'>
<interface name='eno1'/>
</vlan>
</interface>

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 eno1.1               inactive   
 lo                   active     00:00:00:00:00:00

# virsh iface-dumpxml eno1.1
<interface type='vlan' name='eno1.1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.4' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-start eno1.1
Interface eno1.1 started

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 eno1.1               active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00


(4)# cat  eno1.0001.xml
<interface type='vlan' name='eno1.0001'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='192.168.177.3' prefix='24'/>
</protocol>
<vlan tag='1'>
<interface name='eno1'/>
</vlan>
</interface>

# virsh iface-define eno1.0001.xml
Interface eno1.0001 defined from eno1.0001.xml

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 eno1.1               inactive   
 lo                   active     00:00:00:00:00:00

# virsh iface-dumpxml eno1.1
<interface type='vlan' name='eno1.1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.3' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>


(5)# cat eth0.1.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='eno1'/>
</vlan>
</interface>

# virsh iface-define eth0.1.xml
Interface eth0.1 defined from eth0.1.xml

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 eno1.1               inactive   
 lo                   active     00:00:00:00:00:00


# virsh iface-dumpxml eno1.1
<interface type='vlan' name='eno1.1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>


(6)# cat vlan.xml
<interface type='vlan' name='vlan'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='192.168.177.1' prefix='24'/>
</protocol>
<vlan tag='1'>
<interface name='eno1'/>
</vlan>
</interface>

# virsh iface-define vlan.xml
Interface vlan defined from vlan.xml

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00
 vlan                 inactive   

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



(7)# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00
 vlan1                inactive   


# virsh iface-edit vlan1
Interface vlan2 XML configuration edited.  <===edit vlan1 to vlan2


# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     44:37:e6:95:03:e4
 lo                   active     00:00:00:00:00:00
 vlan1                inactive   
 vlan2                inactive  

# virsh iface-dumpxml vlan1
<interface type='vlan' name='vlan1'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <vlan tag='1'>
    <interface name='eno1'/>
  </vlan>
</interface>

# virsh iface-dumpxml vlan2
<interface type='vlan' name='vlan2'>
  <start mode='onboot'/>
  <protocol family='ipv4'>
    <ip address='192.168.177.1' prefix='24'/>
  </protocol>
  <vlan tag='2'>
    <interface name='eno1'/>
  </vlan>
</interface>


# virsh iface-start vlan1
Interface vlan1 started

# virsh iface-start vlan2
Interface vlan2 started
Comment 11 Laine Stump 2017-04-24 11:10:21 EDT
(In reply to Jingjing Shao from comment #10)
> Hi Laine,
> 
> According to the user guide,
> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/
> html/Networking_Guide/sec-Naming_Scheme_for_VLAN_Interfaces.html
> 
> 
> I did seven test scenarios  and got the issues as below
> 
> (1) In the scenario 4 and 5, I got the info "Interface eno1.0001 defined
> from eno1.0001.xml" and "Interface eth0.1 defined from eth0.1.xml"
> but the interface turn to eno1.1 

The vlan tag is stored in the ifcfg file *only* embedded in the interface name, there is no other place for it. Somewhere there is conversion going back and forth, and the leading 0's are truncated. I wouldn't be surprised if there is no way around this, so just define the interfaces without leading 0's on the vlan tag.


> 
> (2) In the scenario 6, I got the error info "vlan interface misses the tag
> attribute", if so, we should forbid to define this interface

You're correct here. The name must include the tag id (which is kind of silly when you look from the point of view of netcf's config, but not from the POV of the ifcfg files), so we should refuse to define any vlan interface whose name doesn't contain its tag. Please open this as a separate BZ though.


> 
> (3) In the scenario 7, if I edit the name of the interface, it will create
> another interface instead. Is it expected ?

Yes.


Also, I noticed a scenario where you tried to define "eth0.1" that was based on the physical device "en0". That can't work.
Comment 12 Jingjing Shao 2017-05-02 08:56:38 EDT
(In reply to Laine Stump from comment #11)
> (In reply to Jingjing Shao from comment #10)
> > Hi Laine,
> > 
> > According to the user guide,
> > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/
> > html/Networking_Guide/sec-Naming_Scheme_for_VLAN_Interfaces.html
> > 
> > 
> > I did seven test scenarios  and got the issues as below
> > 
> > (1) In the scenario 4 and 5, I got the info "Interface eno1.0001 defined
> > from eno1.0001.xml" and "Interface eth0.1 defined from eth0.1.xml"
> > but the interface turn to eno1.1 
> 
> The vlan tag is stored in the ifcfg file *only* embedded in the interface
> name, there is no other place for it. Somewhere there is conversion going
> back and forth, and the leading 0's are truncated. I wouldn't be surprised
> if there is no way around this, so just define the interfaces without
> leading 0's on the vlan tag.
> 
> 
> > 
> > (2) In the scenario 6, I got the error info "vlan interface misses the tag
> > attribute", if so, we should forbid to define this interface
> 
> You're correct here. The name must include the tag id (which is kind of
> silly when you look from the point of view of netcf's config, but not from
> the POV of the ifcfg files), so we should refuse to define any vlan
> interface whose name doesn't contain its tag. Please open this as a separate
> BZ though.

> > 
> > (3) In the scenario 7, if I edit the name of the interface, it will create
> > another interface instead. Is it expected ?
> 
> Yes.
> 
> 
> Also, I noticed a scenario where you tried to define "eth0.1" that was based
> on the physical device "en0". That can't work.



Thanks laine's feedback and add a bug according to the issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1447339

According to the other scenarios, verify this bug
Comment 13 errata-xmlrpc 2017-08-01 17:46:42 EDT
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.

https://access.redhat.com/errata/RHBA-2017:2220
Comment 14 Jingjing Shao 2017-11-01 08:17:12 EDT
Hi laine,

With libvirt-3.8.0-1.el7.x86_64, I found a issue about the name change of vlan interface. The name of vlan interface eno1.1 just can be edited to vlan or test these names ,but can not be changed to eno1.2 or eno1.0005. Is this a bug ?

# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     34:40:b5:b1:09:30
 eno1.1               inactive   

(1)

# virsh iface-edit eno1.1  ===》Change the interface name to eno1.2
Interface eno1.2 XML configuration edited.

# virsh iface-list --all   ===》Can not find the eno1.2
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     34:40:b5:b1:09:30
 eno1.1               inactive   

(2)
# virsh iface-edit eno1.1   ===》Change the interface name to eno1.0005
Interface eno1.0005 XML configuration edited.

# virsh iface-list --all   ===》Can not find the eno1.0005
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     34:40:b5:b1:09:30
 eno1.1               inactive   


(3)
# virsh iface-edit eno1.1   ===》Change the interface name to vlan1
Interface vlan1 XML configuration edited.

# virsh iface-list --all     ===》Can find the vlan1
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     34:40:b5:b1:09:30
 eno1.1               inactive   
 vlan1                inactive
Comment 15 Laine Stump 2017-12-01 12:04:22 EST
Since the scripts that process the ifcfg files store/retrieve the vlan tag to/from the interface's name (in the "DEVICE" attribute of the ifcfg file), the tag given to the interface must match the number at the end of the device name. Your description implies that you changed the device name, but not the vlan tag, which would explain the behavior you saw.

Note that if you modify the device name *and* the tag, this ends up creating a completely new vlan device, and the original vlan device is still in place. That's due to the way that editing of a device works (a new ifcfg file is just written with a name according to the attributes in the XML with the assumption that the name has remained the same; since the API that gets the new XML and writes the new ifcfg file has no way of knowing what the original XML had been, there is no way for it to automatically remove the original.

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