From 37f01262eed9f37dd5eb7de8b83edd2fea741054 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 5 Feb 2020 13:05:05 +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 Reviewed-by: Ján Tomko --- 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 0adccbdf6f..de74a2a2d5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31562,18 +31562,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) {