]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Fix virDomainDefOSValidate()
authorAndrea Bolognani <abologna@redhat.com>
Thu, 9 Jun 2022 17:26:16 +0000 (19:26 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 16 Jun 2022 13:27:16 +0000 (15:27 +0200)
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>
src/conf/domain_validate.c

index 10fb490e3c7caefc31748b6a2d25e163550f7784..33b6f471596b2b221ec4e59be471f020fda6e6c1 100644 (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",