diff options
author | Wenchao Xia <xiawenc@linux.vnet.ibm.com> | 2013-06-06 12:28:01 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-06-07 13:45:01 +0200 |
commit | e73fe2b46c38776288415ce7bc8ba3fcd23721c4 (patch) | |
tree | 10245fa97cd9539811870912b6562fc388ce28d4 /hmp.c | |
parent | bd093a365e8d1437f437a48ddca3ed08283b3090 (diff) | |
download | qemu-e73fe2b46c38776288415ce7bc8ba3fcd23721c4.zip qemu-e73fe2b46c38776288415ce7bc8ba3fcd23721c4.tar.gz qemu-e73fe2b46c38776288415ce7bc8ba3fcd23721c4.tar.bz2 |
hmp: add parameters device and -v for info block
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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r-- | hmp.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -280,10 +280,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"); + bool 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); @@ -322,15 +327,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 { |