[libvirt] [PATCH 0/8 v5] Summary on block IO throttle

Lei Li lilei at linux.vnet.ibm.com
Tue Nov 15 09:02:42 UTC 2011


Changes since V3
 - Use virTypedParameterPtr instead of specific struct in libvirt pulic API.
 - Relevant changes to remote driver, qemu driver, python support and virsh.

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 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]



 daemon/remote.c                                    |  108 +++++++
 docs/formatdomain.html.in                          |   31 ++
 docs/schemas/domaincommon.rng                      |   24 ++
 include/libvirt/libvirt.h.in                       |   70 ++++
 python/generator.py                                |    2 +
 python/libvirt-override-api.xml                    |   16 +
 python/libvirt-override.c                          |  179 +++++++++++
 src/conf/domain_conf.c                             |  101 ++++++-
 src/conf/domain_conf.h                             |   12 +
 src/driver.h                                       |   20 ++
 src/libvirt.c                                      |  145 +++++++++
 src/libvirt_public.syms                            |    2 +
 src/qemu/qemu_command.c                            |   33 ++
 src/qemu/qemu_driver.c                             |  338 ++++++++++++++++++++
 src/qemu/qemu_monitor.c                            |   36 ++
 src/qemu/qemu_monitor.h                            |   22 ++
 src/qemu/qemu_monitor_json.c                       |  185 +++++++++++
 src/qemu/qemu_monitor_json.h                       |   10 +
 src/qemu/qemu_monitor_text.c                       |  164 ++++++++++
 src/qemu/qemu_monitor_text.h                       |   10 +
 src/remote/remote_driver.c                         |   96 ++++++
 src/remote/remote_protocol.x                       |   26 ++-
 src/remote_protocol-structs                        |   24 ++
 src/util/xml.h                                     |    2 +
 .../qemuxml2argv-blkdeviotune.args                 |    4 +
 .../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml |   37 +++
 tests/qemuxml2argvtest.c                           |    1 +
 tests/qemuxml2xmltest.c                            |    1 +
 tools/virsh.c                                      |  240 ++++++++++++++
 tools/virsh.pod                                    |   23 ++
 30 files changed, 1958 insertions(+), 4 deletions(-)

-- 
Lei




More information about the libvir-list mailing list