From: Michal Privoznik Date: Tue, 19 Jun 2018 17:26:44 +0000 (+0200) Subject: qemuDomainSnapshotCreateActiveExternal: Grab agent job X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cb2bc7a49252f0ed75fee4d400828764d252e3fc;p=libvirt.git qemuDomainSnapshotCreateActiveExternal: Grab agent job Now that we have agent job we can grab it while freezing/thawing guest file system before/after doing snapshot. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 66125f25f6..b2c8e2d482 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15144,7 +15144,19 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, * The command will fail if the guest is paused or the guest agent * is not running, or is already quiesced. */ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) { - int freeze = qemuDomainSnapshotFSFreeze(driver, vm, NULL, 0); + int freeze; + + if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) { + qemuDomainObjEndAgentJob(vm); + goto cleanup; + } + + freeze = qemuDomainSnapshotFSFreeze(driver, vm, NULL, 0); + qemuDomainObjEndAgentJob(vm); + if (freeze < 0) { /* the helper reported the error */ if (freeze == -2) @@ -15281,10 +15293,15 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, } if (thaw != 0 && - qemuDomainSnapshotFSThaw(driver, vm, ret == 0 && thaw > 0) < 0) { - /* helper reported the error, if it was needed */ - if (thaw > 0) - ret = -1; + qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) >= 0 && + virDomainObjIsActive(vm)) { + if (qemuDomainSnapshotFSThaw(driver, vm, ret == 0 && thaw > 0) < 0) { + /* helper reported the error, if it was needed */ + if (thaw > 0) + ret = -1; + } + + qemuDomainObjEndAgentJob(vm); } virQEMUSaveDataFree(data);