提交 165b430e 编写于 作者: P Peter Krempa

qemuBackupDiskDataCleanupOne: Don't exit early when the job has started

Originally the function was cleaning up a failed job only but now
there's other stuff that needs to be cleared too.

Make only steps which clean up after a failed job depend on the
'started' field and execute the rest of the code always.

This fixes a leak of the backup job tracking object and the blockdev-add
helper data.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 214faa0b
...@@ -124,26 +124,25 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm, ...@@ -124,26 +124,25 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm,
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
if (dd->started) if (!dd->started) {
return; if (dd->added) {
qemuDomainObjEnterMonitor(priv->driver, vm);
qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]);
ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
}
if (dd->added) { if (dd->created) {
qemuDomainObjEnterMonitor(priv->driver, vm); if (virStorageFileUnlink(dd->store) < 0)
qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]); VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store->path));
ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); }
}
if (dd->created) { if (dd->labelled)
if (virStorageFileUnlink(dd->store) < 0) qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->store);
VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store->path));
} }
if (dd->initialized) if (dd->initialized)
virStorageFileDeinit(dd->store); virStorageFileDeinit(dd->store);
if (dd->labelled)
qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->store);
if (dd->blockjob) if (dd->blockjob)
qemuBlockJobStartupFinalize(vm, dd->blockjob); qemuBlockJobStartupFinalize(vm, dd->blockjob);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册