aboutsummaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2016-02-18 13:16:56 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-22 18:40:29 +0100
commitd42a0d1484f03d05184ed9bb867fee42476a588f (patch)
treef0f9926f4181f89dde0d49b0460fb13c5f55227d /dump.c
parent4a6b52d67e36486ae3d695170a2a7eb39f7a032e (diff)
dump-guest-memory: add qmp event DUMP_COMPLETED
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>
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/dump.c b/dump.c
index 9dc494619d..81d2d4f5a0 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;
}