aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sysemu/replay.h2
-rw-r--r--migration/savevm.c12
-rw-r--r--replay/replay-events.c4
-rw-r--r--replay/replay-internal.h2
4 files changed, 12 insertions, 8 deletions
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index d6026ed..c486c3a 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -149,6 +149,8 @@ void replay_disable_events(void);
void replay_enable_events(void);
/*! Returns true when saving events is enabled */
bool replay_events_enabled(void);
+/* Flushes events queue */
+void replay_flush_events(void);
/*! Adds bottom half event to the queue */
void replay_bh_schedule_event(QEMUBH *bh);
/* Adds oneshot bottom half event to the queue */
diff --git a/migration/savevm.c b/migration/savevm.c
index 0e8dc78..d2e141f 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2881,12 +2881,6 @@ int load_snapshot(const char *name, Error **errp)
AioContext *aio_context;
MigrationIncomingState *mis = migration_incoming_get_current();
- if (!replay_can_snapshot()) {
- error_setg(errp, "Record/replay does not allow loading snapshot "
- "right now. Try once more later.");
- return -EINVAL;
- }
-
if (!bdrv_all_can_snapshot(&bs)) {
error_setg(errp,
"Device '%s' is writable but does not support snapshots",
@@ -2920,6 +2914,12 @@ int load_snapshot(const char *name, Error **errp)
return -EINVAL;
}
+ /*
+ * Flush the record/replay queue. Now the VM state is going
+ * to change. Therefore we don't need to preserve its consistency
+ */
+ replay_flush_events();
+
/* Flush all IO requests so they don't interfere with the new state. */
bdrv_drain_all_begin();
diff --git a/replay/replay-events.c b/replay/replay-events.c
index 302b840..a1c6bb9 100644
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -77,6 +77,10 @@ bool replay_has_events(void)
void replay_flush_events(void)
{
+ if (replay_mode == REPLAY_MODE_NONE) {
+ return;
+ }
+
g_assert(replay_mutex_locked());
while (!QTAILQ_EMPTY(&events_list)) {
diff --git a/replay/replay-internal.h b/replay/replay-internal.h
index 2f6145e..97649ed 100644
--- a/replay/replay-internal.h
+++ b/replay/replay-internal.h
@@ -149,8 +149,6 @@ void replay_read_next_clock(unsigned int kind);
void replay_init_events(void);
/*! Clears internal data structures for events handling */
void replay_finish_events(void);
-/*! Flushes events queue */
-void replay_flush_events(void);
/*! Returns true if there are any unsaved events in the queue */
bool replay_has_events(void);
/*! Saves events from queue into the file */