[libvirt] [PATCHv2 09/11] qemu: bulk stats: implement interface group

Eric Blake eblake at redhat.com
Tue Sep 2 23:05:27 UTC 2014


On 09/02/2014 06:31 AM, 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                | 13 +++++++
>  src/qemu/qemu_driver.c       | 85 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 99 insertions(+)
> 

>   *
> + * VIR_DOMAIN_STATS_INTERFACE: Return network interface statistics.
> + * The typed parameter keys are in this format:
> + * "net.count" - number of network interfaces on this domain.
> + * "net.<num>.name" - name of the interface <num>.
> + * "net.<num>.rx.bytes" - bytes received.
> + * "net.<num>.rx.pkts" - packets received.
> + * "net.<num>.rx.errs" - receive errors.
> + * "net.<num>.rx.drop" - receive packets dropped.
> + * "net.<num>.tx.bytes" - bytes transmitted.
> + * "net.<num>.tx.pkts" - packets transmitted.
> + * "net.<num>.tx.errs" - transmission errors.
> + * "net.<num>.tx.drop" - transmit packets dropped.

Missing types.

>  
> +#define QEMU_ADD_COUNT_PARAM(RECORD, MAXPARAMS, TYPE, COUNT) \
> +do { \
> +    char param_name[NAME_MAX]; \

NAME_MAX is oversized.

> +    snprintf(param_name, NAME_MAX, "%s.count", TYPE); \
> +    if (virTypedParamsAddUInt(&RECORD->params, \

For safety, I'd write $(RECORD)->params, and so forth.

ALL_CAPS macro parameter names are unusual; it is sufficient that the
macro name is all caps.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140902/99c31d67/attachment-0001.sig>


More information about the libvir-list mailing list