diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-09-21 17:16:47 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2011-10-27 11:48:47 -0200 |
commit | b202381800d81fbff9978abbdea95760dd363bb6 (patch) | |
tree | 572a252464539e052b1fca18e61779dc3788bac7 /hmp.c | |
parent | 58e21ef5ab262fb91256435c31cc7bfeead59754 (diff) |
qapi: Convert query-block
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r-- | hmp.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -184,6 +184,48 @@ void hmp_info_cpus(Monitor *mon) qapi_free_CpuInfoList(cpu_list); } +void hmp_info_block(Monitor *mon) +{ + BlockInfoList *block_list, *info; + + block_list = qmp_query_block(NULL); + + for (info = block_list; info; info = info->next) { + 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->value->has_io_status) { + monitor_printf(mon, " io-status=%s", + 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, " ro=%d drv=%s encrypted=%d", + info->value->inserted->ro, + info->value->inserted->drv, + info->value->inserted->encrypted); + } else { + monitor_printf(mon, " [not inserted]"); + } + + monitor_printf(mon, "\n"); + } + + qapi_free_BlockInfoList(block_list); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); |