Received: from eggs.gnu.org ([2001:4830:134:3::10]:58647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyebk-0008MR-5g for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyebW-0007Hz-2I for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyebV-0007Hp-QF for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:34:46 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBAAYj3w005037 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Dec 2014 05:34:45 -0500 From: Kevin Wolf Date: Wed, 10 Dec 2014 11:33:29 +0100 Message-Id: <1418207679-32260-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1418207679-32260-1-git-send-email-kwolf@redhat.com> References: <1418207679-32260-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 03/73] block: Include "node-name" if present in query-blockstats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Fam Zheng 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 Reviewed-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- 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