libvirt/SOURCES/libvirt-qemu-snapshot-Always-rewrite-backingStore-data-when-reusing-existing-images.patch

47 lines
1.7 KiB
Diff
Raw Normal View History

From 647f43ec778b6d5dafb256d5dbe4ad1f0a4e9776 Mon Sep 17 00:00:00 2001
Message-Id: <647f43ec778b6d5dafb256d5dbe4ad1f0a4e9776@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:47 +0100
Subject: [PATCH] qemu: snapshot: Always rewrite backingStore data when reusing
existing images
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Don't adopt the backing store data when reusing images provided by the
user. This will force a backing chain re-probe as users might have
passed in something unexpected in the overlay where our view of the
backing chain would not correspond.
This is done only for inactive snapshots as there we have way less
verification.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 8e9e73a984165d5e9a82ba1f4531bb30482db5a8)
https://bugzilla.redhat.com/show_bug.cgi?id=1524278
Message-Id: <baa37a0240d05d2441a54e7ad1c1a8648c7e7f65.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e651c9e819..5c72db2544 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14678,7 +14678,8 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) < 0)
goto cleanup;
- if (virStorageSourceHasBacking(defdisk->src)) {
+ if (!reuse &&
+ virStorageSourceHasBacking(defdisk->src)) {
defdisk->src->readonly = true;
newsrc->backingStore = g_steal_pointer(&defdisk->src);
} else {
--
2.25.0