libvirt/SOURCES/libvirt-virDomainDiskTranslateSourcePool-Translate-volume-disks-in-whole-backing-chain.patch
2021-09-10 11:58:15 +00:00

65 lines
2.1 KiB
Diff

From 9b5f10282394b3f3e2a54791f51c3eb8d21c40ce Mon Sep 17 00:00:00 2001
Message-Id: <9b5f10282394b3f3e2a54791f51c3eb8d21c40ce@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Feb 2020 15:10:01 +0100
Subject: [PATCH] virDomainDiskTranslateSourcePool: Translate 'volume' disks in
whole backing chain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now that we accept full backing chains on input nothing should prevent
users from also using disk type 'VOLUME' for specifying the backing
images.
Do the translation for the whole backing chain.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 37f01262eed9f37dd5eb7de8b83edd2fea741054)
https://bugzilla.redhat.com/show_bug.cgi?id=1804603
Message-Id: <68818efffb0a38e33237e0db9a2b370cef3b6eaa.1582120424.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ecd00aa8fc..b46b92aecf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31407,18 +31407,20 @@ int
virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
{
g_autoptr(virConnect) conn = NULL;
+ virStorageSourcePtr n;
- if (def->src->type != VIR_STORAGE_TYPE_VOLUME)
- return 0;
+ for (n = def->src; virStorageSourceIsBacking(n); n = n->backingStore) {
+ if (n->type != VIR_STORAGE_TYPE_VOLUME || !n->srcpool)
+ continue;
- if (!def->src->srcpool)
- return 0;
+ if (!conn) {
+ if (!(conn = virGetConnectStorage()))
+ return -1;
+ }
- if (!(conn = virGetConnectStorage()))
- return -1;
-
- if (virDomainStorageSourceTranslateSourcePool(def->src, conn) < 0)
- return -1;
+ if (virDomainStorageSourceTranslateSourcePool(n, conn) < 0)
+ return -1;
+ }
if (def->startupPolicy != 0 &&
virStorageSourceGetActualType(def->src) != VIR_STORAGE_VOL_FILE) {
--
2.25.0