|
|
acda74 |
From 3ef43d47b0a5a49b0896b1725476b4b6ec0629b0 Mon Sep 17 00:00:00 2001
|
|
|
acda74 |
Message-Id: <3ef43d47b0a5a49b0896b1725476b4b6ec0629b0@dist-git>
|
|
|
acda74 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
acda74 |
Date: Tue, 21 Feb 2023 16:10:56 +0100
|
|
|
acda74 |
Subject: [PATCH] qemu_snapshot: remove memory snapshot when deleting external
|
|
|
acda74 |
snapshot
|
|
|
acda74 |
|
|
|
acda74 |
When deleting external snapshot we should remove the memory snapshot
|
|
|
acda74 |
file as well.
|
|
|
acda74 |
|
|
|
acda74 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
acda74 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
acda74 |
(cherry picked from commit 356e227208ec66fff178b91ed4b1197c7e6cf974)
|
|
|
acda74 |
|
|
|
acda74 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2170826
|
|
|
acda74 |
|
|
|
acda74 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
acda74 |
---
|
|
|
acda74 |
src/qemu/qemu_snapshot.c | 14 ++++++++++++--
|
|
|
acda74 |
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
acda74 |
|
|
|
acda74 |
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
|
|
|
acda74 |
index b8416808b3..5cdcbc6290 100644
|
|
|
acda74 |
--- a/src/qemu/qemu_snapshot.c
|
|
|
acda74 |
+++ b/src/qemu/qemu_snapshot.c
|
|
|
acda74 |
@@ -2684,9 +2684,11 @@ qemuSnapshotSetInvalid(virDomainObj *vm,
|
|
|
acda74 |
|
|
|
acda74 |
static int
|
|
|
acda74 |
qemuSnapshotDiscardExternal(virDomainObj *vm,
|
|
|
acda74 |
+ virDomainMomentObj *snap,
|
|
|
acda74 |
GSList *externalData)
|
|
|
acda74 |
{
|
|
|
acda74 |
GSList *cur = NULL;
|
|
|
acda74 |
+ virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
|
|
|
acda74 |
|
|
|
acda74 |
for (cur = externalData; cur; cur = g_slist_next(cur)) {
|
|
|
acda74 |
qemuSnapshotDeleteExternalData *data = cur->data;
|
|
|
acda74 |
@@ -2756,6 +2758,14 @@ qemuSnapshotDiscardExternal(virDomainObj *vm,
|
|
|
acda74 |
goto error;
|
|
|
acda74 |
}
|
|
|
acda74 |
|
|
|
acda74 |
+ if (snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL &&
|
|
|
acda74 |
+ snapdef->memorysnapshotfile) {
|
|
|
acda74 |
+ if (unlink(snapdef->memorysnapshotfile) < 0) {
|
|
|
acda74 |
+ VIR_WARN("failed to remove memory snapshot '%s'",
|
|
|
acda74 |
+ snapdef->memorysnapshotfile);
|
|
|
acda74 |
+ }
|
|
|
acda74 |
+ }
|
|
|
acda74 |
+
|
|
|
acda74 |
return 0;
|
|
|
acda74 |
|
|
|
acda74 |
error:
|
|
|
acda74 |
@@ -2886,7 +2896,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
|
|
|
acda74 |
}
|
|
|
acda74 |
|
|
|
acda74 |
if (virDomainSnapshotIsExternal(snap)) {
|
|
|
acda74 |
- if (qemuSnapshotDiscardExternal(vm, externalData) < 0)
|
|
|
acda74 |
+ if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0)
|
|
|
acda74 |
return -1;
|
|
|
acda74 |
} else {
|
|
|
acda74 |
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d", true) < 0)
|
|
|
acda74 |
@@ -2894,7 +2904,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
|
|
|
acda74 |
}
|
|
|
acda74 |
} else {
|
|
|
acda74 |
if (virDomainSnapshotIsExternal(snap)) {
|
|
|
acda74 |
- if (qemuSnapshotDiscardExternal(vm, externalData) < 0)
|
|
|
acda74 |
+ if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0)
|
|
|
acda74 |
return -1;
|
|
|
acda74 |
} else {
|
|
|
acda74 |
/* Similarly as internal snapshot creation we would use a regular job
|
|
|
acda74 |
--
|
|
|
acda74 |
2.39.1
|
|
|
acda74 |
|