Now that we never get to the actual snapshot code if there's nothing to
do we can remove the variable and surrounding logic.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b7f5142605..69aefcf659 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15238,7 +15238,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOPTR(virJSONValue) actions = NULL;
- bool do_transaction = false;
int rc;
int ret = -1;
size_t i;
@@ -15274,32 +15273,28 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
&diskdata[i],
actions, reuse) < 0)
goto cleanup;
-
- do_transaction = true;
}
- if (do_transaction) {
- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- goto cleanup;
-
- rc = qemuMonitorTransaction(priv->mon, &actions);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ goto cleanup;
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
- rc = -1;
+ rc = qemuMonitorTransaction(priv->mon, &actions);
- for (i = 0; i < ndiskdata; i++) {
- qemuDomainSnapshotDiskDataPtr dd = &diskdata[i];
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ rc = -1;
- virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot",
rc >= 0);
+ for (i = 0; i < ndiskdata; i++) {
+ qemuDomainSnapshotDiskDataPtr dd = &diskdata[i];
- if (rc == 0)
- qemuDomainSnapshotUpdateDiskSources(dd);
- }
+ virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc
>= 0);
- if (rc < 0)
- goto cleanup;
+ if (rc == 0)
+ qemuDomainSnapshotUpdateDiskSources(dd);
}
+ if (rc < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
--
2.21.0