Dump: add qmp command "query-dump"

When dump-guest-memory is requested with detach flag, after its
return, user could query its status using "query-dump" command (with
no argument). The result contains:

- status: current dump status
- completed: bytes written in the latest dump
- total: bytes to write in the latest dump

From completed and total, we could know how much work
finished by calculating:

  100.0 * completed / total (%)

Reviewed-by:   Fam Zheng <famz@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1455772616-8668-10-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Peter Xu 2016-02-18 13:16:54 +08:00 committed by Paolo Bonzini
parent 2264c2c96e
commit 39ba2ea61f
3 changed files with 76 additions and 6 deletions

View file

@ -856,7 +856,8 @@ Arguments:
- "protocol": destination file(started with "file:") or destination file
descriptor (started with "fd:") (json-string)
- "detach": if specified, command will return immediately, without waiting
for the dump to finish (json-bool)
for the dump to finish. The user can track progress using
"query-dump". (json-bool)
- "begin": the starting physical address. It's optional, and should be specified
with length together (json-int)
- "length": the memory size, in bytes. It's optional, and should be specified
@ -894,6 +895,30 @@ Example:
<- { "return": { "formats":
["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
EQMP
{
.name = "query-dump",
.args_type = "",
.params = "",
.help = "query background dump status",
.mhandler.cmd_new = qmp_marshal_query_dump,
},
SQMP
query-dump
----------
Query background dump status.
Arguments: None.
Example:
-> { "execute": "query-dump" }
<- { "return": { "status": "active", "completed": 1024000,
"total": 2048000 } }
EQMP
#if defined TARGET_S390X