[libvirt] [PATCH] Allow custom metadata in network configuration XML

Peter Krempa pkrempa at redhat.com
Fri Jun 24 11:01:11 UTC 2016


On Wed, Jun 22, 2016 at 16:05:50 -0600, Brnadon Bennett wrote:
> From: Brandon Bennett <bbennett at fb.com>
> 
>     This replicates the metadata field found in the domain configuration
>     and adds it to the network configuration XML.

Just a few notes before Laine pushes the patch:

> ---
>  docs/formatnetwork.html.in           | 13 +++++++++++++
>  docs/schemas/basictypes.rng          | 23 +++++++++++++++++++++++
>  docs/schemas/domaincommon.rng        | 23 -----------------------
>  docs/schemas/network.rng             |  5 +++++
>  src/conf/network_conf.c              | 35 ++++++++++++++++++++++++++++++++++-
>  src/conf/network_conf.h              |  3 +++
>  tests/networkxml2xmlin/metadata.xml  | 10 ++++++++++
>  tests/networkxml2xmlout/metadata.xml | 10 ++++++++++
>  tests/networkxml2xmltest.c           |  1 +
>  9 files changed, 99 insertions(+), 24 deletions(-)
>  create mode 100644 tests/networkxml2xmlin/metadata.xml
>  create mode 100644 tests/networkxml2xmlout/metadata.xml
> 
> diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
> index 1cea931..15ebf0c 100644
> --- a/docs/formatnetwork.html.in
> +++ b/docs/formatnetwork.html.in

[...]

> @@ -73,6 +83,9 @@
>          override the setting in the network.</dd>
>      </dl>
> 
> ++
> +
> +

Spurious whitespace.

>      <h3><a name="elementsConnect">Connectivity</a></h3>
> 
>      <p>
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index 02b8cd7..4239c32 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c

[...]

> @@ -2388,8 +2392,12 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
>          }
>          break;
>      }
> -

Again, this isn't necessary.

>      VIR_FREE(stp);
> +
> +    /* Extract custom metadata */
> +    if ((metadataNode = virXPathNode("./metadata[1]", ctxt)) != NULL)
> +        def->metadata = xmlCopyNode(metadataNode, 1);

Domain metadata code explicitly rejects duplicate entries. I
think this should be used here too.

> +
>      ctxt->node = save;
>      return def;

Rest looks good to me.

Peter




More information about the libvir-list mailing list