For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 13 +++++++++++++ include/qemu-common.h | 4 ++++ qmp.c | 14 ++++++++++++++ 3 files changed, 31 insertions(+)
diff --git a/dump.c b/dump.c index c9ea878..110dbf9 100644 --- a/dump.c +++ b/dump.c @@ -1436,6 +1436,12 @@ static DumpState *dump_state_get_global(void) return &state; } +bool dump_in_progress(void) +{ + DumpState *state = dump_state_get_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) @@ -1609,6 +1615,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. diff --git a/include/qemu-common.h b/include/qemu-common.h index 405364f..7b74961 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -501,4 +501,8 @@ int parse_debug_env(const char *name, int max, int initial); const char *qemu_ether_ntoa(const MACAddr *mac); void page_size_init(void); +/* returns non-zero if dump is in progress, otherwise zero is + * returned. */ +bool dump_in_progress(void); + #endif diff --git a/qmp.c b/qmp.c index 0a1fa19..055586d 100644 --- a/qmp.c +++ b/qmp.c @@ -102,6 +102,13 @@ void qmp_quit(Error **errp) void qmp_stop(Error **errp) { + /* 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; + } + if (runstate_check(RUN_STATE_INMIGRATE)) { autostart = 0; } else { @@ -174,6 +181,13 @@ void qmp_cont(Error **errp) BlockBackend *blk; BlockDriverState *bs; + /* 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; + } + if (runstate_needs_reset()) { error_setg(errp, "Resetting the Virtual Machine is required"); return; -- 2.4.3