qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Benoit Canet <benoit@irqsave.net>,
	Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/4] block: Include "node-name" if present in query-blockstats
Date: Fri, 31 Oct 2014 11:32:56 +0800	[thread overview]
Message-ID: <1414726377-13063-4-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1414726377-13063-1-git-send-email-famz@redhat.com>

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>
---
 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 1301144..a4d1a20 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -333,6 +333,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 8f7089e..6b4b96c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -408,6 +408,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.
@@ -418,7 +420,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.9.3

  parent reply	other threads:[~2014-10-31 15:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  3:32 [Qemu-devel] [PATCH v2 0/4] block: Allow query stats for drive-mirror target Fam Zheng
2014-10-31  3:32 ` [Qemu-devel] [PATCH v2 1/4] block: Add bdrv_next_node Fam Zheng
2014-10-31  3:32 ` [Qemu-devel] [PATCH v2 2/4] block: Add bdrv_get_node_name Fam Zheng
2014-11-04  8:42   ` Max Reitz
2014-10-31  3:32 ` Fam Zheng [this message]
2014-10-31  3:32 ` [Qemu-devel] [PATCH v2 4/4] qmp: Add optional switch "query-nodes" in query-blockstats Fam Zheng
2014-11-04  8:54   ` Max Reitz
2014-11-04 11:47     ` Fam Zheng
2014-11-04  9:33 ` [Qemu-devel] [PATCH v2 0/4] block: Allow query stats for drive-mirror target Max Reitz

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=1414726377-13063-4-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=benoit@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@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).