mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: hotplug: Disallow media change while blockjob is active
Until the block job completes we can't change the disk chain. Removal would fail as the block job still has reference to the chain. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0beac488e0
commit
b3736febca
@ -852,10 +852,17 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virStorageSourcePtr oldsrc = disk->src;
|
virStorageSourcePtr oldsrc = disk->src;
|
||||||
|
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
bool sharedAdded = false;
|
bool sharedAdded = false;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (diskPriv->blockjob && qemuBlockJobIsRunning(diskPriv->blockjob)) {
|
||||||
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
|
_("can't change media while a block job is running on the device"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
disk->src = newsrc;
|
disk->src = newsrc;
|
||||||
|
|
||||||
if (virDomainDiskTranslateSourcePool(disk) < 0)
|
if (virDomainDiskTranslateSourcePool(disk) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user