From 79654f425c3ea6d421dcf0fe109cf0bb6d741d61 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Wed, 21 Feb 2024 17:45:08 +0100 Subject: [PATCH] qemu_snapshot: call qemuSnapshotDeleteUpdateDisks only for external snapshots Calling this function when deleting internal snapshot isn't required because with internal snapshots all changes are done within the file itself so there is no file deletion and no need to update snapshot metadata. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 0cac0c4146..be089a31db 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3537,14 +3537,16 @@ qemuSnapshotDiscardMetadata(virDomainObj *vm, if (rep.err < 0) ret = -1; - data.snap = snap; - data.vm = vm; - data.error = 0; - virDomainMomentForEachDescendant(snap, - qemuSnapshotDeleteUpdateDisks, - &data); - if (data.error < 0) - ret = -1; + if (virDomainSnapshotIsExternal(snap)) { + data.snap = snap; + data.vm = vm; + data.error = 0; + virDomainMomentForEachDescendant(snap, + qemuSnapshotDeleteUpdateDisks, + &data); + if (data.error < 0) + ret = -1; + } virDomainMomentMoveChildren(snap, snap->parent); }