From: Peter Krempa Date: Wed, 5 Jun 2019 13:37:30 +0000 (+0200) Subject: qemu: snapshot: Return early if there's nothing to snapshot X-Git-Tag: v5.5.0-rc1~311 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0491128f2a508a8b234e711be9ddbdd89768678f;p=thirdparty%2Flibvirt.git qemu: snapshot: Return early if there's nothing to snapshot Skip actual snapshot creation code if we have 0 disks to snapshot. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0b4cc49f9c..b19ef5c79b 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