Bug 1022292
| Summary: | libvirt should check the value range of average element in <outbound> before updating interface device | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Hu Jianwei <jiahu> | |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | medium | |||
| Version: | 7.0 | CC: | dyuan, honzhang, mprivozn, mzhan, rbalakri | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | x86_64 | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | libvirt-1.2.17-5.el7 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1022293 (view as bug list) | Environment: | ||
| Last Closed: | 2015-11-19 05:44:18 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: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1022293 | |||
| BTW I think this bug is not limited to <outbound> only. Any xml knob that takes an integer is affected. Patch has been proposed upstream: https://www.redhat.com/archives/libvir-list/2015-August/msg00232.html Moving to POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2015-August/msg00269.html Verify it as follows. The result is expected. Move its status to VERIFIED.
1.Test every value of QoS attribute using the negative value. 
# virsh edit r7.1
    <interface type='network'>
      <mac address='52:54:00:5a:ab:c5'/>
      <source network='default'/>
      <bandwidth>
        <inbound average='-1000' peak='5000' floor='200' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
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
Failed. Try again? [y,n,i,f,?]: 
2.
# cat nic.xml 
<interface type='network'>
      <mac address='52:54:00:5a:ab:c5'/>
      <source network='default'/>
      <bandwidth>
        <inbound average='1000' peak='5000' floor='-200' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
# virsh list
 Id    Name                           State
----------------------------------------------------
 5     r7.1                           running
# virsh update-device r7.1 nic.xml 
error: Failed to update device from nic.xml
error: unsupported configuration: could not convert bandwidth floor value '-200'
3. 
# cat r7.1-n.xml|grep /interface -B11
    <interface type='network'>
      <mac address='52:54:00:5a:ab:c5'/>
      <source network='default' bridge='virbr0'/>
      <bandwidth>
        <inbound average='-1000' peak='5000' floor='200' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
# virsh define r7.1-n.xml
error: Failed to define domain from r7.1-n.xml
error: unsupported configuration: could not convert bandwidth average value '-1000'
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/RHBA-2015-2202.html | 
Description of problem: During testing, libvirt should check the value range of average element in <outbound> before updating device, also the values of average element in <outbound> should be consistent with <inbound>, libvirt had better report "error: internal error: cannot set bandwidth limits on vnet0". Version-Release number of selected component (if applicable): libvirt-1.1.1-9.el7.x86_64 qemu-kvm-rhev-1.5.3-9.el7.x86_64 kernel-3.10.0-34.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. [root@localhost ~]# cat nic.xml <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <model type='virtio'/> <bandwidth> <outbound average='-1' peak='5000' burst='1024'/> <===set negative for <outbound>, same value in <inbound> will be failed. </bandwidth> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> [root@localhost ~]# virsh update-device r6 nic.xml Device updated successfully [root@localhost ~]# virsh dumpxml r6 | grep interface -A10 <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <target dev='vnet0'/> <model type='virtio'/> <bandwidth> <outbound average='18446744073709551615' peak='5000' burst='1024'/> <======libvirt will convert the negative to positive number. </bandwidth> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> ... 2. [root@localhost ~]# cat nic.xml <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <model type='virtio'/> <bandwidth> <outbound average='10000000000000000' peak='5000' burst='1024'/> <===========set a huge value for average of <outbound>, same value in <inbound> will be failed. </bandwidth> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> [root@localhost ~]# virsh update-device r6 nic.xml Device updated successfully [root@localhost ~]# virsh dumpxml r6 | grep interface -A10 <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <target dev='vnet0'/> <model type='virtio'/> <bandwidth> <outbound average='10000000000000000' peak='5000' burst='1024'/> </bandwidth> ... Actual results: As above steps. Expected results: Same behavior with <inbound> element, see below [other info]. Other info: 1. Negative value [root@localhost ~]# cat nic.xml <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <model type='virtio'/> <bandwidth> <inbound average='-1' peak='5000' burst='1024'/> </bandwidth> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> [root@localhost ~]# virsh update-device r6 nic.xml error: Failed to update device from nic.xml error: internal error: cannot set bandwidth limits on vnet0 2.huge value [root@localhost ~]# cat nic.xml <interface type='network'> <mac address='52:54:00:90:06:7a'/> <source network='default'/> <model type='virtio'/> <bandwidth> <inbound average='10000000000000000' peak='5000' burst='1024'/> </bandwidth> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> [root@localhost ~]# virsh update-device r6 nic.xml error: Failed to update device from nic.xml error: internal error: cannot set bandwidth limits on vnet0