Currently we'd audit that we managed to format the data for the
'transaction' command rather than the (un)successful attempt to create
the snapshot.
Move the auditing code so that it can actually audit the result of the
'transaction' command.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e5005fd829..ea06e23ff1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14936,7 +14936,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
char *device = NULL;
char *source = NULL;
const char *formatStr = NULL;
- int ret = -1, rc;
+ int ret = -1;
if (!(device = qemuAliasDiskDriveFromDisk(dd->disk)))
goto cleanup;
@@ -14964,9 +14964,8 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
formatStr = virStorageFileFormatTypeToString(dd->src->format);
- ret = rc = qemuMonitorDiskSnapshot(priv->mon, actions, device, source,
- formatStr, reuse);
- virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc
>= 0);
+ ret = qemuMonitorDiskSnapshot(priv->mon, actions, device, source,
+ formatStr, reuse);
cleanup:
VIR_FREE(device);
@@ -15031,10 +15030,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
ret = qemuMonitorTransaction(priv->mon, &actions);
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) {
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
- goto error;
- }
for (i = 0; i < snap->def->ndisks; i++) {
qemuDomainSnapshotDiskDataPtr dd = &diskdata[i];
@@ -15042,8 +15039,14 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (!dd->src)
continue;
- qemuDomainSnapshotUpdateDiskSources(&diskdata[i], &persist);
+ virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot",
ret >= 0);
+
+ if (ret == 0)
+ qemuDomainSnapshotUpdateDiskSources(dd, &persist);
}
+
+ if (ret < 0)
+ goto error;
}
error:
--
2.16.2