Re: [PATCH v2 4/4] conf: Parse more of our nodedev XML

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

 



On Wed, 2016-04-13 at 16:37 +0200, Martin Kletzander wrote:
> We were lacking tests that are checking for the completeness of our
> nodedev XMLs and also whether we output properly formatted ones.  This
> patch adds parsing for the capability elements inside the <capability
> type='pci'> element.  Also bunch of tests are added to show everything
> works properly.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/conf/node_device_conf.c | 98 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/nodedevxml2xmltest.c  |  7 ++++
>  2 files changed, 105 insertions(+)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index b6e2f82727d0..5a41f7e0d2cc 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -1269,15 +1269,103 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,
> 
> 
>  static int
> +virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
> +                                xmlNodePtr node,
> +                                virNodeDevCapDataPtr data)
> +{
> +    char *maxFuncsStr = virXMLPropString(node, "maxCount");

maxCountStr?

> +    char *type = virXMLPropString(node, "type");

typeStr?

> @@ -1321,6 +1409,15 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
>      data->pci_dev.vendor_name  = virXPathString("string(./vendor[1])", ctxt);
>      data->pci_dev.product_name = virXPathString("string(./product[1])", ctxt);
> 
> +    if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
> +        goto out;
> +
> +    for (i = 0; i < n; i++) {
> +        if (virNodeDevPCICapabilityParseXML(ctxt, nodes[i], data) < 0)
> +            goto out;
> +    }
> +    VIR_FREE(nodes);

This shouldn't be necessary as you free the memory in the
out path anyway.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]