79 lines
2.9 KiB
Diff
79 lines
2.9 KiB
Diff
|
From a3a9d320ac8cde96c976378b92dc4fcf553d9287 Mon Sep 17 00:00:00 2001
|
||
|
Message-Id: <a3a9d320ac8cde96c976378b92dc4fcf553d9287@dist-git>
|
||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||
|
Date: Fri, 3 Apr 2020 14:32:55 +0200
|
||
|
Subject: [PATCH] qemuDomainSnapshotDiskPrepareOne: Fix logic of relative
|
||
|
backing store update
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Commit 2ace7a87a8aced68c250 introduced a logic bug by an improperly
|
||
|
modified condition where we'd skip to the else branch when reusing of
|
||
|
external images was requested and blockdev is available.
|
||
|
|
||
|
The original intentions were to skip the backing store update with
|
||
|
blockdev.
|
||
|
|
||
|
Fix it by only asserting the boolean which was used to track whether we
|
||
|
support update of the backing store only when blockdev is not present
|
||
|
along with the appropriate rename.
|
||
|
|
||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1820016
|
||
|
|
||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
(cherry picked from commit ae64a75a8713cf14b25b40078766c2da93e001ff)
|
||
|
Message-Id: <c4ce185df3fb6d88aa7282d523b0a5c7ccff2aad.1585916255.git.pkrempa@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
---
|
||
|
src/qemu/qemu_driver.c | 19 +++++++++++--------
|
||
|
1 file changed, 11 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||
|
index 4701a1905e..26215f8d6a 100644
|
||
|
--- a/src/qemu/qemu_driver.c
|
||
|
+++ b/src/qemu/qemu_driver.c
|
||
|
@@ -15403,7 +15403,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
|
||
|
{
|
||
|
virDomainDiskDefPtr persistdisk;
|
||
|
bool supportsCreate;
|
||
|
- bool supportsBacking;
|
||
|
+ bool updateRelativeBacking = false;
|
||
|
|
||
|
dd->disk = disk;
|
||
|
|
||
|
@@ -15432,19 +15432,22 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
|
||
|
}
|
||
|
|
||
|
supportsCreate = virStorageFileSupportsCreate(dd->src);
|
||
|
- supportsBacking = virStorageFileSupportsBackingChainTraversal(dd->src);
|
||
|
|
||
|
- if (supportsCreate || supportsBacking) {
|
||
|
+ /* relative backing store paths need to be updated so that relative
|
||
|
+ * block commit still works. With blockdev we must update it when doing
|
||
|
+ * commit anyways so it's skipped here */
|
||
|
+ if (!blockdev &&
|
||
|
+ virStorageFileSupportsBackingChainTraversal(dd->src))
|
||
|
+ updateRelativeBacking = true;
|
||
|
+
|
||
|
+ if (supportsCreate || updateRelativeBacking) {
|
||
|
if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
|
||
|
return -1;
|
||
|
|
||
|
dd->initialized = true;
|
||
|
|
||
|
- /* relative backing store paths need to be updated so that relative
|
||
|
- * block commit still works. With blockdev we must update it when doing
|
||
|
- * commit anyways so it's skipped here */
|
||
|
- if (reuse && !blockdev) {
|
||
|
- if (supportsBacking) {
|
||
|
+ if (reuse) {
|
||
|
+ if (updateRelativeBacking) {
|
||
|
g_autofree char *backingStoreStr = NULL;
|
||
|
|
||
|
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
|
||
|
--
|
||
|
2.26.0
|
||
|
|