From: Laine Stump Date: Sun, 5 Aug 2012 06:59:55 +0000 (-0400) Subject: conf: output forward device connections count in network XML X-Git-Tag: v0.10.0-rc1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92a830408124c85f54a2222465a2e9a0ebff9d7e;p=thirdparty%2Flibvirt.git conf: output forward device connections count in network XML 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 when the INACTIVE flag isn't set (and if it's non-0). --- diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 905c644d58..ca5b759c5d 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, " \n", + virBufferEscapeString(&buf, " 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)