vm-migration: Extend Migratable to notify when migration is complete

Add a way to let every Migratable object know when the migration is
complete, so they can take appropriate actions.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-08-09 10:37:08 +02:00 committed by Bo Chen
parent 152a3b98c9
commit f65538b08f

View File

@ -56,6 +56,9 @@ pub enum MigratableError {
#[error("Failed to retrieve dirty ranges for migratable component: {0}")]
DirtyLog(#[source] anyhow::Error),
#[error("Failed to complete migration for migratable component: {0}")]
CompleteMigration(#[source] anyhow::Error),
}
/// A Pausable component can be paused and resumed.
@ -301,4 +304,8 @@ pub trait Migratable: Send + Pausable + Snapshottable + Transportable {
fn dirty_log(&mut self) -> std::result::Result<MemoryRangeTable, MigratableError> {
Ok(MemoryRangeTable::default())
}
fn complete_migration(&mut self) -> std::result::Result<(), MigratableError> {
Ok(())
}
}