[2/2] conf: Fix VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT validation

Message ID b3332b4ec6d9222eb01dd0154245b9bebaef1901.1555512763.git.crobinso@redhat.com
State New
Headers show
Series
  • conf: DEF_FEATURE tweaks
Related show

Commit Message

Cole Robinson April 17, 2019, 2:57 p.m.
The check shouldn't be dependent on whether os->loader is set. Fix it,
and add the XML feature to vmx.c which would start failing

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/conf/domain_conf.c | 6 ++----
 src/vmx/vmx.c          | 3 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 51aa48f421..7c4a1ff7fa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6815,9 +6815,6 @@  static int
 virDomainDefOSValidate(const virDomainDef *def,
                        virDomainXMLOptionPtr 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",
@@ -6825,7 +6822,8 @@  virDomainDefOSValidate(const virDomainDef *def,
         return -1;
     }
 
-    if (!def->os.loader->path &&
+    if (def->os.loader &&
+        !def->os.loader->path &&
         def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) {
         virReportError(VIR_ERR_XML_DETAIL, "%s",
                        _("no loader path specified and firmware auto selection disabled"));
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 35b83a2320..82418ceca2 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -555,7 +555,8 @@  static virDomainDefParserConfig virVMXDomainDefParserConfig = {
     .domainPostParseCallback = virVMXDomainDefPostParse,
     .features = (VIR_DOMAIN_DEF_FEATURE_WIDE_SCSI |
                  VIR_DOMAIN_DEF_FEATURE_NAME_SLASH |
-                 VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER),
+                 VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER |
+                 VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT),
 };
 
 struct virVMXDomainDefNamespaceData {