mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
block: Include "node-name" if present in query-blockstats
Node name is a better identifier of BDS. We will want to query statistics of a BDS node buried in the BDS graph, so reporting the node's name if there is one will do the trick. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
20a9e77dfa
commit
4875a77950
2 changed files with 9 additions and 1 deletions
|
@ -311,6 +311,11 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs)
|
||||||
s->device = g_strdup(bdrv_get_device_name(bs));
|
s->device = g_strdup(bdrv_get_device_name(bs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bdrv_get_node_name(bs)[0]) {
|
||||||
|
s->has_node_name = true;
|
||||||
|
s->node_name = g_strdup(bdrv_get_node_name(bs));
|
||||||
|
}
|
||||||
|
|
||||||
s->stats = g_malloc0(sizeof(*s->stats));
|
s->stats = g_malloc0(sizeof(*s->stats));
|
||||||
s->stats->rd_bytes = bs->stats.nr_bytes[BLOCK_ACCT_READ];
|
s->stats->rd_bytes = bs->stats.nr_bytes[BLOCK_ACCT_READ];
|
||||||
s->stats->wr_bytes = bs->stats.nr_bytes[BLOCK_ACCT_WRITE];
|
s->stats->wr_bytes = bs->stats.nr_bytes[BLOCK_ACCT_WRITE];
|
||||||
|
|
|
@ -405,6 +405,8 @@
|
||||||
# @device: #optional If the stats are for a virtual block device, the name
|
# @device: #optional If the stats are for a virtual block device, the name
|
||||||
# corresponding to the virtual block device.
|
# corresponding to the virtual block device.
|
||||||
#
|
#
|
||||||
|
# @device: #optional The node name of the device. (Since 2.3)
|
||||||
|
#
|
||||||
# @stats: A @BlockDeviceStats for the device.
|
# @stats: A @BlockDeviceStats for the device.
|
||||||
#
|
#
|
||||||
# @parent: #optional This describes the file block device if it has one.
|
# @parent: #optional This describes the file block device if it has one.
|
||||||
|
@ -415,7 +417,8 @@
|
||||||
# Since: 0.14.0
|
# Since: 0.14.0
|
||||||
##
|
##
|
||||||
{ 'type': 'BlockStats',
|
{ 'type': 'BlockStats',
|
||||||
'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
|
'data': {'*device': 'str', '*node-name': 'str',
|
||||||
|
'stats': 'BlockDeviceStats',
|
||||||
'*parent': 'BlockStats',
|
'*parent': 'BlockStats',
|
||||||
'*backing': 'BlockStats'} }
|
'*backing': 'BlockStats'} }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue