Bug 731656 - virsh: the results of domblkstat is unreadable for user
Summary: virsh: the results of domblkstat is unreadable for user
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Linux
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2011-08-18 09:00 UTC by Nan Zhang
Modified: 2013-03-22 08:42 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Clone Of:
Last Closed: 2012-06-20 06:30:13 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Nan Zhang 2011-08-18 09:00:14 UTC
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):

How reproducible:

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:

Comment 2 Dave Allan 2011-08-22 16:45:11 UTC
IMO the correct fix here is to document the meanings of the fields in virsh help domblkstat and the virsh manpage.

Comment 3 Peter Krempa 2011-09-19 23:55:12 UTC
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
    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:
    virsh # domblkstat 1 vda
    vda wr_bytes 5170176
    vda wr_operations 511
    vda rd_bytes 82815488
    vda rd_operations 3726
    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

Comment 6 yuping zhang 2012-01-10 02:48:16 UTC
Reproduce thiss issue with libvirt-0.9.4-23.el6.
Verified it with:

1.Add "--human" flag
# virsh help domblkstat
    domblkstat - get device block stats for a domain

    domblkstat <domain> <device> [--human]

    Get device block stats for a running domain. See man page or use --human for explanation of fields

    [--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 -->

# 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.

Comment 8 Peter Krempa 2012-05-02 09:48:34 UTC
    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

Comment 10 errata-xmlrpc 2012-06-20 06:30:13 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.