mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-migration: Introduce new constructor for Snapshot
This simplifies the Snapshot creation as we expect a SnapshotData to be provided most of the time. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -2428,8 +2428,6 @@ impl Snapshottable for MemoryManager {
|
||||
}
|
||||
|
||||
fn snapshot(&mut self) -> result::Result<Snapshot, MigratableError> {
|
||||
let mut memory_manager_snapshot = Snapshot::default();
|
||||
|
||||
let memory_ranges = self.memory_range_table(true)?;
|
||||
|
||||
// Store locally this list of ranges as it will be used through the
|
||||
@@ -2442,11 +2440,9 @@ impl Snapshottable for MemoryManager {
|
||||
// memory range content for the ranges requiring it.
|
||||
self.snapshot_memory_ranges = memory_ranges;
|
||||
|
||||
memory_manager_snapshot.add_data(SnapshotData::new_from_versioned_state(
|
||||
Ok(Snapshot::from_data(SnapshotData::new_from_versioned_state(
|
||||
&self.snapshot_data(),
|
||||
)?);
|
||||
|
||||
Ok(memory_manager_snapshot)
|
||||
)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user