Bug 1165580

Summary: blkiotune value should be consistent with value in cgroup
Product: Red Hat Enterprise Linux 7 Reporter: Pei Zhang <pzhang>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, mkletzan, mzhan, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.17-7.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:56:25 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:

Description Pei Zhang 2014-11-19 09:28:47 UTC
Description of problem:
a maximum value can be set by blkiotune , but can not be checked in cgroup.

Version-Release number of selected component (if applicable):
kernel-3.10.0-203.el7.x86_64
qemu-kvm-rhev-2.1.2-8.el7.x86_64
libvirt-1.2.8-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# virsh list 
 Id    Name                           State
----------------------------------------------------
 29    r7                             running

1> for device_read/write_iops_sec , set value=4294967295 , set successfully. but can not be checked in cgroup.

1.1> set the value and check using blkiotune command

# virsh blkiotune r7 --device-read-iops-sec /dev/sda,4294967295 --device-write-iops-sec /dev/sda,4294967295

[root@184 ~]# virsh blkiotune r7
weight         : 500
device_weight  : 
device_read_iops_sec: /dev/sda,4294967295
device_write_iops_sec: /dev/sda,4294967295
device_read_bytes_sec: 
device_write_bytes_sec: 

1.2> check the value in the cgroup , it has nothing
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr7.scope/blkio.throttle.read_iops_device 

# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr7.scope/blkio.throttle.write_iops_device 

2> for device_read/write_bytes_sec , set value= 18446744073709551615, set successfully. but can not be checked in cgroup.

2.1> set the value and check using blkiotune command

# virsh blkiotune r7 --device-read-bytes-sec /dev/sda,18446744073709551615 --device-write-bytes-sec /dev/sda,18446744073709551615 

# virsh blkiotune r7
weight         : 500
device_weight  : 
device_read_iops_sec: /dev/sda,4294967295
device_write_iops_sec: /dev/sda,4294967295
device_read_bytes_sec: /dev/sda,18446744073709551615
device_write_bytes_sec: /dev/sda,18446744073709551615

2.2> check the value in cgroup , it has nothing
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr7.scope/blkio.throttle.read_bps_device 
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr7.scope/blkio.throttle.write_bps_device 
 
3>check domain XML , it has the value .
# virsh dumpxml r7 | grep blkiotune -A 8
  <blkiotune>
    <device>
      <path>/dev/sda</path>
      <read_iops_sec>4294967295</read_iops_sec>
      <write_iops_sec>4294967295</write_iops_sec>
      <read_bytes_sec>18446744073709551615</read_bytes_sec>
      <write_bytes_sec>18446744073709551615</write_bytes_sec>
    </device>
  </blkiotune>


Actual results:
As above , the value can be set by blkiotune and set successfully in the domain XML , but it has nothing in cgroup.

Expected results:
the value set by blkiotune can be checked in cgroup.

Additional info:

Comment 1 Martin Kletzander 2015-08-03 14:57:05 UTC
Patch proposed upstream:

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

Comment 4 Pei Zhang 2015-09-11 09:25:22 UTC
Verified version:
libvirt-1.2.17-8.el7.x86_64
qemu-kvm-rhev-2.3.0-22.el7.x86_64

verified steps:

1.define and start a guest, check blkiotune value.
# virsh blkiotune r72
weight         : 1000
device_weight  : 
device_read_iops_sec: 
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec: 

1.1. set a iops value that kernel accepts, but does not set them.

set the value 
# virsh blkiotune r72 --device-read-iops-sec /dev/sdb,4294967295

get the value via blkiotune 
# virsh blkiotune r72
weight         : 1000
device_weight  : 
device_read_iops_sec: 
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec: 

check in cgroup, Nothing ouput 
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr72.scope/blkio.throttle.read_iops_device 

check domian xml, Nothing output.
# virsh dumpxml r72 | grep blkiotune -A 3


1.2 set a normal value that kernel accpets and will set them in cgroup.

# virsh blkiotune r72 --device-read-iops-sec /dev/sdb,4294967294

check in cgroup
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr72.scope/blkio.throttle.read_iops_device 
8:16 4294967294

check via blkiotune 

# virsh blkiotune r72
weight         : 1000
device_weight  : 
device_read_iops_sec: /dev/sdb,4294967294
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec: 

check in domian xml :
# virsh dumpxml r72 | grep blkiotune -A 3
  <blkiotune>
    <device>
      <path>/dev/sdb</path>
      <read_iops_sec>4294967294</read_iops_sec>
--
  </blkiotune>

2. set a bps value that kernel accepts, but does not set them.

# virsh blkiotune r72 --device-write-bytes-sec /dev/sdb,18446744073709551615

get the value via blkiotune 

# virsh blkiotune r72
weight         : 1000
device_weight  : 
device_read_iops_sec: 
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec: 

check in cgroup, Nothing ouput 
# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr72.scope/blkio.throttle.write_bps_device 

check domian xml, Nothing output.
# virsh dumpxml r72 | grep blkiotune -A 3


2.1 set a normal value that kernel accpets and will set them in cgroup.

# virsh blkiotune r72 --device-write-bytes-sec /dev/sdb,18446744073709551614

check in cgroup 

# cat /sys/fs/cgroup/blkio/machine.slice/machine-qemu\\x2dr72.scope/blkio.throttle.write_bps_device 
8:16 18446744073709551614

check via blkiotune 

# virsh blkiotune r72
weight         : 1000
device_weight  : 
device_read_iops_sec: 
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec: /dev/sdb,18446744073709551614

check in domain xml 
# virsh dumpxml r72 | grep blkiotune -A 5
  <blkiotune>
    <device>
      <path>/dev/sdb</path>
      <write_bytes_sec>18446744073709551614</write_bytes_sec>
    </device>
  </blkiotune>

Also tested with lxc using same steps as above.

Now the values set via blkiotune are in sync with cgroup. 

Move to verified.

Comment 6 errata-xmlrpc 2015-11-19 05:56:25 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