With -blockdev the drive alias can't be used any more so we need to
switch to the QOM name.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0e1047c6ec..8fe51a0067 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18222,7 +18222,8 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
virDomainDefPtr def = NULL;
virDomainDefPtr persistentDef = NULL;
virDomainBlockIoTuneInfo info;
- char *device = NULL;
+ char *drivealias = NULL;
+ const char *qdevid = NULL;
int ret = -1;
size_t i;
virDomainDiskDefPtr conf_disk = NULL;
@@ -18447,8 +18448,12 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (!(disk = qemuDomainDiskByName(def, path)))
goto endjob;
- if (!(device = qemuAliasDiskDriveFromDisk(disk)))
- goto endjob;
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+ qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->backendQomName;
+ } else {
+ if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
+ goto endjob;
+ }
if (qemuDomainSetBlockIoTuneDefaults(&info, &disk->blkdeviotune,
set_fields) < 0)
@@ -18494,7 +18499,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
* via the JSON error code from the block_set_io_throttle call */
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, NULL,
+ ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
&info, supportMaxOptions,
set_fields &
QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
supportMaxLengthOptions);
@@ -18544,7 +18549,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
cleanup:
VIR_FREE(info.group_name);
- VIR_FREE(device);
+ VIR_FREE(drivealias);
virDomainObjEndAPI(&vm);
if (eventNparams)
virTypedParamsFree(eventParams, eventNparams);
@@ -18566,7 +18571,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
virDomainDefPtr def = NULL;
virDomainDefPtr persistentDef = NULL;
virDomainBlockIoTuneInfo reply = {0};
- char *device = NULL;
+ char *drivealias = NULL;
+ const char *qdevid = NULL;
int ret = -1;
int maxparams;
@@ -18620,10 +18626,14 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
if (!(disk = qemuDomainDiskByName(def, path)))
goto endjob;
- if (!(device = qemuAliasDiskDriveFromDisk(disk)))
- goto endjob;
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+ qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->backendQomName;
+ } else {
+ if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
+ goto endjob;
+ }
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, NULL, &reply);
+ ret = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid,
&reply);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto endjob;
if (ret < 0)
@@ -18698,7 +18708,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
cleanup:
VIR_FREE(reply.group_name);
- VIR_FREE(device);
+ VIR_FREE(drivealias);
virDomainObjEndAPI(&vm);
return ret;
}
--
2.16.2