mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Refuse setting <iotune> for 'SD' disks
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
6d6a87f229
commit
4ba032a2a2
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user