Signed-off-by: Nikolay Shirokovskiy <nikolay.shirokovskiy(a)openvz.org>
---
src/qemu/qemu_snapshot.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 8c050cbd75..18b802e6d5 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -290,43 +290,42 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver,
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
- virObjectEvent *event = NULL;
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
bool halt = !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT);
- int ret = -1;
+ int rc;
if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
- goto cleanup;
+ return -1;
if (halt &&
qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE,
QEMU_ASYNC_JOB_SNAPSHOT) < 0)
- goto cleanup;
+ return -1;
if (qemuDomainObjEnterMonitorAsync(driver, vm,
QEMU_ASYNC_JOB_SNAPSHOT) < 0)
- goto cleanup;
+ return -1;
- ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
+ rc = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
qemuDomainObjExitMonitor(driver, vm);
- if (ret < 0)
- goto cleanup;
+ if (rc < 0)
+ return -1;
if (!(snapdef->cookie = (virObject *) qemuDomainSaveCookieNew(vm)))
- goto cleanup;
+ return -1;
if (halt) {
+ virObjectEvent *event;
+
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT);
+ virObjectEventStateQueue(driver->domainEventState, event);
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT,
QEMU_ASYNC_JOB_SNAPSHOT, 0);
virDomainAuditStop(vm, "from-snapshot");
}
- cleanup:
- virObjectEventStateQueue(driver->domainEventState, event);
-
- return ret;
+ return 0;
}
--
2.35.1