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