Bug 1330940

Summary: RFE: virsh: domblkinfo option to output human readable byte values
Product: [Community] Virtualization Tools Reporter: Michael Liu <ztehypervisor>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, dyuan, fjin, mprivozn, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-02 07:43:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael Liu 2016-04-27 10:53:24 UTC
Version-Release number of selected component (if applicable):
libvirt 1.2.21

virsh domblkinfo 64 vda 
Capacity:       214748364800
Allocation:     494080
Physical:       182910976

  virsh blkdeviotune shows values in raw bytes, which is  difficult to read. it show add a parameter like -h to show the values in megabytes or gigabytes.

Comment 1 Michal Privoznik 2017-05-02 07:43:05 UTC
I've just pushed patch upstream:

commit 4b9af8625a642339526b47eff718fab12c4b7cea
Author:     Julio Faracco <jcfaracco>
AuthorDate: Mon May 1 19:35:55 2017 -0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Tue May 2 09:36:31 2017 +0200

    virsh-domain-monitor: add human readable output for 'domblkinfo'.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1330940
    
    The virsh command 'domblkinfo' returns the capacity, allocation and phisycal
    size of the devices attached in a domain. Usually, this sizes are very big
    and hard to understand and calculate. This commits introduce a human readable
    support to check the size of each field easilly.
    
    For example, the command before:
    
    virsh # domblkinfo my_domain hda
    Capacity:       21474836480
    Allocation:     14875545600
    Physical:       21474836480
    
    and after this patch:
    
    virsh # domblkinfo my_domain hda --human
    Capacity:       20.000G
    Allocation:     13.900G
    Physical:       20.000G
    
    Signed-off-by: Julio Faracco <jcfaracco>
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Michal Privoznik <mprivozn>