]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: snapshot: Return early if there's nothing to snapshot
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Jun 2019 13:37:30 +0000 (15:37 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 10 Jun 2019 12:01:09 +0000 (14:01 +0200)
Skip actual snapshot creation code if we have 0 disks to snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 0b4cc49f9c114f60f8c6d92d69a403d9b7cee300..b19ef5c79b85e4498146c33db27fd8a89a07d84b 100644 (file)
@@ -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