[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/73] block: Include "node-name" if present in query
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 03/73] block: Include "node-name" if present in query-blockstats |
Date: |
Wed, 10 Dec 2014 11:33:29 +0100 |
From: Fam Zheng <address@hidden>
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 <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qapi.c | 5 +++++
qapi/block-core.json | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/block/qapi.c b/block/qapi.c
index a87a34a..d70336a 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -311,6 +311,11 @@ static BlockStats *bdrv_query_stats(const BlockDriverState
*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->rd_bytes = bs->stats.nr_bytes[BLOCK_ACCT_READ];
s->stats->wr_bytes = bs->stats.nr_bytes[BLOCK_ACCT_WRITE];
diff --git a/qapi/block-core.json b/qapi/block-core.json
index a14e6ab..de1bd45 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -405,6 +405,8 @@
# @device: #optional If the stats are for a virtual block device, the name
# corresponding to the virtual block device.
#
+# @device: #optional The node name of the device. (Since 2.3)
+#
# @stats: A @BlockDeviceStats for the device.
#
# @parent: #optional This describes the file block device if it has one.
@@ -415,7 +417,8 @@
# Since: 0.14.0
##
{ 'type': 'BlockStats',
- 'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
+ 'data': {'*device': 'str', '*node-name': 'str',
+ 'stats': 'BlockDeviceStats',
'*parent': 'BlockStats',
'*backing': 'BlockStats'} }
--
1.8.3.1
- [Qemu-devel] [PULL 00/73] Merging block-next for 2.3, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 01/73] block: Add bdrv_next_node, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 06/73] chardev: Add -qmp-pretty, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 07/73] iotests: _filter_qmp for pretty JSON output, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 09/73] blockdev: acquire AioContext in blockdev-snapshot-delete-internal-sync, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 02/73] block: Add bdrv_get_node_name, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 11/73] blockdev: acquire AioContext in eject, change, and block_passwd, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 03/73] block: Include "node-name" if present in query-blockstats,
Kevin Wolf <=
- [Qemu-devel] [PULL 15/73] block/hmp: Allow info = NULL in print_block_info(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 13/73] block/qapi: Add cache information to query-block, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 10/73] blockdev: check for BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 14/73] block/hmp: Factor out print_block_info(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 16/73] block/hmp: Allow node-name in 'info block', Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 17/73] monitor: Fix HMP tab completion, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 21/73] ahci: replace SATA FIS type magic numbers with constants, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 23/73] block: Add AioContextNotifier functions to BB, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 19/73] iotests: Plain blkdebug filename generation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 20/73] ahci: avoid #ifdef DEBUG_AHCI bitrot, Kevin Wolf, 2014/12/10