Historically this didn't work with any supported qemu version as we
don't set the alias of the device, and thus qemu uses a different alias
resulting in a failure to startup the VM:
internal error: unable to execute QEMU command 'block_set_io_throttle': Device
'drive-sd-disk0' not found
Refuse setting throttling as this is unlikely to be needed and proper
fix requires using -device instead of -drive if=sd.
Note that this was broken when I moved the setup of throttling as a
command at startup for blockdev integration quite a while ago. Until
then throttling was passed as arguments for -drive.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 17 +++++++++--------
src/qemu/qemu_validate.c | 8 ++++++++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 00b58e0424..d3b37486c3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14764,11 +14764,12 @@ typedef enum {
static bool
-qemuDomainDiskBlockIoTuneIsSupported(virStorageSource *src)
+qemuDomainDiskBlockIoTuneIsSupported(virDomainDiskDef *disk)
{
- if (virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_VHOST_USER) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("a block I/O throttling is not supported for vhostuser
disk"));
+ if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER ||
+ disk->bus == VIR_DOMAIN_DISK_BUS_SD) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("block I/O throttling is not supported for disk
'%1$s'"), disk->dst);
return false;
}
@@ -15107,7 +15108,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (!(disk = qemuDomainDiskByName(def, path)))
goto endjob;
- if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src))
+ if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
goto endjob;
if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
@@ -15193,7 +15194,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
goto endjob;
}
- if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk->src))
+ if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk))
goto endjob;
conf_cur_info = qemuDomainFindGroupBlockIoTune(persistentDef, conf_disk,
&info);
@@ -15284,7 +15285,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
if (!(disk = qemuDomainDiskByName(def, path)))
goto endjob;
- if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src))
+ if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
goto endjob;
if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
@@ -15309,7 +15310,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
goto endjob;
}
- if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src))
+ if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
goto endjob;
reply = disk->blkdeviotune;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index da4b9a3b35..04d0c9df73 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3094,6 +3094,14 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef
*disk,
return -1;
}
+ /* setting throttling for the SD card didn't work, refuse it explicitly */
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_SD &&
+ qemuDiskConfigBlkdeviotuneEnabled(disk)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("<iotune> is not supported with
bus='sd'"));
+ return -1;
+ }
+
/* checking def here is only for calling from tests */
if (disk->blkdeviotune.group_name) {
size_t i;
--
2.40.1