vmm: vm: Implement the Snapshottable trait

By aggregating snapshots from the CpuManager, the MemoryManager and the
DeviceManager, Vm implements the snapshot() function from the
Snapshottable trait.
And by restoring snapshots from the CpuManager, the MemoryManager and
the DeviceManager, Vm implements the restore() function from the
Snapshottable trait.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-05-12 19:53:47 +08:00
committed by Sebastien Boeuf
parent 20ba271b6c
commit 1ed357cf34
5 changed files with 138 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
//
use crate::config::{HotplugMethod, MemoryConfig};
use crate::MEMORY_MANAGER_SNAPSHOT_ID;
#[cfg(feature = "acpi")]
use acpi_tables::{aml, aml::Aml};
use anyhow::anyhow;
@@ -930,7 +931,6 @@ pub struct MemoryManagerSnapshotData {
memory_regions: Vec<MemoryRegion>,
}
const MEMORY_MANAGER_SNAPSHOT_ID: &str = "memory-manager";
impl Snapshottable for MemoryManager {
fn id(&self) -> String {
MEMORY_MANAGER_SNAPSHOT_ID.to_string()