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

Ján Tomko jtomko at redhat.com
Sat Sep 12 11:10:18 UTC 2020


On a Friday in 2020, Peter Krempa wrote:
>Use XPath instead of iterating through the nodes.
>
>Signed-off-by: Peter Krempa <pkrempa at 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 at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200912/186792b2/attachment-0001.sig>


More information about the libvir-list mailing list