We were blindly setting blkiotune values for devices, but kernel can
throw some of them away. This series reworks the logic the same
wayother tuning values are updated. That is, after the value gets
set, it is read back again to make sure internal structures are in
sync and we can return the values from them.
Little example should clear up everything.
Before:
=======
$ virsh blkiotune dummy --device-read-bytes-sec /dev/sda,18446744073709551614
$ virsh blkiotune dummy
weight : 500
device_weight :
device_read_iops_sec:
device_write_iops_sec:
device_read_bytes_sec: /dev/sda,18446744073709551614
device_write_bytes_sec:
$ cat /sys/fs/cgroup/blkio/machine/dummy.libvirt-qemu/blkio.throttle.read_bps_device
8:0 18446744073709551614
$ virsh blkiotune dummy --device-read-bytes-sec /dev/sda,18446744073709551615
$ virsh blkiotune dummy
weight : 500
device_weight :
device_read_iops_sec:
device_write_iops_sec:
device_read_bytes_sec: /dev/sda,18446744073709551615
device_write_bytes_sec:
$ cat /sys/fs/cgroup/blkio/machine/dummy.libvirt-qemu/blkio.throttle.read_bps_device
$
After:
======
$ virsh blkiotune dummy --device-read-bytes-sec /dev/sda,18446744073709551614
$ virsh blkiotune dummy
weight : 500
device_weight :
device_read_iops_sec:
device_write_iops_sec:
device_read_bytes_sec: /dev/sda,18446744073709551614
device_write_bytes_sec:
$ cat /sys/fs/cgroup/blkio/machine/dummy.libvirt-qemu/blkio.throttle.read_bps_device
8:0 18446744073709551614
$ virsh blkiotune dummy --device-read-bytes-sec /dev/sda,18446744073709551615
$ virsh blkiotune dummy
weight : 500
device_weight :
device_read_iops_sec:
device_write_iops_sec:
device_read_bytes_sec:
device_write_bytes_sec:
$ cat /sys/fs/cgroup/blkio/machine/dummy.libvirt-qemu/blkio.throttle.read_bps_device
$
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1165580
Martin Kletzander (5):
util: Add virStringGetFirstWithPrefix
util: Add virCgroupGetBlockDevString
util: Add getters for cgroup block device I/O throttling
lxc: Sync BlkioDevice values when setting them in cgroups
qemu: Sync BlkioDevice values when setting them in cgroups
src/libvirt_private.syms | 6 +
src/lxc/lxc_cgroup.c | 20 ++-
src/lxc/lxc_driver.c | 25 ++-
src/qemu/qemu_cgroup.c | 20 ++-
src/qemu/qemu_driver.c | 25 ++-
src/util/vircgroup.c | 457 +++++++++++++++++++++++++++++++++++------------
src/util/vircgroup.h | 20 +++
src/util/virstring.c | 17 ++
src/util/virstring.h | 2 +
9 files changed, 459 insertions(+), 133 deletions(-)
--
2.5.0