Changes since V1
- Implement the support to get the block io throttling for
a device as read only connection - QMP/HMP.
- Split virDomainBlockIoThrottle into two separate functions
virDomainSetBlockIoThrottle - Set block I/O limits for a device
- Requires a connection in 'write' mode.
- Limits (info) structure passed as an input parameter
virDomainGetBlockIoThrottle - Get the current block I/O limits for a device
- Works on a read-only connection.
- Current limits are written to the output parameter (reply).
- And Other fixups suggested by Adam Litke, Daniel P. Berrange.
- For dynamically allocate the blkiothrottle struct, I will fix
it when implement --current --live --config options support.
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. #1)#2) features were implemented
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'/>
<iotune bps='n'.../>
</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>]
3) The support to get the current block i/o throttling for a device - HMP/QMP.
virsh blkiothrottle <domain> <device>
bps:
bps_rd:
bps_wr:
iops:
iops_rd:
iops_wr:
And I will address feedback and work on the missing features in few days includes:
4) Python binding support for setting blkio throttling.
5) --current --live --config options support to unify the libvirt API.
daemon/remote.c | 85 +++++++++++++++++
include/libvirt/libvirt.h.in | 25 +++++
python/generator.py | 2 +
python/libvirt-override-api.xml | 16 ++++
python/libvirt-override.c | 43 +++++++++
src/conf/domain_conf.c | 77 ++++++++++++++++
src/conf/domain_conf.h | 11 +++
src/driver.h | 18 ++++
src/libvirt.c | 120 ++++++++++++++++++++++++
src/libvirt_public.syms | 2 +
src/qemu/qemu_command.c | 35 +++++++
src/qemu/qemu_driver.c | 108 ++++++++++++++++++++++
src/qemu/qemu_monitor.c | 36 ++++++++
src/qemu/qemu_monitor.h | 10 ++
src/qemu/qemu_monitor_json.c | 191 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 10 ++
src/qemu/qemu_monitor_text.c | 88 ++++++++++++++++++
src/qemu/qemu_monitor_text.h | 10 ++
src/remote/remote_driver.c | 81 +++++++++++++++++
src/remote/remote_protocol.x | 39 ++++++++-
src/remote_protocol-structs | 34 +++++++
src/util/xml.h | 3 +
tools/virsh.c | 100 ++++++++++++++++++++
tools/virsh.pod | 13 +++
24 files changed, 1156 insertions(+), 1 deletions(-)
--
Lei