From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvqGP-00049t-Q6 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:29:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvqGO-0004pl-0m for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:29:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvqGN-0004ph-Rl for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:29:51 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 976698E50E for ; Mon, 9 Nov 2015 17:29:51 +0000 (UTC) From: Juan Quintela Date: Mon, 9 Nov 2015 18:28:34 +0100 Message-Id: <1447090141-29074-31-git-send-email-quintela@redhat.com> In-Reply-To: <1447090141-29074-1-git-send-email-quintela@redhat.com> References: <1447090141-29074-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 30/57] migration_completion: Take current state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, dgilbert@redhat.com From: "Dr. David Alan Gilbert" Soon we'll be in either ACTIVE or POSTCOPY_ACTIVE when we complete migration, and we need to know which we expect to be in to change state safely. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f5cb9c5..d6f6f4c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1243,10 +1243,12 @@ static int await_return_path_close_on_source(MigrationState *ms) * The caller 'breaks' the loop when this returns. * * @s: Current migration state + * @current_active_state: The migration state we expect to be in * @*old_vm_running: Pointer to old_vm_running flag * @*start_time: Pointer to time to update */ -static void migration_completion(MigrationState *s, bool *old_vm_running, +static void migration_completion(MigrationState *s, int current_active_state, + bool *old_vm_running, int64_t *start_time) { int ret; @@ -1275,11 +1277,11 @@ static void migration_completion(MigrationState *s, bool *old_vm_running, goto fail; } - migrate_set_state(s, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COMPLETED); + migrate_set_state(s, current_active_state, MIGRATION_STATUS_COMPLETED); return; fail: - migrate_set_state(s, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); + migrate_set_state(s, current_active_state, MIGRATION_STATUS_FAILED); } /* @@ -1321,7 +1323,8 @@ static void *migration_thread(void *opaque) qemu_savevm_state_iterate(s->file); } else { trace_migration_thread_low_pending(pending_size); - migration_completion(s, &old_vm_running, &start_time); + migration_completion(s, MIGRATION_STATUS_ACTIVE, + &old_vm_running, &start_time); break; } } -- 2.5.0