mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 00:25:17 +00:00
qemu: Properly handle setting of <iotune> for empty cdrom
When starting a VM with an empty cdrom which has <iotune> configured the startup fails as qemu is not happy about setting tuning for an empty drive: error: internal error: unable to execute 'block_set_io_throttle', unexpected error: 'Device has no medium' Resolve this by skipping the setting of throttling for empty drives and updating the throttling when new medium is inserted into the drive. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/111 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
3b364c6509
commit
d0819b9f02
src/qemu
@ -558,6 +558,16 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
|
||||
nodename);
|
||||
}
|
||||
|
||||
/* set throttling for the new image */
|
||||
if (rc == 0 &&
|
||||
!virStorageSourceIsEmpty(newsrc) &&
|
||||
qemuDiskConfigBlkdeviotuneEnabled(disk)) {
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL,
|
||||
diskPriv->qomName,
|
||||
&disk->blkdeviotune,
|
||||
true, true, true);
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
rc = qemuMonitorBlockdevTrayClose(priv->mon, diskPriv->qomName);
|
||||
|
||||
|
@ -6838,6 +6838,10 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver,
|
||||
if (qemuDiskBusIsSD(disk->bus))
|
||||
continue;
|
||||
|
||||
/* Setting throttling for empty drives fails */
|
||||
if (virStorageSourceIsEmpty(disk->src))
|
||||
continue;
|
||||
|
||||
if (!qemuDiskConfigBlkdeviotuneEnabled(disk))
|
||||
continue;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user