[libvirt] [PATCH 12/13] qemu: snapshot: Return early if there's nothing to snapshot

Peter Krempa posted 13 patches 6 years, 8 months ago
[libvirt] [PATCH 12/13] qemu: snapshot: Return early if there's nothing to snapshot
Posted by Peter Krempa 6 years, 8 months ago
Skip actual snapshot creation code if we have 0 disks to snapshot.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5b6d3bb795..b7f5142605 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15259,6 +15259,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
                                           &diskdata, &ndiskdata) < 0)
         goto cleanup;

+    /* check whether there's anything to do */
+    if (ndiskdata == 0) {
+        ret = 0;
+        goto cleanup;
+    }
+
      /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list are
       * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or
       * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 12/13] qemu: snapshot: Return early if there's nothing to snapshot
Posted by Ján Tomko 6 years, 8 months ago
On Wed, Jun 05, 2019 at 05:28:34PM +0200, Peter Krempa wrote:
>Skip actual snapshot creation code if we have 0 disks to snapshot.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_driver.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>

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