Bug 1335798
| Summary: | target dev name will be ignored for network interface when interface type=direct | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yisun |
| Component: | libvirt | Assignee: | Laine Stump <laine> |
| Status: | CLOSED ERRATA | QA Contact: | yalzhang <yalzhang> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 7.3 | CC: | dyuan, rbalakri, xuzhang, yalzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.2.0-4.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-01 17:09: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: | |||
Posted a patch to resolve this upstream: https://www.redhat.com/archives/libvir-list/2017-March/msg01260.html Posted V2 patches upstream: https://www.redhat.com/archives/libvir-list/2017-April/msg01193.html Pushed upstream, will be in libvirt-3.3.0:
commit a05400ef55c7c67c6b211dfa5a33400870d470ca
Author: Laine Stump <laine>
Date: Tue Apr 25 14:09:45 2017 -0400
util: make macvtap/macvlan generated name #defines available to other files
commit 9cb891141c4a5a96243c61518c4e0dbcf6a86c24
Author: Laine Stump <laine>
Date: Sun Mar 26 21:57:54 2017 -0400
conf: don't ignore <target dev='blah'/> for macvtap interfaces
commit 30e672301dd16e0433e23864e21dcc9d0c311e8c
Author: Laine Stump <laine>
Date: Tue Apr 25 14:43:24 2017 -0400
util: rename/move VIR_NET_GENERATED_PREFIX to be consistent
test on libvirt-3.2.0-4.el7.x86_64,
1. when set target dev as "macvtapx" or "vnetx" the target name will be ignored, and default to macvtapn, n is ordered by number
2. set target dev as any string without the prefix "macvtap" or "vnet", the target name will be used
3. set the target dev to null, it will report error
4. set the target dev to the one already exists, will report error
the result is as expected, set this bug to be verified.
1. attach-interface
# virsh attach-interface rhel7 direct enp0s25 --target test
Interface attached successfully
# virsh dumpxml rhel7 | grep /interface -B9
...
<interface type='direct'>
<mac address='52:54:00:73:67:d9'/>
<source dev='enp0s25' mode='vepa'/>
<target dev='test'/>
<model type='rtl8139'/>
<alias name='net1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</interface>
# ip l show | grep test
8: test@enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 500
2. attach-device
# cat macvtap.xml
<interface type='direct' trustGuestRxFilters='no'>
<source dev='enp0s25' mode='bridge'/>
<target dev='tap1'/>
</interface>
# virsh attach-device rhel7 macvtap.xml
Device attached successfully
# virsh dumpxml rhel7 | grep /interface -B9
<interface type='direct' trustGuestRxFilters='no'>
<mac address='52:54:00:28:3d:29'/>
<source dev='enp0s25' mode='bridge'/>
<target dev='tap1'/>
<model type='rtl8139'/>
<alias name='net2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</interface>
3. edit
# virsh edit rhel7
<interface type='direct'>
<mac address='52:54:00:70:aa:44'/>
<source dev='enp0s25' mode='vepa'/>
<model type='rtl8139'/>
<target dev='1234'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
# virsh start rhel7
Domain rhel7 started
# ip l show | grep 1234
17: 1234@enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 500
4. set to macvtap100 or vnet100, it will be ignored
# virsh edit rhel7
<interface type='direct'>
<mac address='52:54:00:70:aa:44'/>
<source dev='enp0s25' mode='vepa'/>
<target dev='macvtap100'/>
<model type='rtl8139'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
# virsh dumpxml rhel7 | grep macvtap100
#
5. set to 'macvlan100' or 'vif100', it will not be ignored
# virsh dumpxml rhel7 | grep /interface -B7
<interface type='direct'>
<mac address='52:54:00:70:aa:44'/>
<source dev='enp0s25' mode='vepa'/>
<target dev='macvlan100'/>
<model type='rtl8139'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
# ip l show | grep macvlan100
19: macvlan100@enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 500
6. set <target dev=''/>, it will report error
# virsh edit rhel7
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
7.
# ip l show | grep sdfd
23: sdfdfffffffff@enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 500
# virsh attach-interface rhel7 direct enp0s25 --target sdfdfffffffff
error: Failed to attach interface
error: Unable to create macvtap device sdfdfffffffff: File exists
file:///usr/share/doc/libvirt-docs-3.2.0/html/formatdomain.html#elementsNICSTargetOverride
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', 'vif', 'macvtap', or 'macvlan', which are prefixes reserved by libvirt and certain hypervisors. Manually specified targets using these prefixes may be ignored.
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/RHEA-2017:1846 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/RHEA-2017:1846 |
description: target dev name will be ignored for network interface when interface type=direct versions: libvirt-1.3.4-1.el7.x86_64 qemu-kvm-rhev-2.6.0-1.el7.x86_64 libvirt-docs-1.3.4-1.el7.x86_64 please note, this may be a doc issue. reproduction: 100% steps: 1. #virsh edit virtlab_test ... <interface type='direct'> <mac address='54:52:00:54:9e:f4'/> <source dev='eno1' mode='bridge'/> <model type='virtio'/> <target dev='test_macvtap0'/> <==== set target name to "test_macvtap0" </interface> ... 2. # virsh start virtlab_test Domain virtlab_test started 3. # virsh dumpxml virtlab_test | grep interface -A6 <interface type='direct'> <mac address='54:52:00:54:9e:f4'/> <source dev='eno1' mode='bridge'/> <target dev='macvtap0'/> <=== target dev name automatically set to macvtap0 <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> 4. # vim /usr/share/doc/libvirt-docs-1.3.4/formatdomain.html ... <a name="elementsNICSTargetOverride" shape="rect" id="elementsNICSTargetOverride">Overriding the target element</a> ... 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 <i>should not start with either 'vnet' or 'vif'</i>, which are prefixes reserved by libvirt and certain hypervisors. Manually specified targets using these prefixes may be ignored. Actual result: target name cannot be manually set, it's ignored by libvirt and automatically set to "macvtap#", and this is not mentioned in libvirt-doc's formatdomain.html Expected result: Target name can be manually set, or explicitly mention the logic in libvirt doc.