]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: reject blockiotune if qemu too old
authorEric Blake <eblake@redhat.com>
Fri, 4 May 2012 16:24:17 +0000 (10:24 -0600)
committerCole Robinson <crobinso@redhat.com>
Thu, 14 Jun 2012 15:17:57 +0000 (11:17 -0400)
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.
(cherry picked from commit 13f9a19326a7727e07ab689ea5392255fbd5cd4f)

src/qemu/qemu_driver.c

index 4b23ee061b127006544c2e919d38f98803ea31a0..7cde099ebd144a6b4eef65bbd97b617c42fe44e9 100644 (file)
@@ -11848,6 +11848,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) {
@@ -11919,7 +11926,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);