From: Peter Krempa <[email protected]>

Historically the parser for the '<lease>' device type didn't require the
presence of '<lockspace>', although the schema requires it.

Commit 8d635a0bf24c refactored the parser and added a failure state if
the fetching of '<lockspace>' fails, including the case when it's
missing but didn't report an error, thus generating useless error
message.

Since the intention based on the docs, schema and implementation in the
daemons seems to require 'lockspace' add a proper error message.

Fixes: 8d635a0bf24cd1dabcbfc020b9a833a1d06d87a2
Signed-off-by: Peter Krempa <[email protected]>
---
 src/conf/domain_conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6375eecffb..262aeca26c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7381,8 +7381,11 @@ virDomainLeaseDefParseXML(xmlNodePtr node,
         goto error;
     }

-    if (!(lockspace = virXPathString("string(./lockspace)", ctxt)))
+    if (!(lockspace = virXPathString("string(./lockspace)", ctxt))) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("Missing 'lockspace' element for lease"));
         goto error;
+    }

     if (!(targetNode = virXPathNode("./target", ctxt))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
-- 
2.54.0

Reply via email to