On Thu, Mar 06, 2025 at 03:47:00PM +0100, Peter Krempa wrote:
On Tue, Mar 04, 2025 at 14:04:07 +0000, Daniel P. Berrangé wrote:
> Contrary to most APIs returning typed parameters, there are no constants
> defined for the domain stats data keys. This is was because many of the
> keys needs to be dynamically constructed using one or more array index
> values.
>
> It is possible to define constants while still supporting dynamic
> array indexes by simply defining the prefixes and suffixes as constants.
> The consuming code can then combine the constants with array index
> value.
>
> With this approach, it is practical to add constants for the domain stats
> API keys.
>
> Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
> ---
> include/libvirt/libvirt-domain.h | 102 +++++++++++++++++++++++++++++++
> src/libvirt-domain.c | 15 +----
> src/qemu/qemu_driver.c | 27 ++++----
> 3 files changed, 120 insertions(+), 24 deletions(-)
[...]
> +/**
> + * VIR_DOMAIN_STATS_NET_SUFFIX_TX_BYTES:
> + *
> + * Bytes transmitted as unsigned long long.
> + *
> + * Since: 11.2.0
> + */
> +#define VIR_DOMAIN_STATS_NET_SUFFIX_TX_BYTES ".tx.bytes"
> +
> +/**
> + * VIR_DOMAIN_STATS_NET_SUFFIX_TX_PKTS:
> + *
> + * Packets transmitted as unsigned long long.
> + *
> + * Since: 11.2.0
> + */
> +#define VIR_DOMAIN_STATS_NET_SUFFIX_TX_PKTS ".rx.pkts"
".tx.pkts"
Doh, I did a before & after comparison, but seems the guest I used had a
slirp NIC backend and so lacked these fields.
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
With regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|