Re: [PATCH v2 05/21] conf: add support for parsing/formatting virNWFilterBindingDefPtr

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

 




On 05/15/2018 01:43 PM, Daniel P. Berrangé wrote:
> A typical XML representation of the virNWFilterBindingDefPtr struct
> looks like this:
> 
>   <filterbinding>
>     <owner>
>       <name>f25arm7</name>
>       <uuid>12ac8b8c-4f23-4248-ae42-fdcd50c400fd</uuid>
>     </owner>
>     <portdev name='vnet1'/>
>     <mac address='52:54:00:9d:81:b1'/>
>     <filterref filter='clean-traffic'>
>       <parameter name='MAC' value='52:54:00:9d:81:b1'/>
>     </filterref>
>   </filterbinding>
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/conf/virnwfilterbindingdef.c              | 196 ++++++++++++++++++
>  src/conf/virnwfilterbindingdef.h              |  18 ++
>  src/libvirt_private.syms                      |   5 +
>  tests/Makefile.am                             |   7 +
>  .../filter-vars.xml                           |  11 +
>  .../virnwfilterbindingxml2xmldata/simple.xml  |   9 +
>  tests/virnwfilterbindingxml2xmltest.c         | 113 ++++++++++
>  7 files changed, 359 insertions(+)
>  create mode 100644 tests/virnwfilterbindingxml2xmldata/filter-vars.xml
>  create mode 100644 tests/virnwfilterbindingxml2xmldata/simple.xml
>  create mode 100644 tests/virnwfilterbindingxml2xmltest.c
> 

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

FWIW: 1 nit...

> diff --git a/src/conf/virnwfilterbindingdef.c b/src/conf/virnwfilterbindingdef.c
> index c7533d4063..23c040ab05 100644
> --- a/src/conf/virnwfilterbindingdef.c
> +++ b/src/conf/virnwfilterbindingdef.c

[...]

> +
> +
> +virNWFilterBindingDefPtr
> +virNWFilterBindingDefParseFile(const char *filename)
> +{
> +    return virNWFilterBindingDefParse(NULL, filename);
> +}
> +

2 blank lines

> +char *
> +virNWFilterBindingDefFormat(const virNWFilterBindingDef *def)
> +{
> +    virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> +    if (virNWFilterBindingDefFormatBuf(&buf, def) < 0) {
> +        virBufferFreeAndReset(&buf);
> +        return NULL;
> +    }
> +
> +    if (virBufferCheckError(&buf) < 0)
> +        return NULL;
> +
> +    return virBufferContentAndReset(&buf);
> +}

[...]

--
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]

  Powered by Linux