From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zmc1G-00068K-Up for qemu-devel@nongnu.org; Thu, 15 Oct 2015 02:28:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zmc1G-0007Ml-0v for qemu-devel@nongnu.org; Thu, 15 Oct 2015 02:28:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zmc1F-0007Mh-Ry for qemu-devel@nongnu.org; Thu, 15 Oct 2015 02:28:05 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 9A395C0BFD24 for ; Thu, 15 Oct 2015 06:28:05 +0000 (UTC) From: Juan Quintela Date: Thu, 15 Oct 2015 08:27:59 +0200 Message-Id: <1444890480-6371-3-git-send-email-quintela@redhat.com> In-Reply-To: <1444890480-6371-1-git-send-email-quintela@redhat.com> References: <1444890480-6371-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 2/3] migration: announce VM's new home just before VM is runnable 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: Amit Shah We were announcing the dest host's IP as our new IP a bit too soon -- if there were errors detected after this announcement was done, the migration is failed and the VM could continue running on the src host -- causing problems later. Move around the qemu_announce_self() call so it's done just before the VM is runnable. Signed-off-by: Amit Shah Reviewed-by: Juan Quintela Reviewed-by: Michael S. Tsirkin Signed-off-by: Juan Quintela --- migration/migration.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 3d40f24..b092f38 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -294,7 +294,6 @@ static void process_incoming_migration_co(void *opaque) migrate_decompress_threads_join(); exit(EXIT_FAILURE); } - qemu_announce_self(); /* Make sure all file formats flush their mutable metadata */ bdrv_invalidate_cache_all(&local_err); @@ -305,6 +304,12 @@ static void process_incoming_migration_co(void *opaque) exit(EXIT_FAILURE); } + /* + * This must happen after all error conditions are dealt with and + * we're sure the VM is going to be running on this host. + */ + qemu_announce_self(); + /* If global state section was not received or we are in running state, we need to obey autostart. Any other state is set with runstate_set. */ -- 2.4.3