From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, phrdina@redhat.com, stefanha@gmail.com,
armbru@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com,
Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH V13 6/6] hmp: add parameters device and -v for info block
Date: Sat, 25 May 2013 12:24:46 +0800 [thread overview]
Message-ID: <1369455886-30677-7-git-send-email-xiawenc@linux.vnet.ibm.com> (raw)
In-Reply-To: <1369455886-30677-1-git-send-email-xiawenc@linux.vnet.ibm.com>
With these parameters, user can choose the information to be showed,
to avoid message flood in the monitor.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
hmp.c | 25 ++++++++++++++++---------
monitor.c | 7 ++++---
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/hmp.c b/hmp.c
index 2aa832c..a590ace 100644
--- a/hmp.c
+++ b/hmp.c
@@ -279,10 +279,15 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
{
BlockInfoList *block_list, *info;
ImageInfo *image_info;
+ const char *device = qdict_get_try_str(qdict, "device");
+ int verbose = qdict_get_try_bool(qdict, "verbose", 0);
block_list = qmp_query_block(NULL);
for (info = block_list; info; info = info->next) {
+ if (device && strcmp(device, info->value->device)) {
+ continue;
+ }
monitor_printf(mon, "%s: removable=%d",
info->value->device, info->value->removable);
@@ -321,15 +326,17 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
info->value->inserted->iops_rd,
info->value->inserted->iops_wr);
- monitor_printf(mon, " images:\n");
- image_info = info->value->inserted->image;
- while (1) {
- bdrv_image_info_dump((fprintf_function)monitor_printf, mon,
- image_info);
- if (image_info->has_backing_image) {
- image_info = image_info->backing_image;
- } else {
- break;
+ if (verbose) {
+ monitor_printf(mon, " images:\n");
+ image_info = info->value->inserted->image;
+ while (1) {
+ bdrv_image_info_dump((fprintf_function)monitor_printf,
+ mon, image_info);
+ if (image_info->has_backing_image) {
+ image_info = image_info->backing_image;
+ } else {
+ break;
+ }
}
}
} else {
diff --git a/monitor.c b/monitor.c
index 6ce2a4e..243f5ae 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2472,9 +2472,10 @@ static mon_cmd_t info_cmds[] = {
},
{
.name = "block",
- .args_type = "",
- .params = "",
- .help = "show the block devices",
+ .args_type = "verbose:-v,device:B?",
+ .params = "[-v] [device]",
+ .help = "show info of one block device or all block devices "
+ "(and details of images with -v option)",
.mhandler.cmd = hmp_info_block,
},
{
--
1.7.1
next prev parent reply other threads:[~2013-05-25 4:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-25 4:24 [Qemu-devel] [PATCH V13 0/6] enhancement for qmp/hmp interfaces of block info Wenchao Xia
2013-05-25 4:24 ` [Qemu-devel] [PATCH V13 1/6] block: add snapshot info query function bdrv_query_snapshot_info_list() Wenchao Xia
2013-05-25 4:24 ` [Qemu-devel] [PATCH V13 2/6] block: add image info query function bdrv_query_image_info() Wenchao Xia
2013-05-25 12:50 ` Eric Blake
2013-05-25 4:24 ` [Qemu-devel] [PATCH V13 3/6] qmp: add recursive member in ImageInfo Wenchao Xia
2013-05-25 16:10 ` Eric Blake
2013-05-27 1:28 ` Wenchao Xia
2013-06-05 10:56 ` Stefan Hajnoczi
2013-05-25 4:24 ` [Qemu-devel] [PATCH V13 4/6] qmp: add ImageInfo in BlockDeviceInfo used by query-block Wenchao Xia
2013-05-25 4:24 ` [Qemu-devel] [PATCH V13 5/6] hmp: show ImageInfo in 'info block' Wenchao Xia
2013-05-25 4:24 ` Wenchao Xia [this message]
2013-06-05 11:06 ` [Qemu-devel] [PATCH V13 6/6] hmp: add parameters device and -v for info block Stefan Hajnoczi
2013-05-25 12:33 ` [Qemu-devel] [PATCH V13 0/6] enhancement for qmp/hmp interfaces of block info Eric Blake
2013-06-05 11:07 ` Stefan Hajnoczi
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=1369455886-30677-7-git-send-email-xiawenc@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phrdina@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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).