From 65d64f362326a57b590b8b76e3422030a2aa5c44 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 18 Feb 2016 13:16:49 +0800 Subject: dump-guest-memory: add dump_in_progress() helper function For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu Reviewed-by: Fam Zheng Message-Id: <1455772616-8668-5-git-send-email-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- dump.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'dump.c') diff --git a/dump.c b/dump.c index 434bc60bc9..158d6ea915 100644 --- a/dump.c +++ b/dump.c @@ -1450,6 +1450,12 @@ static void dump_state_prepare(DumpState *s) *s = (DumpState) { .status = DUMP_STATUS_ACTIVE }; } +bool dump_in_progress(void) +{ + DumpState *state = &dump_state_global; + return (state->status == DUMP_STATUS_ACTIVE); +} + static void dump_init(DumpState *s, int fd, bool has_format, DumpGuestMemoryFormat format, bool paging, bool has_filter, int64_t begin, int64_t length, Error **errp) @@ -1628,6 +1634,13 @@ void qmp_dump_guest_memory(bool paging, const char *file, DumpState *s; Error *local_err = NULL; + /* if there is a dump in background, we should wait until the dump + * finished */ + if (dump_in_progress()) { + error_setg(errp, "There is a dump in process, please wait."); + return; + } + /* * kdump-compressed format need the whole memory dumped, so paging or * filter is not supported here. -- cgit v1.2.3