• P
    lib: Introduce API for retrieving bulk domain stats · 76a5bc4e
    Peter Krempa 提交于
    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
    76a5bc4e
libvirt.c 643.5 KB