[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V2 04/10] migration: preserve suspended for snapshot
From: |
Steve Sistare |
Subject: |
[PATCH V2 04/10] migration: preserve suspended for snapshot |
Date: |
Fri, 30 Jun 2023 06:49:42 -0700 |
Restoring a snapshot can break a suspended guest.
If a guest is suspended and saved to a snapshot using savevm, and qemu
is terminated and restarted with the -S option, then loadvm does not
restore the guest. The runstate is running, but the guest is not, because
vm_start was not called. The root cause is that loadvm does not restore
the runstate (eg suspended) from global_state loaded from the state file.
Restore the runstate, and allow the new state transitions that are possible.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
migration/savevm.c | 1 +
softmmu/runstate.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index e0f4972..972d183 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -3139,6 +3139,7 @@ bool load_snapshot(const char *name, const char *vmstate,
}
aio_context_acquire(aio_context);
ret = qemu_loadvm_state(f);
+ migrate_set_runstate();
migration_incoming_state_destroy();
aio_context_release(aio_context);
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 5bbb22a..18efe31 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -77,6 +77,8 @@ typedef struct {
static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
+ { RUN_STATE_PRELAUNCH, RUN_STATE_PAUSED },
+ { RUN_STATE_PRELAUNCH, RUN_STATE_SUSPENDED },
{ RUN_STATE_DEBUG, RUN_STATE_RUNNING },
{ RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
--
1.8.3.1
- [PATCH V2 00/10] fix migration of suspended runstate, Steve Sistare, 2023/06/30
- [PATCH V2 02/10] migration: preserve suspended runstate, Steve Sistare, 2023/06/30
- [PATCH V2 05/10] migration: preserve suspended for bg_migration, Steve Sistare, 2023/06/30
- [PATCH V2 09/10] tests/qtest: postcopy migration with suspend, Steve Sistare, 2023/06/30
- [PATCH V2 03/10] migration: add runstate function, Steve Sistare, 2023/06/30
- [PATCH V2 08/10] tests/qtest: precopy migration with suspend, Steve Sistare, 2023/06/30
- [PATCH V2 10/10] tests/qtest: background migration with suspend, Steve Sistare, 2023/06/30
- [PATCH V2 07/10] tests/qtest: option to suspend during migration, Steve Sistare, 2023/06/30
- [PATCH V2 01/10] vl: start on wakeup request, Steve Sistare, 2023/06/30
- [PATCH V2 04/10] migration: preserve suspended for snapshot,
Steve Sistare <=
- [PATCH V2 06/10] tests/qtest: migration events, Steve Sistare, 2023/06/30