Hide Forgot
Description of problem: Interface of hostdev type support bandwidth setting while it is not effective. Version-Release number of selected component (if applicable): libvirt-1.3.2-1.el7.x86_64 qemu-kvm-rhev-2.3.0-31.el7_2.5.x86_64 How reproducible: 100% Steps to Reproduce: # virsh attach-interface rhel7.2 hostdev 0000:03:10:5 --inbound 1000,2000,1024 --outbound 1000,2000,1024 --persistent --managed --mac aa:bb:cc:dd:aa:11 Interface attached successfully # virsh dumpxml rhel7.2 | grep /interface -B12 ..... <interface type='hostdev' managed='yes'> <mac address='aa:bb:cc:dd:aa:11'/> <driver name='vfio'/> <source> <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x5'/> </source> <bandwidth> <inbound average='1000' peak='2000' burst='1024'/> <outbound average='1000' peak='2000' burst='1024'/> </bandwidth> <alias name='hostdev1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </interface> # virt-xml-validate rhel7.2.xml rhel7.2.xml validates #scp V.qcow2 10.66.7.62:/root/Desktop The authenticity of host '10.66.7.62 (10.66.7.62)' can't be established. ECDSA key fingerprint is b1:69:87:18:a0:4d:9c:cc:54:86:87:5f:e7:a3:6e:41. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.66.7.62' (ECDSA) to the list of known hosts. root@10.66.7.62's password: V.qcow2 100% 1906MB 47.7MB/s 00:40 Actual results: To define bandwidth in interface of hostdev type will succeed.And the bandwidth setting can be stored and validate. Expected results: For type of hostdev, should not support bandwidth definition. Addtional info: The <bandwidth> element allows setting quality of service for a particular network (since 0.9.4). Setting bandwidth for a network is supported ** only for networks with a <forward> mode of route, nat, or no mode at all (i.e. an "isolated" network).** Setting bandwidth is not supported for forward modes of bridge, passthrough, private, or hostdev. Attempts to do this will lead to a failure to define the network or to create a transient network. -----from libvirt.org I have tried to define bandwidth on different interface type, Qos control is ** supported** by type of macvtap(bridge, private, vepa, passthrough), hostdev, bridge mode. Only for hostdev type it is not functional, the other type of interfaces will comply with the Qos restriction. That is, If I copy a file, the rate will be fast at the beginning then gradually fall to a stable rate as I specified in the bandwidth element "average".
There are some SRIOV network cards that support simple QoS settings for VFs (I can't remember which card I saw it on, but it was one that I don't have). So in general this just needs to be added to validation of the config - if it's a hostdev interface and there is a bandwidth setting, then we should flag it as an error. One problem with this is that there may be existing setups in the wild that are putting a <bandwidth> element into every interface, and upgrading libvirt then cause a previously working configuration to fail.
Patch pushed upstream to log error when <bandwidth> element is encountered in a hostdev interface definition: commit 9575cb855403f6aa20ffb0ae8c12179115c4aced Author: Laine Stump <laine@laine.org> Date: Wed Apr 27 12:57:08 2016 -0400 network: log error when <bandwidth> is requested for hostdev interfaces
verified on libvirt-1.3.5-1.el7.x86_64, the result is as expected. 1. hotplug an interface # virsh attach-interface R7.2 hostdev 0000:03:10:5 --inbound 1000,2000,1024 --managed error: Failed to attach interface error: unsupported configuration: bandwidth settings are not supported for hostdev interfaces 2. plug an interface when the guest is offline # virsh attach-interface R7.2 hostdev 0000:03:10:5 --inbound 1000,2000,1024 --managed --persistent Interface attached successfully # virsh start R7.2 error: Failed to start domain R7.2 error: unsupported configuration: bandwidth settings are not supported for hostdev interfaces 3. start or create a guest with bandwidth defined in hostdev interface # virsh define R7.2.xml Domain R7.2 defined from R7.2.xml # virsh start R7.2 error: Failed to start domain R7.2 error: unsupported configuration: bandwidth settings are not supported for hostdev interfaces # virsh create R7.2.xml error: Failed to create domain from R7.2.xml error: unsupported configuration: bandwidth settings are not supported for hostdev interfaces 4.For a libvirt update, when a guest with hostdev interface is running on the old libvirt, and there is bandwidth defined in the interface, after update the libvirt to 1.3.5, the network still works fine in the guest. But after destroy, the guest can not start again with the same error message in step2. move the bug to verified.
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