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 <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-06-09 19:26:16 +02:00
parent 69464f4280
commit 58805f3ace

View File

@ -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",