From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com, kwolf@redhat.com,
mreitz@redhat.com, vsementsov@virtuozzo.com, den@openvz.org,
nshirokovskiy@virtuozzo.com, jsnow@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] qapi: support device id for x-block-latency-histogram-set
Date: Tue, 2 Oct 2018 14:33:24 +0300 [thread overview]
Message-ID: <20181002113325.12911-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20181002113325.12911-1-vsementsov@virtuozzo.com>
Support modern way of device selecting.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
qapi/block-core.json | 6 ++++--
blockdev.c | 8 +++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index ac3b48ee54..4efd60d8ab 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -489,7 +489,9 @@
# If only @device parameter is specified, remove all present latency histograms
# for the device. Otherwise, add/reset some of (or all) latency histograms.
#
-# @device: device name to set latency histogram for.
+# @device: device name to set latency histogram for (better use @id).
+#
+# @id: The name or QOM path of the guest device.
#
# @boundaries: list of interval boundary values (see description in
# BlockLatencyHistogramInfo definition). If specified, all
@@ -547,7 +549,7 @@
# <- { "return": {} }
##
{ 'command': 'x-block-latency-histogram-set',
- 'data': {'device': 'str',
+ 'data': {'*device': 'str', '*id': 'str',
'*boundaries': ['uint64'],
'*boundaries-read': ['uint64'],
'*boundaries-write': ['uint64'],
diff --git a/blockdev.c b/blockdev.c
index a8755bd908..87f4ab3316 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4368,20 +4368,22 @@ void qmp_x_blockdev_set_iothread(const char *node_name, StrOrNull *iothread,
}
void qmp_x_block_latency_histogram_set(
- const char *device,
+ bool has_device, const char *device,
+ bool has_id, const char *id,
bool has_boundaries, uint64List *boundaries,
bool has_boundaries_read, uint64List *boundaries_read,
bool has_boundaries_write, uint64List *boundaries_write,
bool has_boundaries_flush, uint64List *boundaries_flush,
Error **errp)
{
- BlockBackend *blk = blk_by_name(device);
+ BlockBackend *blk;
BlockAcctStats *stats;
+ blk = qmp_get_blk(has_device ? device : NULL, has_id ? id : NULL, errp);
if (!blk) {
- error_setg(errp, "Device '%s' not found", device);
return;
}
+
stats = blk_get_stats(blk);
if (!has_boundaries && !has_boundaries_read && !has_boundaries_write &&
--
2.18.0
next prev parent reply other threads:[~2018-10-02 11:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 11:33 [Qemu-devel] [PATCH 0/2] improve block-latency-histogram-set Vladimir Sementsov-Ogievskiy
2018-10-02 11:33 ` Vladimir Sementsov-Ogievskiy [this message]
2018-10-02 14:22 ` [Qemu-devel] [PATCH 1/2] qapi: support device id for x-block-latency-histogram-set Eric Blake
2018-10-02 14:30 ` Nikolay Shirokovskiy
2018-10-02 14:30 ` Vladimir Sementsov-Ogievskiy
2018-10-02 14:35 ` Eric Blake
2018-10-02 14:58 ` Vladimir Sementsov-Ogievskiy
2018-10-02 15:21 ` Eric Blake
2018-10-02 11:33 ` [Qemu-devel] [PATCH 2/2] qapi: drop x- from x-block-latency-histogram-set Vladimir Sementsov-Ogievskiy
2018-10-02 13:11 ` Vladimir Sementsov-Ogievskiy
2018-10-02 14:25 ` 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=20181002113325.12911-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=nshirokovskiy@virtuozzo.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).