]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuSnapshotPrepareDiskExternal: Refactor existing file check
authorPeter Krempa <pkrempa@redhat.com>
Wed, 16 Jun 2021 13:43:03 +0000 (15:43 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 18 Jun 2021 07:16:16 +0000 (09:16 +0200)
Use the snapshot disk type from the definition now that we validate that
it matches.

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

index 96c43f69e7d17ed2dc138118de70fc24af7e4412..dab386e455b4bcc6a28383ab7ec89b4fea16888b 100644 (file)
@@ -607,10 +607,11 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm,
                 return -1;
             }
 
-            if (!S_ISBLK(st.st_mode) && st.st_size && !reuse) {
+            if (!reuse &&
+                snapdisk->src->type == VIR_STORAGE_TYPE_FILE &&
+                st.st_size > 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("external snapshot file for disk %s already "
-                                 "exists and is not a block device: %s"),
+                               _("external snapshot file for disk %s already exists and is not a block device: %s"),
                                snapdisk->name, snapdisk->src->path);
                 return -1;
             }