[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 03/17] virDomainHostdevSubsysSCSIHostDefParseXML: Switch to a more modern XML parsing approach



On a Friday in 2020, Peter Krempa wrote:
Use XPath instead of iterating through the nodes.

Signed-off-by: Peter Krempa <pkrempa redhat com>
---
src/conf/domain_conf.c | 98 +++++++++++++++---------------------------
1 file changed, 35 insertions(+), 63 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ae7cb1e1c5..05c2c63f58 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c

[...]

-                if (got_adapter) {
-                    virReportError(VIR_ERR_XML_ERROR, "%s",
-                                   _("more than one adapters is specified "
-                                     "for scsi hostdev source"));
-                    return -1;
-                }
-                if (!(scsihostsrc->adapter = virXMLPropString(cur, "name"))) {
-                    virReportError(VIR_ERR_XML_ERROR, "%s",
-                                   _("'adapter' must be specified for scsi hostdev source"));
-                    return -1;
-                }

[...]


-    if (!got_address || !got_adapter) {
+    if (!(scsihostsrc->adapter = virXPathString("string(./adapter/@name)", ctxt))) {
        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("'adapter' and 'address' must be specified for scsi "
-                         "hostdev source"));
+                       _("'adapter' name must be specified for scsi hostdev source"));
        return -1;
    }


You changed the error message for a missing adapter name.
Either split it out into a separate commit, or at least mention the
change in the commit message.

With that:
Reviewed-by: Ján Tomko <jtomko redhat com>

Jano

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]