|
|
459f93 |
From 2ea89fb18aa9d2dac1e651869736fede7a2ec434 Mon Sep 17 00:00:00 2001
|
|
|
459f93 |
Message-Id: <2ea89fb18aa9d2dac1e651869736fede7a2ec434@dist-git>
|
|
|
459f93 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
459f93 |
Date: Tue, 14 Jun 2022 14:21:33 +0200
|
|
|
459f93 |
Subject: [PATCH] virDomainDiskTranslateSourcePool: Fix check of
|
|
|
459f93 |
'startupPolicy' definition
|
|
|
459f93 |
MIME-Version: 1.0
|
|
|
459f93 |
Content-Type: text/plain; charset=UTF-8
|
|
|
459f93 |
Content-Transfer-Encoding: 8bit
|
|
|
459f93 |
|
|
|
459f93 |
The check was historically done only for _TYPE_VOLUME disks, but
|
|
|
459f93 |
refactors to allow _TYPE_VOLUME disks in the backing chain caused a
|
|
|
459f93 |
regression where we'd reject startupPolicy also for _TYPE_BLOCK disks
|
|
|
459f93 |
which historically worked well.
|
|
|
459f93 |
|
|
|
459f93 |
Fix it by using the 'virDomainDiskDefValidateStartupPolicy' helper and
|
|
|
459f93 |
use it only when the top level image is a _TYPE_VOLUME as in other cases
|
|
|
459f93 |
it was already validated. This also allows _TYPE_BLOCK volumes to use
|
|
|
459f93 |
startup policy.
|
|
|
459f93 |
|
|
|
459f93 |
Fixes: 37f01262eed9f37dd5eb7de8b83edd2fea741054
|
|
|
459f93 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2095758
|
|
|
459f93 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
459f93 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
459f93 |
(cherry picked from commit ed8984306e1cd44c424fda3ed412a4177dd7b84d)
|
|
|
459f93 |
---
|
|
|
459f93 |
src/conf/domain_conf.c | 12 ++++++------
|
|
|
459f93 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
459f93 |
|
|
|
459f93 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
459f93 |
index 805a15848e..92510973e6 100644
|
|
|
459f93 |
--- a/src/conf/domain_conf.c
|
|
|
459f93 |
+++ b/src/conf/domain_conf.c
|
|
|
459f93 |
@@ -31311,13 +31311,13 @@ virDomainDiskTranslateSourcePool(virDomainDiskDef *def)
|
|
|
459f93 |
|
|
|
459f93 |
if (virDomainStorageSourceTranslateSourcePool(n, conn) < 0)
|
|
|
459f93 |
return -1;
|
|
|
459f93 |
- }
|
|
|
459f93 |
|
|
|
459f93 |
- if (def->startupPolicy != 0 &&
|
|
|
459f93 |
- virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE) {
|
|
|
459f93 |
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
459f93 |
- _("'startupPolicy' is only valid for 'file' type volume"));
|
|
|
459f93 |
- return -1;
|
|
|
459f93 |
+ /* The validity of 'startupPolicy' setting is checked only for the top
|
|
|
459f93 |
+ * level image. For any other subsequent images we honour it only if
|
|
|
459f93 |
+ * possible */
|
|
|
459f93 |
+ if (n == def->src &&
|
|
|
459f93 |
+ virDomainDiskDefValidateStartupPolicy(def) < 0)
|
|
|
459f93 |
+ return -1;
|
|
|
459f93 |
}
|
|
|
459f93 |
|
|
|
459f93 |
return 0;
|
|
|
459f93 |
--
|
|
|
459f93 |
2.35.1
|
|
|
459f93 |
|