[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() help
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function |
Date: |
Wed, 24 Feb 2016 14:27:28 +0100 |
From: Peter Xu <address@hidden>
For now, it has no effect. It will be used in dump detach support.
Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
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 434bc60..158d6ea 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.
diff --git a/include/qemu-common.h b/include/qemu-common.h
index f557be7..59ab759 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -494,4 +494,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 9a93d5e..3f16a77 100644
--- a/qmp.c
+++ b/qmp.c
@@ -103,6 +103,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 {
@@ -175,6 +182,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.5.0
- [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 01/19] qemu-options.hx: Improve documentation of chardev multiplexing mode, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 02/19] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces., Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 05/19] dump-guest-memory: using static DumpState, add DumpStatus, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 03/19] dump-guest-memory: cleanup: removing dump_{error|cleanup}()., Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 08/19] dump-guest-memory: disable dump when in INMIGRATE state, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 09/19] dump-guest-memory: add "detach" support, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 07/19] dump-guest-memory: introduce dump_process() helper function., Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function,
Paolo Bonzini <=
- [Qemu-devel] [PULL 10/19] DumpState: adding total_size and written_size fields, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 12/19] Dump: add hmp command "info dump", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 11/19] Dump: add qmp command "query-dump", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Paolo Bonzini, 2016/02/24
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Ján Tomko, 2016/02/29
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Paolo Bonzini, 2016/02/29
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Ján Tomko, 2016/02/29
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Paolo Bonzini, 2016/02/29
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Ján Tomko, 2016/02/29
- Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Paolo Bonzini, 2016/02/29