Currently we're simply ignoring some elements and attributes,
such as the loader path, when firmware autoselection is enabled
because we know we're not going to use them.
This makes sense, but has the unfortunate consequence of
confusing users who experience part of their configuration
simply going away for no apparent reason.
A more user-friendly approach is to produce meaningful error
messages in those scenarios. As a first step towards that goal,
stop conditionally parsing information.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_conf.c | 38 +++++++++++++++-----------------------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c6504348c..7947b1f5e6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18018,8 +18018,7 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader,
xmlNodePtr nvramSourceNode,
xmlXPathContextPtr ctxt,
virDomainXMLOption *xmlopt,
- unsigned int flags,
- bool fwAutoSelect)
+ unsigned int flags)
{
g_autoptr(virStorageSource) src = virStorageSourceNew();
int typePresent;
@@ -18027,8 +18026,7 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader,
if (!nvramNode)
return 0;
- if (!fwAutoSelect)
- loader->nvramTemplate = virXMLPropString(nvramNode, "template");
+ loader->nvramTemplate = virXMLPropString(nvramNode, "template");
src->format = VIR_STORAGE_FILE_RAW;
@@ -18070,33 +18068,29 @@ virDomainLoaderDefParseXML(virDomainLoaderDef *loader,
xmlNodePtr nvramSourceNode,
xmlXPathContextPtr ctxt,
virDomainXMLOption *xmlopt,
- unsigned int flags,
- bool fwAutoSelect)
+ unsigned int flags)
{
if (virDomainLoaderDefParseXMLNvram(loader,
nvramNode, nvramSourceNode,
- ctxt, xmlopt, flags,
- fwAutoSelect) < 0)
+ ctxt, xmlopt, flags) < 0)
return -1;
if (!loaderNode)
return 0;
- if (!fwAutoSelect) {
- if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NONE,
- &loader->readonly) < 0)
- return -1;
+ if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NONE,
+ &loader->readonly) < 0)
+ return -1;
- if (virXMLPropEnum(loaderNode, "type", virDomainLoaderTypeFromString,
- VIR_XML_PROP_NONZERO, &loader->type) < 0)
- return -1;
+ if (virXMLPropEnum(loaderNode, "type", virDomainLoaderTypeFromString,
+ VIR_XML_PROP_NONZERO, &loader->type) < 0)
+ return -1;
- if (!(loader->path = virXMLNodeContentString(loaderNode)))
- return -1;
+ if (!(loader->path = virXMLNodeContentString(loaderNode)))
+ return -1;
- if (STREQ(loader->path, ""))
- VIR_FREE(loader->path);
- }
+ if (STREQ(loader->path, ""))
+ VIR_FREE(loader->path);
if (virXMLPropTristateBool(loaderNode, "secure", VIR_XML_PROP_NONE,
&loader->secure) < 0)
@@ -18498,7 +18492,6 @@ virDomainDefParseBootLoaderOptions(virDomainDef *def,
xmlNodePtr loaderNode = virXPathNode("./os/loader[1]", ctxt);
xmlNodePtr nvramNode = virXPathNode("./os/nvram[1]", ctxt);
xmlNodePtr nvramSourceNode = virXPathNode("./os/nvram/source[1]", ctxt);
- const bool fwAutoSelect = def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_NONE;
if (!loaderNode && !nvramNode)
return 0;
@@ -18507,8 +18500,7 @@ virDomainDefParseBootLoaderOptions(virDomainDef *def,
if (virDomainLoaderDefParseXML(def->os.loader,
loaderNode, nvramNode, nvramSourceNode,
- ctxt, xmlopt, flags,
- fwAutoSelect) < 0)
+ ctxt, xmlopt, flags) < 0)
return -1;
return 0;
--
2.35.3