[PATCH 15/43] conf: node_device: Use 'string()' in XPath expressions for virNodeDevCapsDefParseIntOptional

Peter Krempa posted 43 patches 3 years, 3 months ago
[PATCH 15/43] conf: node_device: Use 'string()' in XPath expressions for virNodeDevCapsDefParseIntOptional
Posted by Peter Krempa 3 years, 3 months ago
Upcoming patches will require that the XML XPath query returns a string
for conversion in virXPathInt. Convert all the XPaths used with
virNodeDevCapsDefParseIntOptional which uses virXPathInt internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/node_device_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 1e798651c5..9d04c5fdf4 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1623,7 +1623,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt,
         }
         /* Optional unique_id value */
         scsi_host->unique_id = -1;
-        if (virNodeDevCapsDefParseIntOptional("number(./unique_id[1])", ctxt,
+        if (virNodeDevCapsDefParseIntOptional("string(./unique_id[1])", ctxt,
                                               &scsi_host->unique_id, def,
                                               _("invalid unique_id supplied for '%s'")) < 0) {
             return -1;
@@ -2140,7 +2140,7 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,

     /* The default value is -1 since zero is valid NUMA node number */
     pci_dev->numa_node = -1;
-    if (virNodeDevCapsDefParseIntOptional("number(./numa[1]/@node)", ctxt,
+    if (virNodeDevCapsDefParseIntOptional("string(./numa[1]/@node)", ctxt,
                                           &pci_dev->numa_node, def,
                                           _("invalid NUMA node ID supplied for '%s'")) < 0)
         goto out;
-- 
2.37.3
Re: [PATCH 15/43] conf: node_device: Use 'string()' in XPath expressions for virNodeDevCapsDefParseIntOptional
Posted by Ján Tomko 3 years, 3 months ago
On a Monday in 2022, Peter Krempa wrote:
>Upcoming patches will require that the XML XPath query returns a string
>for conversion in virXPathInt. Convert all the XPaths used with
>virNodeDevCapsDefParseIntOptional which uses virXPathInt internally.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/node_device_conf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano