Bug 1480251

Summary: unsupported backend-specific options quietly accepted for hostdev/user/direct interfaces
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DEFERRED QA Contact: jiyan <jiyan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: dyuan, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-18 13:34:11 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:

Description yalzhang@redhat.com 2017-08-10 13:40:29 UTC
Description of problem:
Setting network backend-specific options in hostdev/user/direct type interfaces, and hotplug the interface to a guest, it will succeed, but the backend-specific option is not supported in such types

Version-Release number of selected component (if applicable):
libvirt-3.2.0-14.el7_4.2.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.3.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# cat direct.xml 
    <interface type='direct'>
      <source dev='ens1f1' mode='bridge'/>
      <backend tap='/dev/net/tun' vhost='/dev/vhost-net'/>
      <model type='rtl8139'/>
    </interface>

# virsh start rhel7.4
Domain rhel7.4 started

2.
# virsh attach-device rhel7.4 direct.xml
Device attached successfully
# virsh dumpxml rhel7.4 | grep /interface -B8
    <interface type='direct'>
      <mac address='52:54:00:63:d7:98'/>
      <source dev='ens1f1' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='rtl8139'/>
      <backend tap='/dev/net/tun'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

3. but start a guest with "<backend tap='/dev/net/tun'/>" in direct type interface will fail

# virsh dumpxml rhel7.4 | grep /interface -B6
    <interface type='direct'>
      <mac address='52:54:00:63:d7:98'/>
      <source dev='ens1f1' mode='bridge'/>
      <model type='rtl8139'/>
      <backend tap='/dev/net/tun'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh start rhel7.4
error: Failed to start domain rhel7.4
error: unsupported configuration: Custom tap device path is not supported for: direct


Actual results:
The backend element are not supported on these type of interfaces, but hotplug succeed, make an invalid xml. May be a doc fix is ok?

Expected results:
hotplug failed or ignore the setting, or do not use backend settings in these type of interface documented somewhere.

Additional info:
The same with user type interface, hostdev interface

for user type interface, 
$ virsh start rhel7.2
Domain rhel7.2 started

$ cat user.xml 
<interface type='user'>
 <backend tap='/dev/net/tun' vhost='/dev/vhost-net'/>
</interface>

$ virsh attach-device rhel7.2 user.xml 
Device attached successfully

$ virsh dumpxml rhel7.2 | grep /interface -B6
    <interface type='user'>
      <mac address='52:54:00:13:11:f7'/>
      <model type='rtl8139'/>
      <backend tap='/dev/net/tun'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

but a guest with above xml can not start
$ virsh start rhel7.2
error: Failed to start domain rhel7.2
error: unsupported configuration: Custom tap device path is not supported for: user

for hostdev interface:
# cat vf.xml 
  <interface type='hostdev' managed='yes'>
      <source>
 <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      </source>
<backend tap='/dev/net/tun' vhost='/dev/vhost-net'/>
    </interface>
# virsh attach-device rhel vf.xml
Device attached successfully
# virsh dumpxml rhel | grep /interface -B9
    <interface type='hostdev' managed='yes'>
      <mac address='52:54:00:90:dd:07'/>
      <driver name='vfio'/>
      <source>
        <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      </source>
      <backend tap='/dev/net/tun'/>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

start a guest with above xml
# virsh start rhel
error: Failed to start domain rhel
error: unsupported configuration: Custom tap device path is not supported for: hostdev

Comment 2 Laine Stump 2020-02-11 03:02:55 UTC
Another validation bug.

Comment 3 Jaroslav Suchanek 2020-02-18 13:34:11 UTC
This bug was closed deferred as a result of bug triage.

Please reopen if you disagree and provide justification why this bug should
get enough priority. Most important would be information about impact on
customer or layered product. Please indicate requested target release.