Bug 1014198

Summary: Allow QoS change on the fly using updateDeviceFlags
Product: Red Hat Enterprise Linux 6 Reporter: psebek
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.5CC: acathrow, cpelland, dallan, danken, dyuan, gsun, honzhang, jiahu, jsvarova, lpeer, mjenner, mprivozn, tlavigne
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-29.el6 Doc Type: Enhancement
Doc Text:
Previously, the virDomainDeviceUpdateFlags() function in libvirt allowed users to update some configuration quirks on a domain device while the domain is still running. Consequently, when updating NIC (Network Interface Controller), the QoS could not be changed because of a missing implementation. With this update, the missing implementation has been added, and QoS can now be updated on a NIC.
Story Points: ---
Clone Of:
: 1014200 (view as bug list) Environment:
Last Closed: 2013-11-21 09:12:13 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: 1002300, 1017195, 1017198    

Description psebek 2013-10-01 14:02:31 UTC
Description of problem:
Using updateDeviceFlags to change nic with set QoS parameters causes "error: this function is not supported by the connection driver: unable to change config on 'bridge' network type"

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. set guest domain with nic, running
2. run update-device with settings containing QoS
# virsh update-device <domain> settings_example.xml
# cat settings_example.xml:
<interface type='bridge'>
    <mac address='00:1a:4a:31:ab:2b'/>
    <source bridge='testnetwork'/>
    <target dev='vnet1'/>
    <model type='virtio'/>
    <filterref filter='vdsm-no-mac-spoofing'/>
    <link state='up'/>
    <bandwidth>
        <inbound average='25600' peak='51200' burst='204800'/>
        <outbound average='12800' peak='25600' burst='10240'/>
    </bandwidth>
    <alias name='net1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

Actual results:
error:this function is not supported by the connection driver: unable to change config on 'bridge' network type

Expected results:
nic is updated properly

Additional info:

Comment 3 Michal Privoznik 2013-10-01 14:46:42 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2013-October/msg00024.html

Comment 7 Dan Kenigsberg 2013-10-08 10:09:49 UTC
Thanks for getting this into rhel-6.5. May we have it in rhel-6.4.z, too, so that ovirt-3.3.1 can enjoy it as well?

Comment 10 Hu Jianwei 2013-10-11 08:44:54 UTC
I can reproduce it with libvirt-0.10.2-28.el6, can not reproduce it with libvirt-0.10.2-29.el6.x86_64.

Verifying steps:
A. Function testing(testing results are same on 'network' and 'bridge' network type.)
1. Check domain status and interface element.
[root@test777 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 7     rhel6                          running

[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A8
    <interface type='network'>
      <mac address='52:54:00:ff:a9:b6'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

2. Add bandwidth to nic.xml
[root@test777 ~]# cat nic.xml 
<interface type='network'>
<mac address='52:54:00:ff:a9:b6'/>
<source network='default'/>
<model type='virtio'/>
<bandwidth>
<inbound average='1000' peak='5000' burst='1024'/>
<outbound average='128' peak='256' burst='256'/>
</bandwidth>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

3. Update interface of domian using update-device cmd.
[root@test777 ~]# virsh update-device rhel6 nic.xml 
Device updated successfully

4. Check the bandwidth part in domain xml.
[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
...
      <model type='virtio'/>
      <bandwidth>
        <inbound average='1000' peak='5000' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

5. Update existing <bandwidth> using update-device
[root@test777 ~]# virsh update-device rhel6 nic.xml 
Device updated successfully

[root@test777 ~]# vim nic.xml 
[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
...
      <model type='virtio'/>
      <bandwidth>
        <inbound average='1000' peak='5000' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
...

[root@test777 ~]# cat nic.xml 
<interface type='network'>
<mac address='52:54:00:ff:a9:b6'/>
<source network='default'/>
<model type='virtio'/>
<bandwidth>
<outbound average='128' peak='256' burst='256'/>
</bandwidth>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
[root@test777 ~]# 

[root@test777 ~]# virsh update-device rhel6 nic.xml 
Device updated successfully

[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
...
      <model type='virtio'/>
      <bandwidth>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...
[root@test777 ~]#

B. Negative testing
1. [root@test777 ~]# cat nic.xml 
<interface type='network'>
<mac address='52:54:00:ff:a9:b6'/>
<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@test777 ~]# virsh update-device rhel6 nic.xml 
error: Failed to update device from nic.xml
error: internal error cannot set bandwidth limits on vnet0

[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:ff:a9:b6'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

2. huge values:
[root@test777 ~]# vim nic.xml 
[root@test777 ~]# virsh update-device rhel6 nic.xml 
error: Failed to update device from nic.xml
error: unsupported configuration: could not convert 100000000000000000000

[root@test777 ~]# vim nic.xml 
[root@test777 ~]# virsh update-device rhel6 nic.xml 
error: Failed to update device from nic.xml
error: internal error cannot set bandwidth limits on vnet0

3. remove mandatory attribute average
[root@test777 ~]# cat nic.xml 
<interface type='network'>
<mac address='52:54:00:ff:a9:b6'/>
<source network='default'/>
<model type='virtio'/>
<bandwidth>
<inbound  peak='5000' burst='1024'/>
<outbound average='128' peak='256' burst='256'/>
</bandwidth>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
[root@test777 ~]# virsh update-device rhel6 nic.xml 
error: Failed to update device from nic.xml
error: Missing mandatory average attribute


During testing, I found libvirt ignore invalid <bandwidth> elements but report successfully. I think libvirt should have a precision response.
1. Add invalid element in <bandwidth> in nic.xml
[root@test777 ~]# cat nic.xml 
<interface type='network'>
<mac address='52:54:00:ff:a9:b6'/>
<source network='default'/>
<model type='virtio'/>
<bandwidth>
<inbdsdfsound average='1000' peak='5000' burst='1024'/>   <====== wrong element name.
</bandwidth>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

2. Add it to domain using update-device
[root@test777 ~]# virsh update-device rhel6 nic.xml 
Device updated successfully

3.Check the <bandwidth> field. The wrong rule did not add to domain xml, just added an empty <bandwidth>.
[root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:ff:a9:b6'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <bandwidth>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
... 
[root@test777 ~]#

Comment 11 Michal Privoznik 2013-10-11 10:30:51 UTC
(In reply to Hu Jianwei from comment #10)
> [...]
> During testing, I found libvirt ignore invalid <bandwidth> elements but
> report successfully. I think libvirt should have a precision response.
> 1. Add invalid element in <bandwidth> in nic.xml
> [root@test777 ~]# cat nic.xml 
> <interface type='network'>
> <mac address='52:54:00:ff:a9:b6'/>
> <source network='default'/>
> <model type='virtio'/>
> <bandwidth>
> <inbdsdfsound average='1000' peak='5000' burst='1024'/>   <====== wrong
> element name.
> </bandwidth>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
> </interface>
> 
> 2. Add it to domain using update-device
> [root@test777 ~]# virsh update-device rhel6 nic.xml 
> Device updated successfully
> 
> 3.Check the <bandwidth> field. The wrong rule did not add to domain xml,
> just added an empty <bandwidth>.
> [root@test777 ~]# virsh dumpxml rhel6 | grep interface -A10
>     <interface type='network'>
>       <mac address='52:54:00:ff:a9:b6'/>
>       <source network='default'/>
>       <target dev='vnet0'/>
>       <model type='virtio'/>
>       <bandwidth>
>       </bandwidth>
>       <alias name='net0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
> function='0x0'/>
>     </interface>
> ... 
> [root@test777 ~]#

I don't think this is a bug. Libvirt deliberately takes from XML only those elements which it can handle. This is there to provide forward compatibility - a newer libvirt can generate XML for older libvirt.

Although, you've experienced one 'bug' - see the empty <bandwidth/>. I am not sure if it's worth respawning a new package though.

Comment 12 Hu Jianwei 2013-10-12 01:32:18 UTC
According to comment 10 and 11, changed to verified.

Comment 14 errata-xmlrpc 2013-11-21 09:12:13 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.

http://rhn.redhat.com/errata/RHBA-2013-1581.html