Bug 770830

Summary: --config doesn't work correctly for blkiotune option --device-weight
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: libvirtAssignee: Gunannan Ren <gren>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, ajia, bili, dallan, dyuan, mzhan, rwu, veillard, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.13-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:07:06 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:

Description weizhang 2011-12-29 11:44:58 UTC
Description of problem:
When do
# virsh blkiotune test --device-weights /dev/sda,400 --config
for a running domain, it seems that it can not effect after reboot. 

When you check with 
# virsh blkiotune test
weight         : 900
device_weight  : /dev/sda,400

It seems that it effect the running domain, but in fact it does not
# cat /cgroup/blkio/libvirt/qemu/test/blkio.weight_device
nothing here

Reboot the guest and check, the device_weight does not set 
# virsh blkiotune test
weight         : 900
device_weight  : 

Version-Release number of selected component (if applicable):
kernel-2.6.32-223.el6.x86_64
libvirt-0.9.8-1.el6.x86_64
qemu-kvm-0.12.1.2-2.213.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a guest and check
# virsh blkiotune test 
weight         : 900
device_weight  : 

2. Set block device weight with --config
# virsh blkiotune test --device-weights /dev/sda,400 --config

3. check
# virsh blkiotune test 
weight         : 900
device_weight  : /dev/sda,400

4. check cgroup
# cat /cgroup/blkio/libvirt/qemu/test/blkio.weight_device
nothing return

5. reboot guest and check
# virsh blkiotune test 
weight         : 900
device_weight  : 

# cat /cgroup/blkio/libvirt/qemu/test/blkio.weight_device
nothing return
  
Actual results:
as above 

Expected results:
For step3, should not list device_weight
For step5, should change the device_weight

Additional info:

Comment 2 Gunannan Ren 2012-02-02 12:34:03 UTC
patch sent to upstream
https://www.redhat.com/archives/libvir-list/2012-February/msg00104.html

Comment 3 Gunannan Ren 2012-02-10 06:55:19 UTC
commit c8c239a439dca7600cd52066966c1c59a838e167
Author: Eric Blake <eblake>
Date:   Tue Feb 7 17:38:41 2012 -0700

    qemu: fix persistent setting of blkiodevice weights
    
    virsh blkiotune dom --device-weights /dev/sda,400 --config
    
    wasn't working correctly.
    
    * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Use
    correct definition.

Comment 4 EricLee 2012-03-26 10:46:31 UTC
When I use versions of:
kernel-2.6.32-251.el6.x86_64
qemu-kvm-0.12.1.2-2.248.el6.x86_64
libvirt-0.9.10-6.el6.x86_64

#virsh blkiotune test --device-weights /dev/sda,400 --config
has no effect.

# virsh blkiotune qcow2_fo
weight         : 500
device_weight  : 

# virsh blkiotune qcow2_fo  --device-weights /dev/sda,400 --config

# virsh blkiotune qcow2_fo
weight         : 500
device_weight  :

Comment 5 EricLee 2012-03-26 11:13:40 UTC
Sorry, I got the wrong understanding.

1.# virsh blkiotune mig32
weight         : 500
device_weight  : 

2.# virsh blkiotune mig32 --device-weights /dev/sda,400 --config

3.# virsh blkiotune mig32
weight         : 500
device_weight  : 
4.# virsh destroy mig32
Domain mig32 destroyed

5.# virsh start mig32
Domain mig32 started

6.# virsh blkiotune mig32
weight         : 500
device_weight  : /dev/sda,400

7.# virsh blkiotune mig32 --device-weights /dev/sda,800 --config

8.# virsh blkiotune mig32
weight         : 500
device_weight  : /dev/sda,400

9.# virsh destroy mig32
Domain mig32 destroyed

10.# virsh start mig32
Domain mig32 started

11.# virsh blkiotune mig32
weight         : 500
device_weight  : /dev/sda,800

It's the expected result, So the bug has been fixed?

Comment 8 EricLee 2012-08-13 10:13:38 UTC
Verified this bug with libvirt-0.10.0-0rc0.el6.x86_64:

# virsh start qcow2
Domain qcow2 started

# virsh blkiotune qcow2
weight         : 500
device_weight  : 

# virsh blkiotune qcow2 --device-weights /dev/sda,400 --config

# virsh blkiotune qcow2
weight         : 500
device_weight  : 

As expected.

Reboot guest
# virsh destroy qcow2
Domain qcow2 destroyed

# virsh start qcow2
Domain qcow2 started

And recheck blkiotune:
# virsh blkiotune qcow2
weight         : 500
device_weight  : /dev/sda,400

As expected.

Also check weight_device in cgroup:
# cat /cgroup/blkio/libvirt/qemu/qcow2/blkio.weight_device
8:0	400

reconfig it:
# virsh blkiotune qcow2 --device-weights /dev/sda,600 --config

# cat /cgroup/blkio/libvirt/qemu/qcow2/blkio.weight_device
8:0	400
As expected.

# virsh blkiotune qcow2
weight         : 500
device_weight  : /dev/sda,400

Restart guest:
# virsh destroy qcow2
Domain qcow2 destroyed

# virsh start qcow2
Domain qcow2 started

Check blkiotune and weight_device in cgroup:
# virsh blkiotune qcow2
weight         : 500
device_weight  : /dev/sda,600

# cat /cgroup/blkio/libvirt/qemu/qcow2/blkio.weight_device
8:0	600
As expected.

So moving to VERIFIED.

Comment 9 errata-xmlrpc 2013-02-21 07:07:06 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/RHSA-2013-0276.html