From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH] qapi: Add "backing" and "file" to BlockStats
Date: Wed, 22 Jan 2014 11:30:16 +0800 [thread overview]
Message-ID: <1390361416-24234-1-git-send-email-famz@redhat.com> (raw)
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 <famz@redhat.com>
---
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
next reply other threads:[~2014-01-22 3:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 3:30 Fam Zheng [this message]
2014-01-22 9:35 ` [Qemu-devel] [PATCH] qapi: Add "backing" and "file" to BlockStats Kevin Wolf
2014-01-22 13:08 ` Eric Blake
2014-01-22 13:07 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390361416-24234-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).