Bug 1017198

Summary: Allow QoS change on the fly using updateDeviceFlags
Product: Red Hat Enterprise Linux 6 Reporter: Chris Pelland <cpelland>
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, jdenemar, jsvarova, mjenner, mprivozn, pm-eus, psebek, tlavigne, xuzhang
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-18.el6_4.15 Doc Type: Bug Fix
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: Environment:
Last Closed: 2013-11-13 10:29:28 UTC Type: ---
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: 1014198    
Bug Blocks: 1019391    

Description Chris Pelland 2013-10-09 12:28:44 UTC
This bug has been copied from bug #1014198 and has been proposed
to be backported to 6.4 z-stream (EUS).

Comment 8 Xuesong Zhang 2013-11-05 08:52:58 UTC
Tested with the latest 6.4.z build libvirt-0.10.2-18.el6_4.15.x86_64, it is verified.

Steps:
Scenario1: update the Qos to the running guest
1. prepare one running guest, and check the interface section of the guest.
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     a                              running
# virsh dumpxml a
......
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
......

2. prepare one xml like the following one:
#cat Qos.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <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>

3. update the device, make sure the Qos can be updated in the flying guest.
# virsh update-device a Qos.xml Device updated successfully

[root@xuzhangtest1 xuzhang]# virsh dumpxml a
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <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>

Scenario2: only update the inbound or outbound to the running guest.
#cat Qos1.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='1000' peak='5000' burst='1024'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

#cat Qos2.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. update to the guest with Qos settings.

# virsh update-device a Qos1.xml 
Device updated successfully

[root@xuzhangtest1 xuzhang]# virsh dumpxml a|grep interface -A 10
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>


# virsh update-device a Qos2.xml 
Device updated successfully

[root@xuzhangtest1 xuzhang]# virsh dumpxml a|grep interface -A 10
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Scenario3: increase and decrease the value of the Qos settings.
1. prepare the following xml.
#cat Qos3.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='199' peak='299' burst='299'/>
        <outbound average='199' peak='299' burst='299'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

#cat Qos4.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='155' peak='255' burst='255'/>
        <outbound average='155' peak='255' burst='255'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. update the value of the Qos
# virsh update-device a Qos3.xml 
Device updated successfully

[root@xuzhangtest1 xuzhang]# virsh dumpxml a
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='199' peak='299' burst='299'/>
        <outbound average='199' peak='299' burst='299'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh update-device a Qos4.xml 
Device updated successfully

[root@xuzhangtest1 xuzhang]# virsh dumpxml a
    <interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='155' peak='255' burst='255'/>
        <outbound average='155' peak='255' burst='255'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Scenario4: negative testing
1. prepare the following xml
#cat Qos5.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='-1' peak='299' burst='299'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

#cat Qos6.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound average='110000000000000000000' peak='299' burst='299'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

#cat Qos7.xml
<interface type='network'>
      <mac address='52:54:00:12:ca:a9'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <bandwidth>
        <inbound peak='255' burst='255'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. set the inbound average value as "-1" and very large.
# virsh update-device a Qos5.xml 
error: Failed to update device from Qos.xml
error: internal error cannot set bandwidth limits on vnet0

# virsh update-device a Qos6.xml 
error: Failed to update device from Qos.xml
error: unsupported configuration: could not convert 110000000000000000000

3. didn't add the average value in the updated xml.
# virsh update-device a Qos7.xml 
error: Failed to update device from Qos.xml
error: Missing mandatory average attribute

Comment 10 errata-xmlrpc 2013-11-13 10:29:28 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-1517.html