- qemu: allow migration of guest with mdev vGPU to VF vGPU (RHEL-68065) - storage_file: Refuse qcow2 images with empty string as 'data_file' (RHEL-70627) - virstoragetest: Add case for qcow2 image with empty string as 'data_file' (RHEL-70627) - qemu: snapshot: delete disk image only if parent snapshot is external (RHEL-74040) - storage_file: de-modularize the local file backend (RHEL-73506) - libvirt.spec: Move ownership of 'storage-file' backends directory to gluster (RHEL-73506) - tools: ssh-proxy: Check for domain status before parsing its CID (RHEL-75589) - qemu: re-use existing ActualNetDef for more interface types during update-device (RHEL-74492) Resolves: RHEL-68065, RHEL-70627, RHEL-73506, RHEL-74040, RHEL-74492 Resolves: RHEL-75589
72 lines
3.1 KiB
Diff
72 lines
3.1 KiB
Diff
From 6d57b760d3c47e440d796059e307c494a5416e70 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <6d57b760d3c47e440d796059e307c494a5416e70.1737724457.git.jdenemar@redhat.com>
|
|
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Date: Thu, 9 Jan 2025 16:23:44 +0100
|
|
Subject: [PATCH] qemu: snapshot: delete disk image only if parent snapshot is
|
|
external
|
|
|
|
When we are deleting external snapshot that is not active we only need
|
|
to delete overlay disk image of the parent snapshot. This works
|
|
correctly even if parent snapshot is external and active as it will have
|
|
another overlay created when user reverted to that snapshot.
|
|
|
|
In case the parent snapshot is internal there are no overlay disk images
|
|
created as everything is stored internally within the disk image. In
|
|
this case we would delete the actual disk image storing internal
|
|
snapshots and most likely the original disk image as well resulting in
|
|
data loss once the VM is shutoff.
|
|
|
|
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/734
|
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
(cherry picked from commit d51179fa82448f4720f1645f0b7100df80508cc4)
|
|
|
|
https://issues.redhat.com/browse/RHEL-74040
|
|
|
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
---
|
|
src/qemu/qemu_snapshot.c | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
|
|
index 18b2e478f6..80cd54bf33 100644
|
|
--- a/src/qemu/qemu_snapshot.c
|
|
+++ b/src/qemu/qemu_snapshot.c
|
|
@@ -3144,6 +3144,8 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm,
|
|
return -1;
|
|
}
|
|
|
|
+ data->parentSnap = qemuSnapshotFindParentSnapForDisk(snap, data->snapDisk);
|
|
+
|
|
if (data->merge) {
|
|
virStorageSource *snapDiskSrc = NULL;
|
|
|
|
@@ -3185,8 +3187,6 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm,
|
|
qemuSnapshotGetDisksWithBackingStore(vm, snap, data);
|
|
}
|
|
|
|
- data->parentSnap = qemuSnapshotFindParentSnapForDisk(snap, data->snapDisk);
|
|
-
|
|
if (data->parentSnap && !virDomainSnapshotIsExternal(data->parentSnap)) {
|
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
_("deleting external snapshot that has internal snapshot as parent not supported"));
|
|
@@ -3642,10 +3642,12 @@ qemuSnapshotDiscardExternal(virDomainObj *vm,
|
|
if (!data->job)
|
|
goto error;
|
|
} else {
|
|
- if (virStorageSourceInit(data->parentDomDisk->src) < 0 ||
|
|
- virStorageSourceUnlink(data->parentDomDisk->src) < 0) {
|
|
- VIR_WARN("Failed to remove snapshot image '%s'",
|
|
- data->snapDisk->name);
|
|
+ if (data->parentSnap && virDomainSnapshotIsExternal(data->parentSnap)) {
|
|
+ if (virStorageSourceInit(data->parentDomDisk->src) < 0 ||
|
|
+ virStorageSourceUnlink(data->parentDomDisk->src) < 0) {
|
|
+ VIR_WARN("Failed to remove snapshot image '%s'",
|
|
+ data->snapDisk->name);
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
--
|
|
2.48.1
|