vmm: Shutdown VM after migration succeeded

In case the migration succeeds, the destination VM will be correctly
running, with potential vhost-user backends attached to it. We can't let
the source VM trying to reconnect to the same backends, which is why
it's safer to shutdown the source VM.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-08-09 11:17:37 +02:00 committed by Bo Chen
parent c85aa6dfae
commit db444715fd

View File

@ -1133,7 +1133,7 @@ impl Vmm {
info!("Migration complete");
Ok(())
} {
// Stop logging dirty pages and keep the source VM paused unpon successful migration
// Stop logging dirty pages and shutdown the source VM paused unpon successful migration
Ok(()) => {
// Let every Migratable object know about the migration being complete
vm.complete_migration()?;
@ -1141,6 +1141,14 @@ impl Vmm {
// Stop logging dirty pages
vm.stop_dirty_log()?;
// Shutdown the VM after the migration succeeded
self.exit_evt.write(1).map_err(|e| {
MigratableError::MigrateSend(anyhow!(
"Failed shutting down the VM after migration: {:?}",
e
))
})?;
Ok(())
}
// Ensure the source VM continue to run upon unsuccessful migration