• J
    util: Introduce virStorageSourceUpdatePhysicalSize · c5f61513
    John Ferlan 提交于
    Commit id '8dc27259' introduced virStorageSourceUpdateBlockPhysicalSize
    in order to retrieve the physical size for a block backed source device
    for an active domain since commit id '15fa84ac' changed to use the
    qemuMonitorGetAllBlockStatsInfo and qemuMonitorBlockStatsUpdateCapacity
    API's to (essentially) retrieve the "actual-size" from a 'query-block'
    operation for the source device.
    
    However, the code only was made functional for a BLOCK backing type
    and it neglected to use qemuOpenFile, instead using just open. After
    the open the block lseek would find the end of the block and set the
    physical value, close the fd and return.
    
    Since the code would return 0 immediately if the source device wasn't
    a BLOCK backed device, the physical would be displayed incorrectly,
    such as follows in domblkinfo for a file backed source device:
    
    Capacity:       1073741824
    Allocation:     0
    Physical:       0
    
    This patch will modify the algorithm to get the physical size for other
    backing types and it will make use of the qemuDomainStorageOpenStat
    helper in order to open/stat the source file depending on its type.
    The qemuDomainGetStatsOneBlock will no longer inhibit printing errors,
    but it will still ignore them leaving the physical value set to 0.
    Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
    c5f61513
libvirt_private.syms 62.4 KB