render / rpms / libvirt

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