]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lib: Introduce API for retrieving bulk domain stats
authorPeter Krempa <pkrempa@redhat.com>
Tue, 26 Aug 2014 19:11:42 +0000 (21:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 26 Aug 2014 20:46:12 +0000 (22:46 +0200)
commit76a5bc4eef9f60ef73f5e0b272f4e0a5270e31de
tree6c55e38847af62a7483a2745ca527de89b79bc5d
parent27a20b6c1a78c43f9706989c7efe1d3acb853868
lib: Introduce API for retrieving bulk domain stats

The motivation for this API is that management layers that use libvirt
usually poll for statistics using various split up APIs we currently
provide. To get all the necessary stuff, the app needs to issue a lot of
calls and aggregate the results.

The APIs I'm introducing here:
1) Returns data in a format that we can expand in the future and is
(pseudo) hierarchical. The data is returned as typed parameters where
the fields are constructed as dot-separated strings containing names and
other stuff in a list of typed params.

2) Stats for multiple (all) domains can be queried at once and are
returned in one call. This will decrease the overhead necessary to issue
multiple calls per domain multiplied by the count of domains.

3) Selectable (bit mask) fields in the returned format. This will allow
to retrieve only specific stats according to the app's need.

The stats groups will be enabled using a bit field @stats passed as the
function argument. A few sample stats groups that this API will support:

VIR_DOMAIN_STATS_STATE
VIR_DOMAIN_STATS_CPU
VIR_DOMAIN_STATS_BLOCK
VIR_DOMAIN_STATS_INTERFACE

(Note that this is only an example, the initial implementation supports
 only VIR_DOMAIN_STATS_STATE while others will be added later.)

the returned typed params will use the following scheme

state.state = VIR_DOMAIN_RUNNING
state.reason = VIR_DOMAIN_RUNNING_BOOTED (the actual values according to
                                          the enum)
cpu.count = 8
cpu.0.state = running
cpu.0.time = 1234
include/libvirt/libvirt.h.in
src/driver.h
src/libvirt.c
src/libvirt_public.syms