Bug 1022292 - libvirt should check the value range of average element in <outbound> before updating interface device
Summary: libvirt should check the value range of average element in <outbound> before ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1022293
TreeView+ depends on / blocked
 
Reported: 2013-10-23 01:48 UTC by Hu Jianwei
Modified: 2016-04-26 14:52 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.17-5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1022293 (view as bug list)
Environment:
Last Closed: 2015-11-19 05:44:18 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Hu Jianwei 2013-10-23 01:48:34 UTC
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

Comment 3 Michal Privoznik 2013-11-28 11:12:25 UTC
BTW I think this bug is not limited to <outbound> only. Any xml knob that takes an integer is affected.

Comment 8 Michal Privoznik 2015-08-07 15:31:58 UTC
Patch has been proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-August/msg00232.html

Comment 11 hongming 2015-09-02 06:42:42 UTC
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'

Comment 13 errata-xmlrpc 2015-11-19 05:44:18 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/RHBA-2015-2202.html


Note You need to log in before you can comment on or make changes to this bug.