render / rpms / libvirt

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