migration: Replace current_migration with migrate_get_current()
Replaces the direct accesses to global variable `current_migration` with `migrate_get_current()` to ensure consistency across systems. Note: Following this only direct access to `current_migration` will be * `migrate_get_current()` itself * `migration_object_init()` initializes `current_migration` * `migration_shutdown()` to pair up with initialization * `migration_is_running()`, as there might be a case where this function is called by a thread before object initialization Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com> Link: https://lore.kernel.org/r/20260513063513.250911-1-aadeshveer07@gmail.com Signed-off-by: Peter Xu <peterx@redhat.com>
Aadeshveer Singh committed
May 13, 2026 at 12:05 UTC
3df0f524a587276c8eab7e54144f46aabc1a158c
1 file changed
+3
-3
migration/migration.c
+3
-3
@@ -1030,7 +1030,7 @@ bool migration_is_running(void)
1030
1031
static bool migration_is_active(void)
1032
{
1033
- MigrationState *s = current_migration;
1033
+ MigrationState *s = migrate_get_current();
1034
1035
return (s->state == MIGRATION_STATUS_ACTIVE ||
1036
s->state == MIGRATION_STATUS_POSTCOPY_DEVICE ||
@@ -1657,7 +1657,7 @@ bool migration_in_bg_snapshot(void)
1657
1658
bool migration_thread_is_self(void)
1659
{
1660
- MigrationState *s = current_migration;
1660
+ MigrationState *s = migrate_get_current();
1661
1662
return qemu_thread_is_self(&s->thread);
1663
}
@@ -3095,7 +3095,7 @@ static MigThrError postcopy_pause(MigrationState *s)
3095
3096
void migration_file_set_error(int ret, Error *err)
3097
{
3098
- MigrationState *s = current_migration;
3098
+ MigrationState *s = migrate_get_current();
3099
3100
WITH_QEMU_LOCK_GUARD(&s->qemu_file_lock) {
3101
if (s->to_dst_file) {