]> 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)
committerEric Blake <eblake@redhat.com>
Fri, 4 May 2012 22:13:56 +0000 (16:13 -0600)
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.

src/qemu/qemu_driver.c

index 2fde15b4a001ebe1b68edf63260b6b784fdfb88d..c100a1a124ab8dbb73b5026e3b81a5a0cb685271 100644 (file)
@@ -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);