diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-07-01 09:02:25 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-07-01 09:02:25 -0500 |
commit | d75416ef29e477ebeadf9da41677be6f8166e8be (patch) | |
tree | 5a32c57fdb363914017a80c7af417beeda475b6b | |
parent | ffeec223b55ea696567ed544016824199cd7c7bc (diff) | |
parent | fbe2e26c15af35e4d157874dc80f6a19eebaa83b (diff) |
Merge remote-tracking branch 'luiz/queue/qmp' into staging
# By Kevin Wolf
# Via Luiz Capitulino
* luiz/queue/qmp:
hmp: Make "info block" output more readable
Message-id: 1372452199-23237-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hmp.c | 94 |
1 files changed, 55 insertions, 39 deletions
@@ -291,62 +291,78 @@ void hmp_info_block(Monitor *mon, const QDict *qdict) if (device && strcmp(device, info->value->device)) { continue; } - monitor_printf(mon, "%s: removable=%d", - info->value->device, info->value->removable); - if (info->value->removable) { - monitor_printf(mon, " locked=%d", info->value->locked); - monitor_printf(mon, " tray-open=%d", info->value->tray_open); + if (info != block_list) { + monitor_printf(mon, "\n"); + } + + monitor_printf(mon, "%s", info->value->device); + if (info->value->has_inserted) { + monitor_printf(mon, ": %s (%s%s%s)\n", + info->value->inserted->file, + info->value->inserted->drv, + info->value->inserted->ro ? ", read-only" : "", + info->value->inserted->encrypted ? ", encrypted" : ""); + } else { + monitor_printf(mon, ": [not inserted]\n"); } - if (info->value->has_io_status) { - monitor_printf(mon, " io-status=%s", + if (info->value->has_io_status && info->value->io_status != BLOCK_DEVICE_IO_STATUS_OK) { + monitor_printf(mon, " I/O status: %s\n", BlockDeviceIoStatus_lookup[info->value->io_status]); } - if (info->value->has_inserted) { - monitor_printf(mon, " file="); - monitor_print_filename(mon, info->value->inserted->file); - - if (info->value->inserted->has_backing_file) { - monitor_printf(mon, " backing_file="); - monitor_print_filename(mon, info->value->inserted->backing_file); - monitor_printf(mon, " backing_file_depth=%" PRId64, - info->value->inserted->backing_file_depth); - } - monitor_printf(mon, " ro=%d drv=%s encrypted=%d", - info->value->inserted->ro, - info->value->inserted->drv, - info->value->inserted->encrypted); + if (info->value->removable) { + monitor_printf(mon, " Removable device: %slocked, tray %s\n", + info->value->locked ? "" : "not ", + info->value->tray_open ? "open" : "closed"); + } - monitor_printf(mon, " bps=%" PRId64 " bps_rd=%" PRId64 - " bps_wr=%" PRId64 " iops=%" PRId64 - " iops_rd=%" PRId64 " iops_wr=%" PRId64, + + if (!info->value->has_inserted) { + continue; + } + + if (info->value->inserted->has_backing_file) { + monitor_printf(mon, + " Backing file: %s " + "(chain depth: %" PRId64 ")\n", + info->value->inserted->backing_file, + info->value->inserted->backing_file_depth); + } + + if (info->value->inserted->bps + || info->value->inserted->bps_rd + || info->value->inserted->bps_wr + || info->value->inserted->iops + || info->value->inserted->iops_rd + || info->value->inserted->iops_wr) + { + monitor_printf(mon, " I/O throttling: bps=%" PRId64 + " bps_rd=%" PRId64 " bps_wr=%" PRId64 + " iops=%" PRId64 " iops_rd=%" PRId64 + " iops_wr=%" PRId64 "\n", info->value->inserted->bps, info->value->inserted->bps_rd, info->value->inserted->bps_wr, info->value->inserted->iops, info->value->inserted->iops_rd, info->value->inserted->iops_wr); + } - 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; - } + if (verbose) { + monitor_printf(mon, "\nImages:\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 { - monitor_printf(mon, " [not inserted]"); } - - monitor_printf(mon, "\n"); } qapi_free_BlockInfoList(block_list); |