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