[libvirt] [PATCH v3 11/18] qemu: snapshot: Save status and config XMLs only on success

Peter Krempa posted 18 patches 6 years, 5 months ago
[libvirt] [PATCH v3 11/18] qemu: snapshot: Save status and config XMLs only on success
Posted by Peter Krempa 6 years, 5 months ago
We changed to always saving the status and config XMLs to simplify
code. After a few more refactors it's now possible to move it to the
appropriate place and save the XMLs only on success again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_driver.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ccbec5408d..fd9dbe854d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15554,17 +15554,17 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
     if (rc < 0)
         goto cleanup;

+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
+        (vm->newDef && virDomainSaveConfig(cfg->configDir, driver->caps,
+                                           vm->newDef) < 0))
+        goto cleanup;
+
     ret = 0;

  cleanup:
     if (ret < 0)
         virErrorPreserveLast(&orig_err);

-    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
-        (vm->newDef && virDomainSaveConfig(cfg->configDir, driver->caps,
-                                           vm->newDef) < 0))
-        ret = -1;
-
     qemuDomainSnapshotDiskDataCleanup(diskdata, ndiskdata, driver, vm);
     virErrorRestore(&orig_err);

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 11/18] qemu: snapshot: Save status and config XMLs only on success
Posted by Ján Tomko 6 years, 5 months ago
On Tue, Sep 03, 2019 at 04:08:04PM +0200, Peter Krempa wrote:
>We changed to always saving the status and config XMLs to simplify
>code. After a few more refactors it's now possible to move it to the
>appropriate place and save the XMLs only on success again.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_driver.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list