RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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
Summary: libvirt will not override a target name with prefix of 'vif' in guest's xml i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-01 11:30 UTC by yalzhang@redhat.com
Modified: 2016-11-03 18:38 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.3.3-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:38:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description yalzhang@redhat.com 2016-03-01 11:30:41 UTC
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 15:54:28 UTC
Fixed upstream by v1.3.2-49-gd5663ef:

commit d5663ef10b2d170af388625a34978921be0590f1
Author:     Jiri Denemark <jdenemar>
AuthorDate: Tue Mar 1 12:47:50 2016 +0100
Commit:     Jiri Denemark <jdenemar>
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>

Comment 3 Mike McCune 2016-03-28 22:45:31 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 5 yalzhang@redhat.com 2016-04-07 06:43:57 UTC
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 18:38:43 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.

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.