[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V2 04/13] migration: stop vm earlier for cpr
From: |
Steve Sistare |
Subject: |
[PATCH V2 04/13] migration: stop vm earlier for cpr |
Date: |
Mon, 30 Sep 2024 12:40:35 -0700 |
Stop the vm earlier for cpr, to guarantee consistent device state when
CPR state is saved.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
migration/migration.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index df00e5c..868bf0e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2082,6 +2082,7 @@ void qmp_migrate(const char *uri, bool has_channels,
MigrationState *s = migrate_get_current();
g_autoptr(MigrationChannel) channel = NULL;
MigrationAddress *addr = NULL;
+ bool stopped = false;
/*
* Having preliminary checks for uri and channel
@@ -2125,6 +2126,15 @@ void qmp_migrate(const char *uri, bool has_channels,
}
}
+ if (migrate_mode_is_cpr(s)) {
+ int ret = migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE);
+ if (ret < 0) {
+ error_setg(&local_err, "migration_stop_vm failed, error %d", -ret);
+ goto out;
+ }
+ stopped = true;
+ }
+
if (cpr_state_save(&local_err)) {
goto out;
}
@@ -2160,6 +2170,9 @@ out:
}
migrate_fd_error(s, local_err);
error_propagate(errp, local_err);
+ if (stopped) {
+ vm_resume(s->vm_old_state);
+ }
return;
}
}
@@ -3743,7 +3756,6 @@ void migrate_fd_connect(MigrationState *s, Error
*error_in)
Error *local_err = NULL;
uint64_t rate_limit;
bool resume = (s->state == MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP);
- int ret;
/*
* If there's a previous error, free it and prepare for another one.
@@ -3815,14 +3827,6 @@ void migrate_fd_connect(MigrationState *s, Error
*error_in)
return;
}
- if (migrate_mode_is_cpr(s)) {
- ret = migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE);
- if (ret < 0) {
- error_setg(&local_err, "migration_stop_vm failed, error %d", -ret);
- goto fail;
- }
- }
-
if (migrate_background_snapshot()) {
qemu_thread_create(&s->thread, "mig/snapshot",
bg_migration_thread, s, QEMU_THREAD_JOINABLE);
--
1.8.3.1
- [PATCH V2 00/13] Live update: cpr-transfer, Steve Sistare, 2024/09/30
- [PATCH V2 01/13] machine: alloc-anon option, Steve Sistare, 2024/09/30
- [PATCH V2 03/13] migration: save cpr mode, Steve Sistare, 2024/09/30
- [PATCH V2 02/13] migration: cpr-state, Steve Sistare, 2024/09/30
- [PATCH V2 05/13] physmem: preserve ram blocks for cpr, Steve Sistare, 2024/09/30
- [PATCH V2 04/13] migration: stop vm earlier for cpr,
Steve Sistare <=
- [PATCH V2 06/13] hostmem-memfd: preserve for cpr, Steve Sistare, 2024/09/30
- [PATCH V2 07/13] migration: SCM_RIGHTS for QEMUFile, Steve Sistare, 2024/09/30
- [PATCH V2 09/13] migration: cpr-transfer save and load, Steve Sistare, 2024/09/30
- [PATCH V2 08/13] migration: VMSTATE_FD, Steve Sistare, 2024/09/30
- [PATCH V2 10/13] migration: cpr-uri parameter, Steve Sistare, 2024/09/30
- [PATCH V2 11/13] migration: cpr-uri option, Steve Sistare, 2024/09/30
- [PATCH V2 12/13] migration: split qmp_migrate, Steve Sistare, 2024/09/30
- [PATCH V2 13/13] migration: cpr-transfer mode, Steve Sistare, 2024/09/30