Bug 1022293 - 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 WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1022292
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-23 02:03 UTC by Hu Jianwei
Modified: 2014-04-04 20:56 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1022292
Environment:
Last Closed: 2014-04-04 20:56:40 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Hu Jianwei 2013-10-23 02:03:55 UTC
The bug also can reproduce on libvirt-0.10.2-29.el6.x86_64.

+++ This bug was initially created as a clone of Bug #1022292 +++

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 2 Xuesong Zhang 2013-11-05 09:06:04 UTC
While set other Qos values as "-1", the value will be convert to "18446744073709551615" in the running guest xml.

Steps:
1. prepare one xml like the following one:
 <interface type='network'>
      <mac address='52:54:00:69:5a:de'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='100' peak='-1' burst='-1'/>
        <outbound average='-1' peak='-1' burst='-1'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. check the original Qos settings of the running guest.
#virsh dumpxml a
......
<interface type='network'>
      <mac address='52:54:00:69:5a:de'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='100' peak='256' burst='128'/>
        <outbound average='100' peak='256' burst='128'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
.......

3. update the Qos value with the xml in step1
# virsh update-device a Qos.xml 
Device updated successfully

4. the value is updated to very large, it's not correct, should be report one error if the setting value is negative number.

# virsh dumpxml a|grep interface -A 10
    <interface type='network'>
      <mac address='52:54:00:69:5a:de'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='100' peak='18446744073709551615' burst='18446744073709551615'/>
        <outbound average='18446744073709551615' peak='18446744073709551615' burst='18446744073709551615'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Comment 4 RHEL Program Management 2014-04-04 20:56:40 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


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