Skip to content

Commit

Permalink
Migration: Generate the completed event only when we complete
Browse files Browse the repository at this point in the history
The current migration-completed event is generated a bit too early,
which means that an eager libvirt that's ready to go as soon
as it sees the event ends up racing with the actual end of migration.

This corresponds to RH bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1271145

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
xSigned-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit ed1f3e0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
dagrh authored and mdroth committed Oct 21, 2015
1 parent 8c4fa92 commit f62c10b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion migration/migration.c
Expand Up @@ -286,12 +286,12 @@ 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);
Expand All @@ -312,6 +312,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)
Expand Down

0 comments on commit f62c10b

Please sign in to comment.