summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2015-10-14 17:37:19 +0530
committerJuan Quintela <quintela@redhat.com>2015-10-15 08:13:03 +0200
commit92e3762237475407fe03e1ccac6e30612ab96caf (patch)
tree2895816e01bde9abaecbd61ede9c09b52f1f61a8
parented1f3e0090069dcb9458aa9e450df12bf8eba0b0 (diff)
downloadfocaccia-qemu-92e3762237475407fe03e1ccac6e30612ab96caf.tar.gz
focaccia-qemu-92e3762237475407fe03e1ccac6e30612ab96caf.zip
migration: announce VM's new home just before VM is runnable
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 <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r--migration/migration.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 3d40f24556..b092f386b4 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. */