RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1142636 - [REF] generate summary statistics of domblkstat for QEMU domain
Summary: [REF] generate summary statistics of domblkstat for QEMU domain
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-17 07:00 UTC by Jincheng Miao
Modified: 2015-11-19 05:47 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.14-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:47:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Jincheng Miao 2014-09-17 07:00:44 UTC
description of problem:
domblkstat reports wrong error message:
'Operation not supported: summary statistics are not supported yet'

In fact, if --device is specified, it could report summary statistics.

version:
libvirt-1.2.8-2.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64

How reproducible:
100%

step to reproduce:
1. start a guest
# virsh start r7a

2. execute domblkstat without additional arguments except domain name
# virsh domblkstat r7a
error: Operation not supported: summary statistics are not supported yet

3. but domblkstat is supported actually
# virsh domblkstat r7a vda
sda rd_req 5347
sda rd_bytes 107342848
sda wr_req 1291
sda wr_bytes 5609472
sda flush_operations 136
sda rd_total_times 26813113304
sda wr_total_times 3503441698
sda flush_total_times 3095714818

Expect result:
In step 2:
virsh said Operation not supported, but it should say:
error: command 'domblkstat' requires <device> option

Comment 1 Peter Krempa 2014-09-17 08:47:59 UTC
From man page:
On a lxc domain, omitting the block device yields device block stats summarily for the entire domain.

Qemu doesn't implement that one yet thus the message is correct.

Do you want to repurpose the bug as a feature request for adding summary statistics? Otherwise it's NOTABUG.

Comment 2 Jincheng Miao 2014-09-17 09:00:48 UTC
Hi Peter,

Yes, this should be a REF.

Because virsh help domblkstat doesn't talking about stats summarily
for the entire domain. domblkstat for domain maybe need do an
explicit way, like adding a '--sum' option to deal with it.

Finally mark '--device' as an optional argument.

Comment 3 Peter Krempa 2015-03-11 10:33:10 UTC
Fixed upstream:

commit d3534a43e6fcad7929593fe895b77aa342cf36fc
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 16:56:53 2015 +0100

    qemu: monitor: Kill qemuMonitorGetBlockStats(Info,ParamsNumber)
    
    The functions and their QMP and HMP implementations are no longer needed
    since everything is now done via the *AllStats functions.

commit 3a83dcf43e673bd07468b096061a47947ab3c0de
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 17:11:22 2015 +0100

    test: qemu: json: Avoid using the now obsolete functions
    
    Use the new single function instead of calling
    qemuMonitorJSONGetBlockStatsInfo and
    qemuMonitorJSONGetBlockStatsParamsNumber. This will allow to delete the
    functions later while still maintaining coverage.

commit e045587dda7ed145e9f9692a69a17d655ec6628d
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 16:52:08 2015 +0100

    qemu: blockstats: Refactor qemuDomainBlockStatsFlags
    
    Now that qemuDomainBlocksStatsGather provides functions of both
    qemuMonitorGetBlockStatsParamsNumber and qemuMonitorGetBlockStatsInfo we
    can reuse it and kill a lot of code.
    
    Additionally as a bonus qemuDomainBlockStatsFlags will now support
    summary statistics so add a statement to the virsh man page about that.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1142636

commit cf093414c55101960725e32f7e48a95ec78d2f4e
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 15:54:17 2015 +0100

    qemu: blockstats: Add support for totalled block statistics
    
    In the LXC driver, if the disk path is not provided the API returns
    total statistics for all disks of the domain. With the new text monitor
    implementation this can be now done in the qemu driver too.
    
    Add code that wil total the stats for all disks if the path is not
    provided.

commit 79966411cd7af4d42a2abcf7c2f4ea0220efd7a9
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 15:37:31 2015 +0100

    qemu: Split out working code qemuDomainBlockStats
    
    Extract the code to look up the disk alias and return the block stats
    struct so that it can be reused later in qemuDomainBlockStatsFlags.
    
    The function uses qemuMonitorGetAllBlockStatsInfo instead of
    qemuMonitorGetBlockStatsInfo.

commit bdc05128d79bc32b16c98c046111d0bcf7001d36
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 14:40:58 2015 +0100

    qemu: monitor: Count block stats fields in qemuMonitorGetAllBlockStatsInfo
    
    Our virDomainBlockStatsFlags API uses the old approach where, when it's
    called without the typed parameter array, returns the count of parameters
    supported by qemu.
    
    The supported parameter count is obtained via separate monitor calls
    which is a waste since we can calculate it when gathering the data.
    
    This patch adds code to the qemuMonitorGetAllBlockStatsInfo workers that
    allows to track the count of supported fields reported by qemu and will
    allow to remove the old duplicate code.

commit 4d8ebb7a3511388185a97469b612f49c72a03002
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 14:32:46 2015 +0100

    qemu: monitor: Convert common code to a macro
    
    The function that is extracting block stats data from the QMP monitor
    reply contains a lot of repeated code. Since I'd be changing each of the
    copies in the next patch, lets convert it to a macro right away.

commit f6563bc36159c04af84e9f3da213e7d5a4c2f890
Author: Peter Krempa <pkrempa>
Date:   Mon Mar 9 17:23:49 2015 +0100

    qemu: monitor: Implement HMP version for listing all block device stats
    
    Add a different version of parser for "info blockstats" that basically
    parses the same information as the existing copy of the function.
    
    This will allow us to remove the single device version
    qemuMonitorGetBlockStatsInfo in the future.
    
    The new implementation uses few new helpers so it should be more
    understandable and provides a test case to verify that it works.

commit fc4713454d8d0c2b81da8b7c1bfab80cc1507c72
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 13:10:20 2015 +0100

    test: qemu: Fix qemu monitor test utils to allow testing HMP
    
    qemu HMP commands sent by libvirt are terminated just by a '\r'. The
    fake monitor used in tests wasn't prepared to handle this and the
    communication would hang on an attempt to do a HMP conversation.
    
    Add a special case for handling commands separated by \r in case HMP is
    used.

commit 4f6b6788c455ff9bb8c714beb7887dcab32a75cc
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 10 10:02:40 2015 +0100

    qemu: blockstats: Switch to caller allocated hash table
    
    Allocate the hash table in the monitor wrapper function instead of the
    worker itself so that the text monitor impl that will be added in the
    next patch doesn't have to duplicate it.

commit 32288fc9b94ea24c9a32a638450942cf7dbb71d6
Author: Peter Krempa <pkrempa>
Date:   Mon Mar 9 15:25:17 2015 +0100

    qemu: monitor: Drop parsing of 'errs' from block info
    
    The error count statistic is not supported by qemu, so there's no need
    to pass the variables around if the result is ignored anyways.

commit 7e9fb151459e476f272a690e3ce73680e5960e7b
Author: Peter Krempa <pkrempa>
Date:   Mon Mar 9 15:17:33 2015 +0100

    qemu: Use macro to set block stats typed parameters
    
    All the setters are the same code except for parameter name and
    variable, so they can be converted to a macro to save a ton of
    duplicated code.

v1.2.13-127-gd3534a4

Comment 6 Pei Zhang 2015-06-18 08:41:43 UTC
I can reproduce it ; and verify it like following :

Verified version:
libvirt-1.2.16-1.el7.x86_64
qemu-kvm-rhev-2.3.0-2.el7.x86_64

steps :
1.start a guest with multi disks
# virsh domblklist r72 --details
Type       Device     Target     Source
------------------------------------------------
file       disk       vda        /var/lib/libvirt/images/r7.2.qcow2
network    disk       vdb        gluster-vol1/qcow2.img
volume     disk       sda        unit:0:0:1
block      disk       sdb        /dev/sdc
block      disk       sdc        /dev/sdd

2.Get device block stats omitting the disk device 
# virsh domblkstat r72 --human
Device: 
 number of read operations:      10762
 number of bytes read:           291728896
 number of write operations:     957
 number of bytes written:        13123072
 number of flush operations:     168
 total duration of reads (ns):   8724301276
 total duration of writes (ns):  182201556130
 total duration of flushes (ns): 8188916339

3.Get device block stats with special disk device 
# virsh domblkstat r72 --human vda
Device: vda
 number of read operations:      10277
 number of bytes read:           290916864
 number of write operations:     966
 number of bytes written:        13164032
 number of flush operations:     174
 total duration of reads (ns):   8197831482
 total duration of writes (ns):  182285131997
 total duration of flushes (ns): 8373477717


# virsh domblkstat r72 --human vdb
Device: vdb
 number of read operations:      311
 number of bytes read:           1267200
 number of write operations:     239
 number of bytes written:        104931328
 number of flush operations:     4
 total duration of reads (ns):   213358168
 total duration of writes (ns):  835268746483
 total duration of flushes (ns): 3510612501

# virsh domblkstat r72 --human sdb
Device: sdb
 number of read operations:      211
 number of bytes read:           860672
 number of write operations:     0
 number of bytes written:        0
 number of flush operations:     0
 total duration of reads (ns):   135084076
 total duration of writes (ns):  0
 total duration of flushes (ns): 0


4. login guest , mount sdb  and  write data to the disk ,then get block device stats again . 
# virsh domblkstat r72 --human sdb
Device: sdb
 number of read operations:      311
 number of bytes read:           1267200
 number of write operations:     239
 number of bytes written:        104931328
 number of flush operations:     4
 total duration of reads (ns):   213358168
 total duration of writes (ns):  835268746483
 total duration of flushes (ns): 3510612501

5.create snapshot , then get block device stats
# virsh snapshot-create-as r72 s1 --disk-only --diskspec vdb,file=/tmp/vdb.s1 --diskspec sdb,file=/tmp/sdb.s1
Domain snapshot s1 created

# virsh domblklist r72
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/r7.2.qcow2
vdb        /tmp/vdb.s1
sda        unit:0:0:1
sdb        /tmp/sdb.s1
sdc        /dev/sdd

# virsh domblkstat r72 
 rd_req 10679
 rd_bytes 292510208
 wr_req 1060
 wr_bytes 13540352
 flush_operations 234
 rd_total_times 8690417908
 wr_total_times 182477910844
 flush_total_times 10175240815


# virsh domblkstat r72 --human vdb
Device: vdb
 number of read operations:      0
 number of bytes read:           0
 number of write operations:     0
 number of bytes written:        0
 number of flush operations:     0
 total duration of reads (ns):   0
 total duration of writes (ns):  0
 total duration of flushes (ns): 0

Login guest , mount vdb and write data to disk , check again :

# virsh domblkstat r72 --human vdb
Device: vdb
 number of read operations:      105
 number of bytes read:           427008
 number of write operations:     239
 number of bytes written:        104976384
 number of flush operations:     4
 total duration of reads (ns):   156117129
 total duration of writes (ns):  60325167938
 total duration of flushes (ns): 1396725809

# virsh domblkstat r72 --human
Device: 
 number of read operations:      10827
 number of bytes read:           295083520
 number of write operations:     1365
 number of bytes written:        118825472
 number of flush operations:     275
 total duration of reads (ns):   9025438559
 total duration of writes (ns):  243619483430
 total duration of flushes (ns): 13126291894

summary statistics are supported now , move this bug to verified .

Comment 8 errata-xmlrpc 2015-11-19 05:47:16 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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