[libvirt] [PATCHv4 5/8] qemu: bulk stats: implement interface group
Peter Krempa
pkrempa at redhat.com
Fri Sep 12 13:20:25 UTC 2014
On 09/12/14 13:48, Francesco Romani wrote:
> This patch implements the VIR_DOMAIN_STATS_INTERFACE
> group of statistics.
>
> Signed-off-by: Francesco Romani <fromani at redhat.com>
> ---
> include/libvirt/libvirt.h.in | 1 +
> src/libvirt.c | 14 +++++++
> src/qemu/qemu_driver.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 102 insertions(+)
>
> +
> +static int
> +qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
> + virDomainObjPtr dom,
> + virDomainStatsRecordPtr record,
> + int *maxparams,
> + unsigned int privflags ATTRIBUTE_UNUSED)
> +{
> + size_t i;
> + struct _virDomainInterfaceStats tmp;
> +
> + QEMU_ADD_COUNT_PARAM(record, maxparams, "net", dom->def->nnets);
> +
> + /* Check the path is one of the domain's network interfaces. */
> + for (i = 0; i < dom->def->nnets; i++) {
> + memset(&tmp, 0, sizeof(tmp));
> +
> + if (virNetInterfaceStats(dom->def->nets[i]->ifname, &tmp) < 0)
Again, reset the error as it's ignored.
> + continue;
> +
> + QEMU_ADD_NAME_PARAM(record, maxparams,
> + "net", i, dom->def->nets[i]->ifname);
> +
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "rx.bytes", tmp.rx_bytes);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "rx.pkts", tmp.rx_packets);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "rx.errs", tmp.rx_errs);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "rx.drop", tmp.rx_drop);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "tx.bytes", tmp.tx_bytes);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "tx.pkts", tmp.tx_packets);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "tx.errs", tmp.tx_errs);
> + QEMU_ADD_NET_PARAM(record, maxparams, i,
> + "tx.drop", tmp.tx_drop);
> + }
> +
> + return 0;
> +}
> +
> +#undef QEMU_ADD_NET_PARAM
> +
> +#undef QEMU_ADD_NAME_PARAM
> +
> +#undef QEMU_ADD_COUNT_PARAM
>
> typedef int
> (*qemuDomainGetStatsFunc)(virQEMUDriverPtr driver,
ACK otherwise.
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140912/21981c6b/attachment-0001.sig>
More information about the libvir-list
mailing list