mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: snapshot: Don't update current snapshot until we're done
Since commit f105627992
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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
cd62dbc03b
commit
391728befd
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user