From: Andrea Bolognani Date: Thu, 9 Jun 2022 17:26:16 +0000 (+0200) Subject: conf: Fix virDomainDefOSValidate() X-Git-Tag: v8.5.0-rc1~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58805f3aced027a8105d30ae3aaff3ff783be235;p=thirdparty%2Flibvirt.git conf: Fix virDomainDefOSValidate() Even when the os.loader element is absent, we still have to validate that the user is not attempting to use firmware autoselection with a driver that doesn't implement the feature. Signed-off-by: Andrea Bolognani Reviewed-by: Ján Tomko --- diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 10fb490e3c..33b6f47159 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1598,9 +1598,6 @@ static int virDomainDefOSValidate(const virDomainDef *def, virDomainXMLOption *xmlopt) { - if (!def->os.loader) - return 0; - if (def->os.firmware && !(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT)) { virReportError(VIR_ERR_XML_DETAIL, "%s", @@ -1608,6 +1605,9 @@ virDomainDefOSValidate(const virDomainDef *def, return -1; } + if (!def->os.loader) + return 0; + if (!def->os.loader->path && def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { virReportError(VIR_ERR_XML_DETAIL, "%s",