
On Thu, Mar 06, 2025 at 03:43:18PM +0100, Peter Krempa wrote:
On Tue, Mar 04, 2025 at 14:04:06 +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@redhat.com> --- include/libvirt/libvirt-domain.h | 123 +++++++++++++++++++++++++++++++ src/libvirt-domain.c | 44 +++-------- src/qemu/qemu_driver.c | 44 +++++++---- 3 files changed, 166 insertions(+), 45 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 6c86ad566f..78bc053151 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12253,43 +12253,23 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * * VIR_DOMAIN_STATS_VCPU: * Return virtual CPU statistics. - * Due to VCPU hotplug, the vcpu.<num>.* array could be sparse.
[...]
- * This group of statistics also reports additional hypervisor-originating - * per-vCPU stats. The hypervisor-specific statistics in this group have the - * following naming scheme: + * This group of statistics also reports additional hypervisor-originating + * per-vCPU stats. The hypervisor-specific statistics in this group have the + * following naming scheme:
The alignment of this hunk is off by 1.
I'm not sure I see the problem here. This is aligned at 4-spaces which matches the surrounding code, and looks to render ok to me. 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 :|