mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vm-migration: Extend Migratable trait
Add new methods to the Migratable trait so that each device implementing this trait can be notified when the migration starts/stops, as well as when a dirty bitmap must be returned. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
79425b6aa8
commit
c1b962048c
@ -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<MemoryRangeTable, MigratableError> {
|
||||
Ok(MemoryRangeTable::default())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user