aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-10-16 15:47:59 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-10-16 15:47:59 +0100
commite95bdb4341c36ee158ff9dda4ade3f94405c69ce (patch)
tree104c3d21ffafc2526fa9c85d3fae139776ec9465 /migration/migration.c
parentc49d3411faae8ffaab8f7e5db47405a008411c10 (diff)
parent60be6340796e66b5ac8aac2d98dde5c79336a89c (diff)
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into staging
migration/next for 20151015 # gpg: Signature made Thu 15 Oct 2015 07:25:27 BST using RSA key ID 5872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" * remotes/juanquintela/tags/migration/20151015: migration: fix deadlock migration: announce VM's new home just before VM is runnable Migration: Generate the completed event only when we complete Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c
index b7de9b7b3f..b092f386b4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -294,17 +294,22 @@ static void process_incoming_migration_co(void *opaque)
migrate_decompress_threads_join();
exit(EXIT_FAILURE);
}
- migrate_generate_event(MIGRATION_STATUS_COMPLETED);
- qemu_announce_self();
/* Make sure all file formats flush their mutable metadata */
bdrv_invalidate_cache_all(&local_err);
if (local_err) {
+ migrate_generate_event(MIGRATION_STATUS_FAILED);
error_report_err(local_err);
migrate_decompress_threads_join();
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. */
@@ -320,6 +325,12 @@ static void process_incoming_migration_co(void *opaque)
runstate_set(global_state_get_runstate());
}
migrate_decompress_threads_join();
+ /*
+ * This must happen after any state changes since as soon as an external
+ * observer sees this event they might start to prod at the VM assuming
+ * it's ready to use.
+ */
+ migrate_generate_event(MIGRATION_STATUS_COMPLETED);
}
void process_incoming_migration(QEMUFile *f)