diff --git a/vm-migration/src/lib.rs b/vm-migration/src/lib.rs index 93a92b8d0..6058546a2 100644 --- a/vm-migration/src/lib.rs +++ b/vm-migration/src/lib.rs @@ -6,6 +6,7 @@ #[macro_use] extern crate serde_derive; +use crate::protocol::MemoryRangeTable; use anyhow::anyhow; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -46,6 +47,15 @@ pub enum MigratableError { #[error("Socket error: {0}")] MigrateSocket(#[source] std::io::Error), + + #[error("Failed to start migration for migratable component: {0}")] + MigrateStart(#[source] anyhow::Error), + + #[error("Failed to stop migration for migratable component: {0}")] + MigrateStop(#[source] anyhow::Error), + + #[error("Failed to retrieve dirty ranges for migratable component: {0}")] + MigrateDirtyRanges(#[source] anyhow::Error), } /// A Pausable component can be paused and resumed. @@ -279,4 +289,16 @@ pub trait Transportable: Pausable + Snapshottable { /// and Snapshottable. /// Moreover a migratable component can be transported to a remote or local /// destination and thus must be Transportable. -pub trait Migratable: Send + Pausable + Snapshottable + Transportable {} +pub trait Migratable: Send + Pausable + Snapshottable + Transportable { + fn start_dirty_log(&mut self) -> std::result::Result<(), MigratableError> { + Ok(()) + } + + fn stop_dirty_log(&mut self) -> std::result::Result<(), MigratableError> { + Ok(()) + } + + fn dirty_log(&mut self) -> std::result::Result { + Ok(MemoryRangeTable::default()) + } +}