Today libvirt supports the cgroups blkio-controller, which handles
proportional shares and throughput/iops limits on host block devices.
blkio-controller does not support network file systems (NFS) or other
QEMU remote block drivers (curl, Ceph/rbd, sheepdog) since they are
not host block devices. QEMU I/O throttling works with all types of
drive and can be applied independently to each drive attached to
a guest and supports throughput/iops limits.
To help add QEMU I/O throttling support to libvirt, we plan to complete
it with add new API virDomainBlockIoThrottle(), new command 'blkiothrottle'
and Python bindings.
Notes: we are sending this series out now(even though they are not completed
yet.)because we want to start the review process. These patches implemented
the below features by Zhi Yong Wu:
1) Enable the blkio throttling in xml when guest is starting up.
Add blkio throttling in xml as follows:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/kvm-one.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
<iothrottle bps='100000' bps_rd='20000'.../>
</disk>
2) Enable blkio throttling setting at guest running time.
virsh blkiothrottle<domain> <device> [--bps<number>]
[--bps_rd<number>] \
[--bps_wr<number>] [--iops<number>] [--iops_rd<number>]
[--iops_wr<number>]
[PATCH 1/5] Add new API virDomainBlockIoThrottle.
[PATCH 2/5] Add virDomainBlockIoThrottle support to the remote driver.
[PATCH 3/5] Implement virDomainBlockIoThrottle for the qemu driver.
[PATCH 4/5] Enable the virDomainBlockIoThrottle API in virsh.
[PATCH 5/5] Enable virDomainBlockIoThrottle in the python API.
And I will address feedback and work on the missing features in few days includes:
3) The support to display the setting for block i/o throttling - HMP/QMP
4) Python binding support.
5) --current --live --config options support to unify the libvirt API.
--
Lei