From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>
Subject: [Qemu-devel] [PULL 13/19] dump-guest-memory: add qmp event DUMP_COMPLETED
Date: Wed, 24 Feb 2016 14:27:35 +0100 [thread overview]
Message-ID: <1456320461-26756-14-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1456320461-26756-1-git-send-email-pbonzini@redhat.com>
From: Peter Xu <peterx@redhat.com>
One new QMP event DUMP_COMPLETED is added. When a dump finishes, one
DUMP_COMPLETED event will occur to notify the user.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-Id: <1455772616-8668-12-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/qmp-events.txt | 18 ++++++++++++++++++
dump.c | 18 ++++++++++++------
qapi/event.json | 16 ++++++++++++++++
3 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/docs/qmp-events.txt b/docs/qmp-events.txt
index 52eb7e2..4e3eb9e 100644
--- a/docs/qmp-events.txt
+++ b/docs/qmp-events.txt
@@ -220,6 +220,24 @@ Data:
},
"timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
+DUMP_COMPLETED
+--------------
+
+Emitted when the guest has finished one memory dump.
+
+Data:
+
+- "result": DumpQueryResult type described in qapi-schema.json
+- "error": Error message when dump failed. This is only a
+ human-readable string provided when dump failed. It should not be
+ parsed in any way (json-string, optional)
+
+Example:
+
+{ "event": "DUMP_COMPLETED",
+ "data": {"result": {"total": 1090650112, "status": "completed",
+ "completed": 1090650112} } }
+
GUEST_PANICKED
--------------
diff --git a/dump.c b/dump.c
index 9dc4946..81d2d4f 100644
--- a/dump.c
+++ b/dump.c
@@ -25,6 +25,7 @@
#include "sysemu/cpus.h"
#include "qapi/qmp/qerror.h"
#include "qmp-commands.h"
+#include "qapi-event.h"
#include <zlib.h>
#ifdef CONFIG_LZO
@@ -1662,6 +1663,7 @@ cleanup:
static void dump_process(DumpState *s, Error **errp)
{
Error *local_err = NULL;
+ DumpQueryResult *result = NULL;
if (s->has_format && s->format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
create_kdump_vmcore(s, &local_err);
@@ -1674,6 +1676,15 @@ static void dump_process(DumpState *s, Error **errp)
atomic_set(&s->status,
(local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED));
+ /* send DUMP_COMPLETED message (unconditionally) */
+ result = qmp_query_dump(NULL);
+ /* should never fail */
+ assert(result);
+ qapi_event_send_dump_completed(result, !!local_err, (local_err ? \
+ error_get_pretty(local_err) : NULL),
+ &error_abort);
+ qapi_free_DumpQueryResult(result);
+
error_propagate(errp, local_err);
dump_cleanup(s);
}
@@ -1682,13 +1693,8 @@ static void *dump_thread(void *data)
{
Error *err = NULL;
DumpState *s = (DumpState *)data;
-
dump_process(s, &err);
-
- if (err) {
- /* TODO: notify user the error */
- error_free(err);
- }
+ error_free(err);
return NULL;
}
diff --git a/qapi/event.json b/qapi/event.json
index 390fd45..1a45a6c 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -369,3 +369,19 @@
##
{ 'event': 'MEM_UNPLUG_ERROR',
'data': { 'device': 'str', 'msg': 'str' } }
+
+##
+# @DUMP_COMPLETED
+#
+# Emitted when background dump has completed
+#
+# @result: DumpQueryResult type described in qapi-schema.json.
+#
+# @error: #optional human-readable error string that provides
+# hint on why dump failed. Only presents on failure. The
+# user should not try to interpret the error string.
+#
+# Since: 2.6
+##
+{ 'event': 'DUMP_COMPLETED' ,
+ 'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
--
2.5.0
next prev parent reply other threads:[~2016-02-24 13:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 13:27 [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 01/19] qemu-options.hx: Improve documentation of chardev multiplexing mode Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 02/19] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 03/19] dump-guest-memory: cleanup: removing dump_{error|cleanup}() Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 05/19] dump-guest-memory: using static DumpState, add DumpStatus Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 07/19] dump-guest-memory: introduce dump_process() " Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 08/19] dump-guest-memory: disable dump when in INMIGRATE state Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 09/19] dump-guest-memory: add "detach" support Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 10/19] DumpState: adding total_size and written_size fields Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 11/19] Dump: add qmp command "query-dump" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 12/19] Dump: add hmp command "info dump" Paolo Bonzini
2016-02-24 13:27 ` Paolo Bonzini [this message]
2016-02-24 15:54 ` [Qemu-devel] [PULL 13/19] dump-guest-memory: add qmp event DUMP_COMPLETED Eric Blake
2016-02-24 13:27 ` [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized Paolo Bonzini
2016-02-29 8:57 ` Ján Tomko
2016-02-29 9:07 ` Paolo Bonzini
2016-02-29 10:04 ` Ján Tomko
2016-02-29 10:17 ` Paolo Bonzini
2016-02-29 11:05 ` Ján Tomko
2016-02-29 11:17 ` Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 15/19] exec: store RAMBlock pointer into memory region Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 16/19] memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 17/19] memory: Remove unreachable return statement Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 18/19] chardev: Properly initialize ChardevCommon components Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 19/19] target-i386: fix confusion in xcr0 bit position vs. mask Paolo Bonzini
2016-02-25 10:45 ` [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Peter Maydell
2016-02-25 11:10 ` Gonglei (Arei)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456320461-26756-14-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).