|
|
9ae3a8 |
From 68ed14180549185ab27c37baacd47843ae45511c Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 13 Dec 2017 13:38:56 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 25/41] dump-guest-memory: add dump_in_progress() helper
|
|
|
9ae3a8 |
function
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171213133912.26176-26-marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78376
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 25/41] dump-guest-memory: add dump_in_progress() helper function
|
|
|
9ae3a8 |
Bugzilla: 1411490
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Peter Xu <peterx@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
For now, it has no effect. It will be used in dump detach support.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-Id: <1455772616-8668-5-git-send-email-peterx@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(cherry picked from commit 65d64f362326a57b590b8b76e3422030a2aa5c44)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL: minor conflict in function declaration area.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
dump.c | 13 +++++++++++++
|
|
|
9ae3a8 |
include/qemu-common.h | 4 ++++
|
|
|
9ae3a8 |
qmp.c | 14 ++++++++++++++
|
|
|
9ae3a8 |
3 files changed, 31 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/dump.c b/dump.c
|
|
|
9ae3a8 |
index 254c0ba..639d52a 100644
|
|
|
9ae3a8 |
--- a/dump.c
|
|
|
9ae3a8 |
+++ b/dump.c
|
|
|
9ae3a8 |
@@ -1455,6 +1455,12 @@ static void dump_state_prepare(DumpState *s)
|
|
|
9ae3a8 |
*s = (DumpState) { .status = DUMP_STATUS_ACTIVE };
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+bool dump_in_progress(void)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ DumpState *state = &dump_state_global;
|
|
|
9ae3a8 |
+ return (state->status == DUMP_STATUS_ACTIVE);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static void dump_init(DumpState *s, int fd, bool has_format,
|
|
|
9ae3a8 |
DumpGuestMemoryFormat format, bool paging, bool has_filter,
|
|
|
9ae3a8 |
int64_t begin, int64_t length, Error **errp)
|
|
|
9ae3a8 |
@@ -1632,6 +1638,13 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|
|
9ae3a8 |
DumpState *s;
|
|
|
9ae3a8 |
Error *local_err = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ /* if there is a dump in background, we should wait until the dump
|
|
|
9ae3a8 |
+ * finished */
|
|
|
9ae3a8 |
+ if (dump_in_progress()) {
|
|
|
9ae3a8 |
+ error_setg(errp, "There is a dump in process, please wait.");
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
/*
|
|
|
9ae3a8 |
* kdump-compressed format need the whole memory dumped, so paging or
|
|
|
9ae3a8 |
* filter is not supported here.
|
|
|
9ae3a8 |
diff --git a/include/qemu-common.h b/include/qemu-common.h
|
|
|
9ae3a8 |
index 8c1132c..4569d52 100644
|
|
|
9ae3a8 |
--- a/include/qemu-common.h
|
|
|
9ae3a8 |
+++ b/include/qemu-common.h
|
|
|
9ae3a8 |
@@ -481,4 +481,8 @@ size_t buffer_find_nonzero_offset(const void *buf, size_t len);
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
int parse_debug_env(const char *name, int max, int initial);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+/* returns non-zero if dump is in progress, otherwise zero is
|
|
|
9ae3a8 |
+ * returned. */
|
|
|
9ae3a8 |
+bool dump_in_progress(void);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
diff --git a/qmp.c b/qmp.c
|
|
|
9ae3a8 |
index 4c149b3..5996056 100644
|
|
|
9ae3a8 |
--- a/qmp.c
|
|
|
9ae3a8 |
+++ b/qmp.c
|
|
|
9ae3a8 |
@@ -87,6 +87,13 @@ void qmp_quit(Error **err)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void qmp_stop(Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ /* if there is a dump in background, we should wait until the dump
|
|
|
9ae3a8 |
+ * finished */
|
|
|
9ae3a8 |
+ if (dump_in_progress()) {
|
|
|
9ae3a8 |
+ error_setg(errp, "There is a dump in process, please wait.");
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
|
|
9ae3a8 |
autostart = 0;
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
@@ -159,6 +166,13 @@ void qmp_cont(Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
Error *local_err = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ /* if there is a dump in background, we should wait until the dump
|
|
|
9ae3a8 |
+ * finished */
|
|
|
9ae3a8 |
+ if (dump_in_progress()) {
|
|
|
9ae3a8 |
+ error_setg(errp, "There is a dump in process, please wait.");
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (runstate_needs_reset()) {
|
|
|
9ae3a8 |
error_set(errp, QERR_RESET_REQUIRED);
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|