From f65538b08ffdf2270383d024d4bc2235c112e496 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Mon, 9 Aug 2021 10:37:08 +0200 Subject: [PATCH] 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 --- vm-migration/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vm-migration/src/lib.rs b/vm-migration/src/lib.rs index 5e6664492..0bb3fe3b8 100644 --- a/vm-migration/src/lib.rs +++ b/vm-migration/src/lib.rs @@ -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 { Ok(MemoryRangeTable::default()) } + + fn complete_migration(&mut self) -> std::result::Result<(), MigratableError> { + Ok(()) + } }