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

qemu: blockjob: Unplug inherited storage chains when concluding blockjob

In cases when the disk frontend was unplugged while a blockjob was
running the blockjob inherits the backing chain. When the blockjob is
then terminated we need to unplug the chain as it will not be used any
more.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 0a9fd832
......@@ -536,6 +536,28 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
}
static void
qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
virStorageSourcePtr chain)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
if (!(data = qemuBlockStorageSourceChainDetachPrepareBlockdev(chain)))
return;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return;
qemuBlockStorageSourceChainDetach(qemuDomainGetMonitor(vm), data);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
return;
qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain);
}
static void
qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
virQEMUDriverPtr driver,
......@@ -652,6 +674,16 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
qemuBlockJobEventProcessConcludedTransition(job, driver, vm, asyncJob);
/* unplug the backing chains in case the job inherited them */
if (!job->disk) {
if (job->chain)
qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob,
job->chain);
if (job->mirrorChain)
qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob,
job->mirrorChain);
}
cleanup:
if (dismissed) {
qemuBlockJobUnregister(job, vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册