[libvirt] [PATCHv2 3/5] conf: output forward device connections count in network XML

Kyle Mestery (kmestery) kmestery at cisco.com
Tue Aug 14 15:25:14 UTC 2012


Looks good to me.

Acked-by: Kyle Mestery <kmestery at cisco.com>

On Aug 14, 2012, at 2:10 AM, Laine Stump wrote:

> It may be useful for management applications to know which physical
> network devices are in use by guests. This information is already
> available in the network objects, but wasn't output in the XML. This
> patch outputs it whan the INACTIVE flag isn't set (and if it's non-0).
> ---
> src/conf/network_conf.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index 905c644..ca5b759 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -1495,8 +1495,14 @@ char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags)
>         if (def->nForwardIfs &&
>             (!def->nForwardPfs || !(flags & VIR_NETWORK_XML_INACTIVE))) {
>             for (ii = 0; ii < def->nForwardIfs; ii++) {
> -                virBufferEscapeString(&buf, "    <interface dev='%s'/>\n",
> +                virBufferEscapeString(&buf, "    <interface dev='%s'",
>                                       def->forwardIfs[ii].dev);
> +                if (!(flags & VIR_NETWORK_XML_INACTIVE) &&
> +                    (def->forwardIfs[ii].connections > 0)) {
> +                    virBufferAsprintf(&buf, " connections='%d'",
> +                                      def->forwardIfs[ii].connections);
> +                }
> +                virBufferAddLit(&buf, "/>\n");
>             }
>         }
>         if (def->nForwardPfs || def->nForwardIfs)
> -- 
> 1.7.11.2
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list





More information about the libvir-list mailing list