• E
    getstats: add new flag for block backing chain · 4bffafb2
    Eric Blake 提交于
    This patch introduces access to allocation information about
    a backing chain of a live domain.  While querying storage
    volumes for read-only disks could provide some of the details,
    we do NOT want to read() a file while qemu is writing it.
    Also, there is one case where we have to rely on qemu: when
    doing a block commit into a backing file, where that file is
    stored in qcow2 format on a host block device, we want to know
    the current highest write offset into that image, in order to
    know if the disk must be resized larger.  qemu-img does not
    (currently) show this information, and none of the earlier
    block APIs were extensible enough to expose it.  But
    virDomainListGetStats is perfect for the job!
    
    We don't need a new group of statistics, as the existing block
    group is sufficient.  On the other hand, as existing libvirt
    releases already report 1:1 mapping of block.count to <disk>
    devices, changing the array size could confuse older clients;
    and even with newer clients, the time and memory taken to
    report additional statistics is not always necessary (backing
    files are generally read-only except for block-commit, so while
    read statistics may change, sizing statistics will not).  So
    the choice here is to add a new flag that only newer callers
    will pass, when they are prepared for the additional information.
    
    This patch introduces the new API, but it will take more
    patches to get it implemented for qemu.
    
    * include/libvirt/libvirt-domain.h
    (VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING): New flag.
    * src/libvirt-domain.c (virConnectGetAllDomainStats): Document it,
    and add a new field when it is in use.
    * tools/virsh-domain-monitor.c (cmdDomstats): Use new flag.
    * tools/virsh.pod (domstats): Document it.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    4bffafb2
virsh.pod 169.9 KB