On Tue, Jan 30, 2024 at 12:33:50 +0100, Pavel Hrdina wrote:
Introduce new function qemuSnapshotCreateUseExternal() that will
return
true if we will use external snapshots as default location.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 73ff533827..ab7b47319b 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1576,6 +1576,20 @@ qemuSnapshotCreateXMLValidateDef(virDomainObj *vm,
}
Please document the desired logic behind the return value.
+static bool
+qemuSnapshotCreateUseExternal(virDomainSnapshotDef *def,
+ unsigned int flags)
+{
+ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
+ return true;
+
+ if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+ return true;
+
+ return false;
+}
+
+
static int
qemuSnapshotCreateAlignDisks(virDomainObj *vm,
virDomainSnapshotDef *def,
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>