From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5oWM-0006QA-Kg for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:30:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5oWD-0008Nv-EJ for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:30:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5oWD-0008Nl-6o for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:30:21 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0M3UIHO000524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Jan 2014 22:30:19 -0500 From: Fam Zheng Date: Wed, 22 Jan 2014 11:30:16 +0800 Message-Id: <1390361416-24234-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH] qapi: Add "backing" and "file" to BlockStats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com Currently there is no way to query BlockStats of the backing chain. This adds "backing" and "file" fields into BlockStats to make it possible. The old optional field "parent", which has the information for "file", is kept there for backward compatibility, as an alias for "file". However field name "file" is more consistent with "file" option name in the block device configuration interface. Signed-off-by: Fam Zheng --- block/qapi.c | 7 +++++++ qapi-schema.json | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index a32cb79..858650e 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -316,6 +316,13 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs) if (bs->file) { s->has_parent = true; s->parent = bdrv_query_stats(bs->file); + s->has_file = true; + s->file = 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 f27c48a..c3c8aec 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1022,15 +1022,22 @@ # # @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. +# @file: #optional This may point to the file block device if present. +# (Since 2.0) +# +# @backing: #optional This may point to the backing block device if present. +# (Since 2.0) +# +# @parent: #optional An alias of @file for backward comatibility. (Since +# 0.14.0) # # Since: 0.14.0 ## { 'type': 'BlockStats', 'data': {'*device': 'str', 'stats': 'BlockDeviceStats', - '*parent': 'BlockStats'} } + '*parent': 'BlockStats', + '*file': 'BlockStats', + '*backing': 'BlockStats'} } ## # @query-blockstats: -- 1.8.5.3