From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6kUn-0003QO-0K for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:24:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6kUd-0007xI-FH for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:24:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6kUd-0007xB-6D for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:24:35 -0500 From: Kevin Wolf Date: Fri, 24 Jan 2014 18:21:35 +0100 Message-Id: <1390584136-24703-53-git-send-email-kwolf@redhat.com> In-Reply-To: <1390584136-24703-1-git-send-email-kwolf@redhat.com> References: <1390584136-24703-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 52/93] qapi: Add "backing" to BlockStats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Fam Zheng Currently there is no way to query BlockStats of the backing chain. This adds "backing" field into BlockStats to make it possible. The comment of "parent" is reworded. Signed-off-by: Fam Zheng Reviewed-by: Benoit Canet Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- block/qapi.c | 5 +++++ qapi-schema.json | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index a32cb79..98b1b83 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -318,6 +318,11 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs) s->parent = bdrv_query_stats(bs->file); } + if (bs->backing_hd) { + s->has_backing = true; + s->backing = bdrv_query_stats(bs->backing_hd); + } + return s; } diff --git a/qapi-schema.json b/qapi-schema.json index 35f7b34..a433869 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1022,15 +1022,17 @@ # # @stats: A @BlockDeviceStats for the device. # -# @parent: #optional This may point to the backing block device if this is a -# a virtual block device. If it's a backing block, this will point -# to the backing file is one is present. +# @parent: #optional This describes the file block device if it has one. +# +# @backing: #optional This describes the backing block device if it has one. +# (Since 2.0) # # Since: 0.14.0 ## { 'type': 'BlockStats', 'data': {'*device': 'str', 'stats': 'BlockDeviceStats', - '*parent': 'BlockStats'} } + '*parent': 'BlockStats', + '*backing': 'BlockStats'} } ## # @query-blockstats: -- 1.8.1.4