On 11/23/2011 02:44 PM, Eric Blake wrote:
From: Lei Li <lilei(a)linux.vnet.ibm.com>
This patch add new pulic API virDomainSetBlockIoTune and
virDomainGetBlockIoTune.
Signed-off-by: Lei Li <lilei(a)linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy(a)linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
include/libvirt/libvirt.h.in | 63 ++++++++++++++++++
python/generator.py | 3 +
src/driver.h | 20 ++++++
src/libvirt.c | 149 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
5 files changed, 241 insertions(+), 0 deletions(-)
I finally got around to testing this series. It looks like the errors
with older qemu are decent enough without needing major tweaks in the code:
# tools/virsh blkdeviotune dom vda --total_bytes_sec 10000000
error: Unable to change block I/O throttle
error: Requested operation is not valid: Command 'block_set_io_throttle'
is not found
# tools/virsh blkdeviotune dom vda
error: Unable to get block I/O throttle parameters
error: invalid argument: No info for device 'drive-virtio-disk0'
We may find further things to tweak. Off-hand, I know of my desire to
fix things so that bytes_sec and iops_sec are independent, where setting
one does not clear the other; also, I did not get around to testing
hot-plug behavior with qemu that supports the new monitor command; my
guess is that we probably forgot to propagate a hotplug with iotuning
into qemu properly. But what we have in the series so far is good
enough to start pushing, so that we beat the rc1 freeze; touchups can
stretch out past the freeze as needed.
After rebasing this to latest, I'm squashing this in before pushing, to
pick up on the ideas of commit 4199f3de that went in during the meantime:
diff --git i/src/libvirt.c w/src/libvirt.c
index 8a5361e..5c09591 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -17574,6 +17574,12 @@ int virDomainGetBlockIoTune(virDomainPtr dom,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
+ /* At most one of these two flags should be set. */
+ if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
+ (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
+ virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
conn = dom->conn;
if (conn->driver->domainGetBlockIoTune) {
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org