On Thu, Nov 10, 2011 at 4:32 AM, Lei
Li<lilei(a)linux.vnet.ibm.com> wrote:
> Changes since V2
> - Implement the Python binding support for setting blkio throttling.
> - Implement --current --live --config options support to unify the libvirt API.
> - Add changes in docs and tests.
> - Some changes suggested by Adam Litke, Eric Blake, Daniel P. Berrange.
> - Change the XML schema.
> - API name to virDomain{Set, Get}BlockIoTune.
> - Parameters changed to make them more self-explanatory.
> - virsh command name to blkdeviotune.
> - And other fixups.
>
> 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 virDomain{Set, Get}BlockIoThrottle(), new command
'blkdeviotune'
> and Python bindings.
>
> Notes: Now all the planed features were implemented (#1#2 were implemented by
> Zhi Yong Wu), the previous comments were all fixed up too. And the qemu part patches
> have been accepted upstream just now and are expected to be part of the QEMU 1.1
> release, git tree from Zhi Yong:
>
>
http://repo.or.cz/w/qemu/kevin.git/shortlog/refs/heads/block
>
>
> 1) Enable the blkio throttling in xml when guest is starting up.
>
> Add blkio throttling in xml as follows:
>
> <disk type='file' device='disk'>
> ...
> <iotune>
> <total_bytes_sec>nnn</total_bytes_sec>
> ...
> </iotune>
> ...
> </disk>
>
> 2) Enable blkio throttling setting at guest running time.
>
> virsh blkdeviotune<domain> <device> [--total_bytes_sec<number>]
[--read_bytes_sec<number>] \
> [--write_bytes_sec<number>] [--total_iops_sec<number>]
[--read_iops_sec<number>]
> [--write_iops_sec<number>]
>
> 3) The support to get the current block i/o throttling for a device - HMP/QMP.
>
> virsh blkiothrottle<domain> <device>
> total_bytes_sec:
> read_bytes_sec:
> write_bytes_sec:
> total_iops_sec:
> read_iops_sec:
> write_iops_sec:
>
> 4) Python binding support for setting blkio throttling.
> 5) --current --live --config options support to unify the libvirt API.
>
> virsh blkdeviotune<domain> <device> [--total_bytes_sec<number>]
[--read_bytes_sec<number>]
> [--write_bytes_sec<number>] [--total_iops_sec<number>]
[--read_iops_sec<number>]
> [--write_iops_sec<number>] [--config] [--live] [--current]
Thanks Li Lei for the remaining works. Below is only one reminder.
QEMU command line options have some limitations as below:
(1) global bps limit.
-drive bps=xxx in bytes/s
(2) only read bps limit
-drive bps_rd=xxx in bytes/s
(3) only write bps limit
-drive bps_wr=xxx in bytes/s
(4) global iops limit
-drive iops=xxx in ios/s
(5) only read iops limit
-drive iops_rd=xxx in ios/s
(6) only write iops limit
-drive iops_wr=xxx in ios/s
(7) the combination of some limits.
-drive bps=xxx,iops=xxx
Known Limitations:
(1) #1 can not be used with #2, #3 together
(2) #4 can not be used with #5, #6 together
Yes, you might want to look into the code about domain_conf.c
and qemu_driver.c part, I have already do the limitations on
both XML and the command.
>
>
> daemon/remote.c | 87 +++++++
> docs/formatdomain.html.in | 30 ++
> docs/schemas/domaincommon.rng | 24 +
> include/libvirt/libvirt.h.in | 25 ++
> python/generator.py | 2
> python/libvirt-override-api.xml | 16 +
> python/libvirt-override.c | 85 +++++++
> src/conf/domain_conf.c | 101 ++++++++
> src/conf/domain_conf.h | 12
> src/driver.h | 18 +
> src/libvirt.c | 115 +++++++++
> src/libvirt_public.syms | 2
> src/qemu/qemu_command.c | 33 ++
> src/qemu/qemu_driver.c | 217 ++++++++++++++++++
> 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 | 152 ++++++++++++
> 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
> tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args | 4
> tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 36 ++
> tests/qemuxml2argvtest.c | 2
> tests/qemuxml2xmltest.c | 2
> tools/virsh.c | 146 ++++++++++++
> tools/virsh.pod | 23 +
> 30 files changed, 1540 insertions(+), 6 deletions(-)
>
> --
> Lei
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvir-list
>