Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1019926
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=868673
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/libvirt_private.syms | 2 +-
src/qemu/qemu_domain.c | 3 +++
src/util/virstoragefile.c | 15 +++++++++++++++
src/util/virstoragefile.h | 2 ++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0e81f2f..42c0185 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1834,6 +1834,7 @@ virStorageFileIsClusterFS;
virStorageFileProbeFormat;
virStorageFileProbeFormatFromBuf;
virStorageFileResize;
+virStorageFormatMaySupportSnapshots;
virStorageIsFile;
virStorageNetHostDefClear;
virStorageNetHostDefCopy;
@@ -1850,7 +1851,6 @@ virStorageSourcePoolModeTypeToString;
virStorageTypeFromString;
virStorageTypeToString;
-
# util/virstring.h
virArgvToString;
virAsprintfInternal;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cdd4601..abc2a68 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2250,6 +2250,9 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
if (!virDomainDiskGetSource(disk))
continue;
+ if (!virStorageFormatMaySupportSnapshots(disk->src.format))
+ continue;
+
if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0 &&
qemuDiskChainCheckBroken(disk) >= 0)
continue;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index ea80c1d..c781a6b 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1730,3 +1730,18 @@ virStorageSourceClear(virStorageSourcePtr def)
virStorageNetHostDefFree(def->nhosts, def->hosts);
virStorageSourceAuthClear(def);
}
+
+bool
+virStorageFormatMaySupportSnapshots(enum virStorageFileFormat format)
+{
+ if (format == VIR_STORAGE_FILE_AUTO ||
+ format == VIR_STORAGE_FILE_AUTO_SAFE)
+ return true;
+
+ /* Better safe than sorry */
+ if (format <= VIR_STORAGE_FILE_NONE ||
+ format >= VIR_STORAGE_FILE_LAST)
+ return false;
+
+ return !!fileTypeInfo[format].getBackingStore;
+}
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 1b8b14f..bcbfb88 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -339,4 +339,6 @@ void virStorageSourcePoolDefFree(virStorageSourcePoolDefPtr def);
void virStorageSourceClear(virStorageSourcePtr def);
int virStorageSourceGetActualType(virStorageSourcePtr def);
+bool virStorageFormatMaySupportSnapshots(enum virStorageFileFormat format);
+
#endif /* __VIR_STORAGE_FILE_H__ */
--
1.9.2