From fb5458cd10a199e55e622a906b24f8085d922c0f Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 18 Jan 2012 14:40:49 +0000 Subject: qmp: add query-block-jobs Add query-block-jobs, which shows the progress of ongoing block device operations. Signed-off-by: Stefan Hajnoczi Acked-by: Luiz Capitulino Signed-off-by: Kevin Wolf --- hmp.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 867c338788..8ff8c9434e 100644 --- a/hmp.c +++ b/hmp.c @@ -509,6 +509,42 @@ void hmp_info_pci(Monitor *mon) qapi_free_PciInfoList(info_list); } +void hmp_info_block_jobs(Monitor *mon) +{ + BlockJobInfoList *list; + Error *err = NULL; + + list = qmp_query_block_jobs(&err); + assert(!err); + + if (!list) { + monitor_printf(mon, "No active jobs\n"); + return; + } + + while (list) { + if (strcmp(list->value->type, "stream") == 0) { + monitor_printf(mon, "Streaming device %s: Completed %" PRId64 + " of %" PRId64 " bytes, speed limit %" PRId64 + " bytes/s\n", + list->value->device, + list->value->offset, + list->value->len, + list->value->speed); + } else { + monitor_printf(mon, "Type %s, device %s: Completed %" PRId64 + " of %" PRId64 " bytes, speed limit %" PRId64 + " bytes/s\n", + list->value->type, + list->value->device, + list->value->offset, + list->value->len, + list->value->speed); + } + list = list->next; + } +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); -- cgit v1.2.3