1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemuDomainSetBlockIoTune: Skip monitor call for empty cdrom

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
This commit is contained in:
Peter Krempa 2021-01-07 10:19:22 +01:00
parent 8792b74774
commit 3e0d9131cc

View File

@ -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);