render / rpms / libvirt

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