[libvirt] [PATCH] qemu: Check for qemu capability when calling virDomainGetBlockIoTune()

Martin Kletzander mkletzan at redhat.com
Thu May 28 18:18:31 UTC 2015


When getting block device I/O tuning data there is no check for whether
QEMU supports such options and the call fails on
qemuMonitorGetBlockIoThrottle() when getting the particular throttle
data.  So try reporting a better error when blkdeviotune is not
supported.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1224053

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d1b00a2014ba..8f8ad8ba5bf5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18065,6 +18065,12 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
          * because we need vm->privateData which need
          * virDomainLiveConfigHelperMethod to do so. */
         priv = vm->privateData;
+        if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("block I/O throttling not supported with this "
+                         "QEMU binary"));
+            goto endjob;
+        }
         supportMaxOptions = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
     }

-- 
2.4.2




More information about the libvir-list mailing list