From: Eric Blake Date: Fri, 4 May 2012 16:24:17 +0000 (-0600) Subject: qemu: reject blockiotune if qemu too old X-Git-Tag: v0.9.12-rc2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13f9a19326a7727e07ab689ea5392255fbd5cd4f;p=thirdparty%2Flibvirt.git qemu: reject blockiotune if qemu too old Commit 4c82f09e added a capability check for qemu per-device io throttling, but only applied it to domain startup. As mentioned in the previous commit (98cec05), the user can still get an 'internal error' message during a hotplug attempt, when the monitor command doesn't exist. It is confusing to allow tuning on inactive domains only to then be rejected when starting the domain. * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Reject offline tuning if online can't match it. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2fde15b4a0..c100a1a124 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11936,6 +11936,13 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } + priv = vm->privateData; + if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) { + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("block I/O throttling not supported with this " + "QEMU binary")); + goto cleanup; + } device = qemuDiskPathToAlias(vm, disk, &idx); if (!device) { @@ -12007,7 +12014,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, info.read_iops_sec = oldinfo->read_iops_sec; info.write_iops_sec = oldinfo->write_iops_sec; } - priv = vm->privateData; qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, &info); qemuDomainObjExitMonitorWithDriver(driver, vm);