On 08/15/2011 05:33 PM, Eric Blake wrote:
Audit all changes to the qemu vm->current_snapshot, and make them
update the saved xml file for both the previous and the new
snapshot, so that there is always at most one snapshot with
<active>1</active> in the xml, and that snapshot is used as the
current snapshot even across libvirtd restarts.
if (snap == vm->current_snapshot) {
if (snap->def->parent) {
parentsnap = virDomainSnapshotFindByName(&vm->snapshots,
snap->def->parent);
if (!parentsnap) {
- qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot parent with matching name
'%s'"),
- snap->def->parent);
- goto cleanup;
+ VIR_WARN("missing parent snapshot matching name
'%s'",
+ snap->def->parent);
+ } else {
+ parentsnap->def->current = true;
+ if (qemuDomainSnapshotWriteMetadata(vm, snap,
+ driver->snapshotDir)< 0) {
It helps to write to the correct file. Squash this in:
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 76c5549..f3b5fd8 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -8995,7 +8995,7 @@ static int qemuDomainSnapshotDiscard(struct
qemud_driver *driver,
snap->def->parent);
} else {
parentsnap->def->current = true;
- if (qemuDomainSnapshotWriteMetadata(vm, snap,
+ if (qemuDomainSnapshotWriteMetadata(vm, parentsnap,
driver->snapshotDir) < 0) {
VIR_WARN("failed to set parent snapshot '%s' as
current",
snap->def->parent);
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org