[PATCH v3 7/7] qemu_driver: Add calc_mode for dirtyrate statistics

Daniel P. Berrangé berrange at redhat.com
Mon Feb 14 11:29:38 UTC 2022


On Fri, Jan 28, 2022 at 03:35:54PM +0800, huangy81 at chinatelecom.cn wrote:
> From: Hyman Huang(黄勇) <huangy81 at chinatelecom.cn>
> 
> Add calc_mode for dirtyrate statistics retured by
> virsh domstats --dirtyrate api, also add vcpu dirtyrate
> if dirty-ring mode was used in last measurement.
> 
> Signed-off-by: Hyman Huang(黄勇) <huangy81 at chinatelecom.cn>
> ---
>  src/libvirt-domain.c         |  5 +++++
>  src/qemu/qemu_driver.c       | 14 ++++++++++++
>  src/qemu/qemu_monitor.h      | 10 +++++++++
>  src/qemu/qemu_monitor_json.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 81 insertions(+)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 4caa740..afc0c1b 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -11941,6 +11941,11 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
>   *     "dirtyrate.megabytes_per_second" - the calculated memory dirty rate in
>   *                                        MiB/s as long long. It is produced
>   *                                        only if the calc_status is measured.
> + *     "dirtyrate.calc_mode" - the calculation mode used last measurement as int,
> + *                             which is one of virDomainDirtyRateCalcMode enum.

Definitely don't do this. For any virTypedParameter API normal practice is
to use a string to expose the data, not the rather enum integer value.

This unusual approach is why you needed to add the internal enum def
to the public header file earlier.


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 :|




More information about the libvir-list mailing list