[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/40] migration: migration_stop_vm() helper
From: |
Juan Quintela |
Subject: |
[PULL 18/40] migration: migration_stop_vm() helper |
Date: |
Thu, 2 Nov 2023 12:40:32 +0100 |
From: Peter Xu <peterx@redhat.com>
Provide a helper for non-COLO use case of migration to stop a VM. This
prepares for adding some downtime relevant tracepoints to migration, where
they may or may not apply to COLO.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231030163346.765724-5-peterx@redhat.com>
---
migration/migration.h | 2 ++
migration/migration.c | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/migration/migration.h b/migration/migration.h
index ae82004892..5944107ad5 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -544,4 +544,6 @@ void migration_rp_wait(MigrationState *s);
*/
void migration_rp_kick(MigrationState *s);
+int migration_stop_vm(RunState state);
+
#endif
diff --git a/migration/migration.c b/migration/migration.c
index 8aac0c753e..3e38294485 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -149,6 +149,11 @@ static gint page_request_addr_cmp(gconstpointer ap,
gconstpointer bp)
return (a > b) - (a < b);
}
+int migration_stop_vm(RunState state)
+{
+ return vm_stop_force_state(state);
+}
+
void migration_object_init(void)
{
/* This can only be called once. */
@@ -2169,7 +2174,7 @@ static int postcopy_start(MigrationState *ms, Error
**errp)
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL);
global_state_store();
- ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
+ ret = migration_stop_vm(RUN_STATE_FINISH_MIGRATE);
if (ret < 0) {
goto fail;
}
@@ -2371,7 +2376,7 @@ static int migration_completion_precopy(MigrationState *s,
s->vm_old_state = runstate_get();
global_state_store();
- ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
+ ret = migration_stop_vm(RUN_STATE_FINISH_MIGRATE);
trace_migration_completion_vm_stop(ret);
if (ret < 0) {
goto out_unlock;
@@ -3222,7 +3227,7 @@ static void *bg_migration_thread(void *opaque)
global_state_store();
/* Forcibly stop VM before saving state of vCPUs and devices */
- if (vm_stop_force_state(RUN_STATE_PAUSED)) {
+ if (migration_stop_vm(RUN_STATE_PAUSED)) {
goto fail;
}
/*
--
2.41.0
- [PULL 06/40] migration: Use vmstate_register_any(), (continued)
- [PULL 06/40] migration: Use vmstate_register_any(), Juan Quintela, 2023/11/02
- [PULL 07/40] migration: Use vmstate_register_any() for isa-ide, Juan Quintela, 2023/11/02
- [PULL 09/40] migration: Hack to maintain backwards compatibility for ppc, Juan Quintela, 2023/11/02
- [PULL 08/40] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp, Juan Quintela, 2023/11/02
- [PULL 12/40] migration: Use vmstate_register_any() for audio, Juan Quintela, 2023/11/02
- [PULL 10/40] migration: Check in savevm_state_handler_insert for dups, Juan Quintela, 2023/11/02
- [PULL 11/40] migration: Improve example and documentation of vmstate_register(), Juan Quintela, 2023/11/02
- [PULL 13/40] migration: Use vmstate_register_any() for eeprom93xx, Juan Quintela, 2023/11/02
- [PULL 14/40] migration: Use vmstate_register_any() for vmware_vga, Juan Quintela, 2023/11/02
- [PULL 15/40] migration: Set downtime_start even for postcopy, Juan Quintela, 2023/11/02
- [PULL 18/40] migration: migration_stop_vm() helper,
Juan Quintela <=
- [PULL 21/40] migration: per-mode blockers, Juan Quintela, 2023/11/02
- [PULL 16/40] migration: Add migration_downtime_start|end() helpers, Juan Quintela, 2023/11/02
- [PULL 17/40] migration: Add per vmstate downtime tracepoints, Juan Quintela, 2023/11/02
- [PULL 19/40] migration: Add tracepoints for downtime checkpoints, Juan Quintela, 2023/11/02
- [PULL 22/40] cpr: relax blockdev migration blockers, Juan Quintela, 2023/11/02
- [PULL 20/40] migration: mode parameter, Juan Quintela, 2023/11/02
- [PULL 23/40] cpr: relax vhost migration blockers, Juan Quintela, 2023/11/02