mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
src: add constants for guest info 'load.' parameters
Contrary to most APIs returning typed parameters, there are no constants defined for the guest info 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 guest info API keys. Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
9e725c1ccd
commit
325b5701ae
@ -6943,6 +6943,34 @@ int virDomainSetLaunchSecurityState(virDomainPtr domain,
|
||||
*/
|
||||
# define VIR_DOMAIN_GUEST_INFO_IF_SUFFIX_ADDR_SUFFIX_PREFIX ".prefix"
|
||||
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_GUEST_INFO_LOAD_1M:
|
||||
*
|
||||
* The guest load averaged over 1 minute as a double
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_GUEST_INFO_LOAD_1M "load.1m"
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_GUEST_INFO_LOAD_5M:
|
||||
*
|
||||
* The guest load averaged over 5 minutes as a double
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_GUEST_INFO_LOAD_5M "load.5m"
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_GUEST_INFO_LOAD_15M:
|
||||
*
|
||||
* The guest load averaged over 15 minutes as a double
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_GUEST_INFO_LOAD_15M "load.15m"
|
||||
|
||||
/**
|
||||
* virDomainGuestInfoTypes:
|
||||
*
|
||||
|
@ -13239,11 +13239,9 @@ virDomainSetVcpu(virDomainPtr domain,
|
||||
*
|
||||
* VIR_DOMAIN_GUEST_INFO_LOAD:
|
||||
* Returns load (the number of processes in the runqueue or waiting for disk
|
||||
* I/O) as double values:
|
||||
*
|
||||
* "load.1m" - load averaged over 1 minute
|
||||
* "load.5m" - load averaged over 5 minutes
|
||||
* "load.15m" - load averaged over 15 minutes
|
||||
* I/O).
|
||||
* The VIR_DOMAIN_GUEST_INFO_LOAD_* constants define the known typed parameter
|
||||
* keys.
|
||||
*
|
||||
* Using 0 for @types returns all information groups supported by the given
|
||||
* hypervisor.
|
||||
|
@ -19488,9 +19488,9 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (format_load) {
|
||||
virTypedParamListAddDouble(list, load1m, "load.1m");
|
||||
virTypedParamListAddDouble(list, load5m, "load.5m");
|
||||
virTypedParamListAddDouble(list, load15m, "load.15m");
|
||||
virTypedParamListAddDouble(list, load1m, VIR_DOMAIN_GUEST_INFO_LOAD_1M);
|
||||
virTypedParamListAddDouble(list, load5m, VIR_DOMAIN_GUEST_INFO_LOAD_5M);
|
||||
virTypedParamListAddDouble(list, load15m, VIR_DOMAIN_GUEST_INFO_LOAD_15M);
|
||||
}
|
||||
|
||||
if (virTypedParamListSteal(list, params, nparams) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user