From 093e3c429693f87fb917424c637ad8f599bd9e67 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 5 Nov 2015 18:10:52 +0000 Subject: Add wrappers and handlers for sending/receiving the postcopy-ram migration messages. The state of the postcopy process is managed via a series of messages; * Add wrappers and handlers for sending/receiving these messages * Add state variable that track the current state of postcopy Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Amit Shah Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'migration/migration.c') diff --git a/migration/migration.c b/migration/migration.c index f849f890d9..7097e5bfe2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -57,6 +57,13 @@ static NotifierList migration_state_notifiers = static bool deferred_incoming; +/* + * Current state of incoming postcopy; note this is not part of + * MigrationIncomingState since it's state is used during cleanup + * at the end as MIS is being freed. + */ +static PostcopyState incoming_postcopy_state; + /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -284,6 +291,7 @@ static void process_incoming_migration_co(void *opaque) int ret; migration_incoming_state_new(f); + postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_generate_event(MIGRATION_STATUS_ACTIVE); ret = qemu_loadvm_state(f); @@ -1367,3 +1375,15 @@ void migrate_fd_connect(MigrationState *s) qemu_thread_create(&s->thread, "migration", migration_thread, s, QEMU_THREAD_JOINABLE); } + +PostcopyState postcopy_state_get(void) +{ + return atomic_mb_read(&incoming_postcopy_state); +} + +/* Set the state and return the old state */ +PostcopyState postcopy_state_set(PostcopyState new_state) +{ + return atomic_xchg(&incoming_postcopy_state, new_state); +} + -- cgit v1.2.1