提交 b3736feb 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 0beac488
......@@ -852,10 +852,17 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
virStorageSourcePtr oldsrc = disk->src;
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
bool sharedAdded = false;
int ret = -1;
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;
if (virDomainDiskTranslateSourcePool(disk) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册