Red Hat Bugzilla – Bug 731656
virsh: the results of domblkstat is unreadable for user
Last modified: 2013-03-22 04:42:01 EDT
Description of problem: the results of virsh command 'domblkstat' is unreadable for user, since its directly copy from below the name of variables within the structure, people is hard to read the meanings. struct _virDomainBlockStats { long long rd_req; /* number of read requests */ long long rd_bytes; /* number of read bytes */ long long wr_req; /* number of write requests */ long long wr_bytes; /* number of written bytes */ long long flush_req; /* number of flushed bytes */ long long errs; /* In Xen this returns the mysterious 'oo_req'. */ }; Version-Release number of selected component (if applicable): libvirt-0.9.4-4.el6.x86_64 How reproducible: always Steps to Reproduce: # virsh start foo-new Domain foo-new started # virsh domblkstat foo-new vda vda rd_req 866 vda rd_bytes 19895296 vda wr_req 0 vda wr_bytes 0 vda errs 0 Actual results: vda rd_req 866 vda rd_bytes 19895296 vda wr_req 0 vda wr_bytes 0 vda errs 0 Expected results: block device: vda number of read requests: 886 number of read bytes: 19895296 number of write requests: 0 number of written bytes: 0 Additional info:
IMO the correct fix here is to document the meanings of the fields in virsh help domblkstat and the virsh manpage.
fixed with upstream commit: commit 619077b9ebca92e079bde4eaf66a5d504d198651 Author: Peter Krempa <pkrempa@redhat.com> Date: Mon Sep 19 14:23:12 2011 +0200 virsh: Add more human-friendly output of domblkstat command Users of virsh complain that output of the domblkstat command is not intuitive enough. This patch adds explanation of fields returned by this command to the help section for domblkstat and the man page of virsh. Also a switch --human is added for domblkstat that prints the fields with more descriptive texts. This patch also changes sequence of the output fields and their names back to the order and spelling established by previous versions of virsh to maintain compatibility with scripts. Example of ordered and "translated" output: PRE-patch: virsh # domblkstat 1 vda vda wr_bytes 5170176 vda wr_operations 511 vda rd_bytes 82815488 vda rd_operations 3726 POST-patch: virsh # domblkstat 1 vda vda rd_req 3726 vda rd_bytes 82815488 vda wr_req 478 vda wr_bytes 4965376 Example of human readable output: virsh # domblkstat 1 vda --human Device: vda number of read operations: 3726 number of read bytes: 82815488 number of write operations: 478 number of bytes written: 4965376
Reproduce thiss issue with libvirt-0.9.4-23.el6. Verified it with: libvirt-client-0.9.9-1.el6.x86_64 libvirt-0.9.9-1.el6.x86_64 libvirt-python-0.9.9-1.el6.x86_64 Steps: 1.Add "--human" flag # virsh help domblkstat NAME domblkstat - get device block stats for a domain SYNOPSIS domblkstat <domain> <device> [--human] DESCRIPTION Get device block stats for a running domain. See man page or use --human for explanation of fields OPTIONS [--domain] <string> domain name, id or uuid [--device] <string> block device --human print a more human readable output 2.#man virsh ... domblkstat domain block-device [--human] Get device block stats for a running domain. A block-device corresponds to a unique target name (<target dev=’name’/>) or source file (<source file=’name’/>) for one of the disk devices attached to domain (see also domblklist for listing these names). Use --human for a more human readable output. Availability of these fields depends on hypervisor. Unsupported fields are missing from the output. Other fields may appear if communicating with a newer version of libvirtd. Explanation of fields (fields appear in the folowing order): rd_req - count of read operations rd_bytes - count of read bytes wr_req - count of write operations wr_bytes - count of written bytes errs - error count flush_operations - count of flush operations rd_total_times - total time read operations took (ns) wr_total_times - total time write operations took (ns) flush_total_times - total time flush operations took (ns) <-- other fields provided by hypervisor --> .... 3. # virsh domblkstat 2 vda --human Device: vda number of read operations: 5831 number of bytes read: 228745728 number of write operations: 3078 number of bytes written: 41001984 number of flush operations: 0 So change the bug status to VERIFIED.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: No Documentation needed
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0748.html