提交 391728be 编写于 作者: P Peter Krempa

qemu: snapshot: Don't update current snapshot until we're done

Since commit f1056279 we store whether a snapshot is current globally
rather than locally in the snapshot object.

This means that we don't have to unset the current snapshot prior to
taking/reverting the snapshot and we can do it only when everything is
done successfully.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 cd62dbc0
......@@ -16001,13 +16001,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if (!redefine &&
VIR_STRDUP(snap->def->parent_name, current->def->name) < 0)
goto endjob;
if (update_current) {
virDomainSnapshotSetCurrent(vm->snapshots, NULL);
if (qemuDomainSnapshotWriteMetadata(vm, current,
driver->caps, driver->xmlopt,
cfg->snapshotDir) < 0)
goto endjob;
}
}
/* actually do the snapshot */
......@@ -16480,7 +16473,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainMomentObjPtr snap = NULL;
virDomainMomentObjPtr current = NULL;
virDomainSnapshotDefPtr snapdef;
virObjectEventPtr event = NULL;
virObjectEventPtr event2 = NULL;
......@@ -16580,17 +16572,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
}
}
current = virDomainSnapshotGetCurrent(vm->snapshots);
if (current) {
virDomainSnapshotSetCurrent(vm->snapshots, NULL);
if (qemuDomainSnapshotWriteMetadata(vm, current,
driver->caps, driver->xmlopt,
cfg->snapshotDir) < 0)
goto endjob;
/* XXX Should we restore the current snapshot after this point
* in the failure cases where we know there was no change? */
}
if (snap->def->dom) {
config = virDomainDefCopy(snap->def->dom, caps,
driver->xmlopt, priv->qemuCaps, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册