Bug 1313314 - libvirt will not override a target name with prefix of 'vif' in guest's xml interface part, which do not conform to the description in libvirt.org
libvirt will not override a target name with prefix of 'vif' in guest's xml i...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-01 06:30 EST by yalzhang@redhat.com
Modified: 2016-11-03 14:38 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-1.3.3-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:38:43 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)

  None (edit)
Description yalzhang@redhat.com 2016-03-01 06:30:41 EST
Description of problem:
When specify a target name 'vif*' in the guest's xml file interface part, the target name 'vif*' will not be ignored and override, while in libvirt.org, it is said "This name can be manually specified, however the name must not start with either 'vnet' or 'vif', which are prefixes reserved by libvirt and certain hypervisors. Manually specified targets using these prefixes will be ignored. "
Refer to http://libvirt.org/formatdomain.html#elementsNICSTargetOverride

Version-Release number of selected component (if applicable):
libvirt-1.3.1-1.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7_2.5.x86_64

How reproducible:
100%

Steps to Reproduce:
1.check current network interface on the host:

# ifconfig -a -s
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0      1500  1715989      0      0 0       9242368      0      0      0 BMRU
lo       65536   834941      0      0 0        834941      0      0      0 LRU
virbr0    1500    40501      0      0 0         41426      0      0      0 BMU
virbr0-n  1500        0      0      0 0             0      0      0      0 BM

2.Specify a xml file with below 2 interfaces with target name is 'vnet99' or 'vif88', then define and start the guest.
  
#cat rhel7.2.xml
....
 <interface type='network'>
      <mac address='52:54:00:1b:6f:e5'/>
      <source network='default'/>
      <model type='virtio'/>
<target dev='vnet99'/>
    </interface>
 <interface type='network'>
      <mac address='52:54:00:1b:6f:10'/>
      <source network='default'/>
      <model type='virtio'/>
<target dev='vif88'/>
    </interface>
....
# virsh define rhel7.2.xml
Domain rhel7.2 defined from rhel7.2.xml
# virsh start rhel7.2
Domain rhel7.2 started

3. check the name on host and in running guest's xml.
on host,
# ifconfig -a -s
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0      1500  1717314      0      0 0       9242806      0      0      0 BMRU
lo       65536   835073      0      0 0        835073      0      0      0 LRU
vif88     1500        0      0      0 0            71      0      0      0 BMRU
virbr0    1500    40568      0      0 0         41452      0      0      0 BMRU
virbr0-n  1500        0      0      0 0             0      0      0      0 BM
vnet0     1500       67      0      0 0            69      0      0      0 BMRU
# virsh dumpxml rhel7.2 | grep /interface -B8
    </controller>
    <interface type='network'>
      <mac address='52:54:00:1b:6f:e5'/>
      <source network='default' bridge='virbr0'/>
    **  <target dev='vnet0'/> **
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:1b:6f:10'/>
      <source network='default' bridge='virbr0'/>
    **  <target dev='vif88'/>  **
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </interface>

From the output, We find that the target name 'vnet*' will be ignored and generated automatically by libvirt. But the target name 'vif*' will not be overide.

4. Further test follow step3:
# virsh attach-interface rhel7.2 network default --target vnet10
 Interface attached successfully
# virsh attach-interface rhel7.2 network default --target vnet10
 Interface attached successfully
# virsh attach-interface rhel7.2 network default --target vif2
 Interface attached successfully
# virsh attach-interface rhel7.2 network default --target vif2
 error: Failed to attach interface 
 error: Unable to create tap device vif2: Device or resource busy
# ifconfig -a -s
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0      1500  1718605      0      0 0       9243163      0      0      0 BMRU
lo       65536   835187      0      0 0        835187      0      0      0 LRU
vif2      1500        0      0      0 0            14      0      0      0 BMRU
vif88     1500        0      0      0 0           274      0      0      0 BMRU
virbr0    1500    40590      0      0 0         41470      0      0      0 BMRU
virbr0-n  1500        0      0      0 0             0      0      0      0 BM
vnet0     1500       89      0      0 0           289      0      0      0 BMRU
vnet1     1500        0      0      0 0            25      0      0      0 BMRU
vnet2     1500        0      0      0 0            24      0      0      0 BMRU

We can see if the target name begins with vnet, it will be ignored and override as vnet[0,1,2,3,4,5,6,7...] by order. In fact, if we use "virsh edit" to modify the target dev to 'vnet*', it will ignored directly and not even be saved. But when we modify the 'target dev' with 'vif*' or other name, it will be saved and take effect. 

Actual results:
The libvirt.org said that target name with prefix of 'vif' and 'vnet' will be ignored, but in fact, only 'vnet*' will be ignored.

Expected results:
The performance and description in libvirt.org should be consistent.
The description in 
http://libvirt.org/formatdomain.html#elementsNICSTargetOverride
should be modified, only target name with prefix of 'vnet' will be ignored.
Or libvirt should keep 'vif' as reserved as well as 'vnet'.

Additional info:
N/A
Comment 2 Jiri Denemark 2016-03-01 10:54:28 EST
Fixed upstream by v1.3.2-49-gd5663ef:

commit d5663ef10b2d170af388625a34978921be0590f1
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Tue Mar 1 12:47:50 2016 +0100
Commit:     Jiri Denemark <jdenemar@redhat.com>
CommitDate: Tue Mar 1 15:59:00 2016 +0100

    docs: Clarify interface/target/@dev docs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1313314
    
    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Comment 3 Mike McCune 2016-03-28 18:45:31 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 5 yalzhang@redhat.com 2016-04-07 02:43:57 EDT
Checked the documents both on upstream libvirt.org and downstream file:///usr/share/doc/libvirt-docs-1.3.3/html/formatdomain.html#elementsNICSTargetOverride, the description change from "must" to "should",from "will" to "may". Change this bug to verified.

If no target is specified, certain hypervisors will automatically generate a name for the created tun device. This name can be manually specified, however the name **should** not start with either 'vnet' or 'vif', which are prefixes reserved by libvirt and certain hypervisors. Manually specified targets using these prefixes **may** be ignored.
Comment 7 errata-xmlrpc 2016-11-03 14:38:43 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://rhn.redhat.com/errata/RHSA-2016-2577.html

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