Similarly to startup of the VM qemu doesn't like setting throttling for
an empty drive. Just skip it since we do the correct thing once new
media is inserted.
Resolves:
https://gitlab.com/libvirt/libvirt/-/issues/117
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
CC: Han Han <hhan(a)redhat.com>
Please test this commit since you have the environment prepared.
src/qemu/qemu_driver.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1283e61785..027617deef 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16301,16 +16301,23 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
#undef CHECK_MAX
- qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
- &info, supportMaxOptions,
- set_fields &
QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
- supportMaxLengthOptions);
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ /* blockdev-based qemu doesn't want to set the throttling when a cdrom
+ * is empty. Skip the monitor call here since we will set the throttling
+ * once new media is inserted */
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) ||
+ !virStorageSourceIsEmpty(disk->src)) {
+
+ qemuDomainObjEnterMonitor(driver, vm);
+ ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
+ &info, supportMaxOptions,
+ set_fields &
QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
+ supportMaxLengthOptions);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ ret = -1;
+ if (ret < 0)
+ goto endjob;
ret = -1;
- if (ret < 0)
- goto endjob;
- ret = -1;
+ }
virDomainDiskSetBlockIOTune(disk, &info);
--
2.29.2