This makes it explicit that there are two possible scenarios
(whether or not firmware autoselection is in use) and will make
upcoming changes cleaner to implement.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_validate.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 33b6f47159..1f6c32a816 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -1598,21 +1598,23 @@ static int
virDomainDefOSValidate(const virDomainDef *def,
virDomainXMLOption *xmlopt)
{
- if (def->os.firmware &&
- !(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT)) {
- virReportError(VIR_ERR_XML_DETAIL, "%s",
- _("firmware auto selection not implemented for this
driver"));
- return -1;
- }
+ virDomainLoaderDef *loader = def->os.loader;
- if (!def->os.loader)
- return 0;
+ if (def->os.firmware) {
+ if (!(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT)) {
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("firmware auto selection not implemented for this
driver"));
+ return -1;
+ }
+ } else {
+ if (!loader)
+ return 0;
- if (!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"));
- return -1;
+ if (!loader->path) {
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("no loader path specified and firmware auto selection
disabled"));
+ return -1;
+ }
}
return 0;
--
2.35.3