aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-05-15 16:06:40 +0300
committerJuan Quintela <quintela@redhat.com>2023-05-18 18:40:51 +0200
commitd0a14a2ba01c7b200e6ce3e7979e1ed3ede1d5c7 (patch)
treed1ea02b4b95b9946d28a3c4e37f0c93d6584f065 /migration/migration.c
parentdd42ce24a3cda4be3c839aceb91fdf85e31c194f (diff)
downloadqemu-d0a14a2ba01c7b200e6ce3e7979e1ed3ede1d5c7.zip
qemu-d0a14a2ba01c7b200e6ce3e7979e1ed3ede1d5c7.tar.gz
qemu-d0a14a2ba01c7b200e6ce3e7979e1ed3ede1d5c7.tar.bz2
migration: process_incoming_migration_co(): move colo part to colo
Let's make better public interface for COLO: instead of colo_process_incoming_thread and not trivial logic around creating the thread let's make simple colo_incoming_co(), hiding implementation from generic code. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230515130640.46035-4-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/migration/migration.c b/migration/migration.c
index a6f2f6c..039bba4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -511,7 +511,6 @@ process_incoming_migration_co(void *opaque)
MigrationIncomingState *mis = migration_incoming_get_current();
PostcopyState ps;
int ret;
- Error *local_err = NULL;
assert(mis->from_src_file);
@@ -555,37 +554,14 @@ process_incoming_migration_co(void *opaque)
goto fail;
}
- /* we get COLO info, and know if we are in COLO mode */
- if (migration_incoming_colo_enabled()) {
- QemuThread colo_incoming_thread;
-
- /* Make sure all file formats throw away their mutable metadata */
- bdrv_activate_all(&local_err);
- if (local_err) {
- error_report_err(local_err);
- goto fail;
- }
-
- qemu_thread_create(&colo_incoming_thread, "COLO incoming",
- colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE);
-
- mis->colo_incoming_co = qemu_coroutine_self();
- qemu_coroutine_yield();
- mis->colo_incoming_co = NULL;
-
- qemu_mutex_unlock_iothread();
- /* Wait checkpoint incoming thread exit before free resource */
- qemu_thread_join(&colo_incoming_thread);
- qemu_mutex_lock_iothread();
- /* We hold the global iothread lock, so it is safe here */
- colo_release_ram_cache();
+ if (colo_incoming_co() < 0) {
+ goto fail;
}
mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);
qemu_bh_schedule(mis->bh);
return;
fail:
- local_err = NULL;
migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
MIGRATION_STATUS_FAILED);
qemu_fclose(mis->from_src_file);