mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07:00
qmp: add query-block-jobs
Add query-block-jobs, which shows the progress of ongoing block device operations. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
370521a1d6
commit
fb5458cd10
6 changed files with 115 additions and 0 deletions
36
hmp.c
36
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue