On Thu, Apr 22, 2010 at 09:39:57AM -0400, Chris Lalancette wrote:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5f4adfd..4ec4bd6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11034,18 +11040,18 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0)
- goto cleanup;
+ goto endjob;
}
else {
if (qemuDomainSnapshotSetActive(vm, driver->snapshotDir) < 0)
- goto cleanup;
+ goto endjob;
rc = qemudStartVMDaemon(snapshot->domain->conn, driver, vm, NULL,
-1);
if (qemuDomainSnapshotSetInactive(vm, driver->snapshotDir) < 0)
- goto cleanup;
+ goto endjob;
if (rc < 0)
- goto cleanup;
+ goto endjob;
}
if (snap->def->state == VIR_DOMAIN_PAUSED) {
@@ -11057,7 +11063,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
rc = qemuMonitorStopCPUs(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0)
- goto cleanup;
+ goto endjob;
}
event = virDomainEventNewFromObj(vm,
@@ -11083,17 +11089,18 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
}
if (qemuDomainSnapshotSetActive(vm, driver->snapshotDir) < 0)
- goto cleanup;
+ goto endjob;
}
vm->state = snap->def->state;
ret = 0;
-cleanup:
- if (vm && qemuDomainObjEndJob(vm) == 0)
+endjob:
+ if (qemuDomainObjEndJob(vm) == 0)
vm = NULL;
+cleanup:
if (event)
qemuDomainEventQueue(driver, event);
if (vm)
Getting rid of the check for vm being non-NULL actually makes me
notice another bug. The place a little further up where you call
qemudShutdownVMDaemon() is missing the followup code to clear up
transient guests
if (!vm->persistent) {
if (qemuDomainObjEndJob(vm) > 0)
virDomainRemoveInactive(&driver->domains,
vm);
vm = NULL;
}
With this added, you'd still need the NULL check
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|