提交 d75416ef 编写于 作者: A Anthony Liguori

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: NAnthony Liguori <aliguori@us.ibm.com>
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册