From 228de9cf1d9607d7eb73445c1656cc3834826606 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 18 Feb 2016 13:16:47 +0800 Subject: dump-guest-memory: add "detach" flag for QMP/HMP interfaces. This patch only adds the interfaces, but does not implement them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu Reviewed-by: Fam Zheng Message-Id: <1455772616-8668-3-git-send-email-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- hmp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 996cb91027..7f65b324d7 100644 --- a/hmp.c +++ b/hmp.c @@ -1587,8 +1587,10 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) const char *file = qdict_get_str(qdict, "filename"); bool has_begin = qdict_haskey(qdict, "begin"); bool has_length = qdict_haskey(qdict, "length"); + bool has_detach = qdict_haskey(qdict, "detach"); int64_t begin = 0; int64_t length = 0; + bool detach = false; enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF; char *prot; @@ -1616,11 +1618,14 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) if (has_length) { length = qdict_get_int(qdict, "length"); } + if (has_detach) { + detach = qdict_get_bool(qdict, "detach"); + } prot = g_strconcat("file:", file, NULL); - qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length, - true, dump_format, &err); + qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin, + has_length, length, true, dump_format, &err); hmp_handle_error(mon, &err); g_free(prot); } -- cgit v1.2.1 From 4a6b52d67e36486ae3d695170a2a7eb39f7a032e Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 18 Feb 2016 13:16:55 +0800 Subject: Dump: add hmp command "info dump" It will calculate percentage of finished work from completed and total. Signed-off-by: Peter Xu Message-Id: <1455772616-8668-11-git-send-email-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- hmp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 7f65b324d7..d0d0557ea0 100644 --- a/hmp.c +++ b/hmp.c @@ -2351,3 +2351,20 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) qapi_free_RockerOfDpaGroupList(list); } + +void hmp_info_dump(Monitor *mon, const QDict *qdict) +{ + DumpQueryResult *result = qmp_query_dump(NULL); + + assert(result && result->status < DUMP_STATUS__MAX); + monitor_printf(mon, "Status: %s\n", DumpStatus_lookup[result->status]); + + if (result->status == DUMP_STATUS_ACTIVE) { + float percent = 0; + assert(result->total != 0); + percent = 100.0 * result->completed / result->total; + monitor_printf(mon, "Finished: %.2f %%\n", percent); + } + + qapi_free_DumpQueryResult(result); +} -- cgit v1.2.1