summaryrefslogtreecommitdiff
path: root/block/qapi.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-10-31 11:32:56 +0800
committerKevin Wolf <kwolf@redhat.com>2014-12-10 10:25:29 +0100
commit4875a77950811631c26e156592e8b8df22208085 (patch)
tree8e9fe23ba2fe9389041bb76df2abdefd8998152b /block/qapi.c
parent20a9e77dfabb3e664c0873726be1540175a4fda1 (diff)
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>
Diffstat (limited to 'block/qapi.c')
-rw-r--r--block/qapi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/qapi.c b/block/qapi.c
index a87a34a8b4..d70336a012 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];