vm-migration: Snapshot should have a unique SnapshotDataSection

There's no reason to carry a HashMap of SnapshotDataSection per
Snapshot. And given we now provide at most one SnapshotDataSection per
Snapshot, there's no need to keep the id part of the SnapshotDataSection
structure.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-12-02 14:37:49 +01:00
parent 0489b6314e
commit 5b3bcfa233
8 changed files with 36 additions and 63 deletions

View File

@@ -1160,9 +1160,8 @@ impl MemoryManager {
let mut memory_file_path = url_to_path(source_url).map_err(Error::Restore)?;
memory_file_path.push(String::from(SNAPSHOT_FILENAME));
let mem_snapshot: MemoryManagerSnapshotData = snapshot
.to_versioned_state(MEMORY_MANAGER_SNAPSHOT_ID)
.map_err(Error::Restore)?;
let mem_snapshot: MemoryManagerSnapshotData =
snapshot.to_versioned_state().map_err(Error::Restore)?;
let mm = MemoryManager::new(
vm,
@@ -2444,7 +2443,6 @@ impl Snapshottable for MemoryManager {
self.snapshot_memory_ranges = memory_ranges;
memory_manager_snapshot.add_data_section(SnapshotDataSection::new_from_versioned_state(
MEMORY_MANAGER_SNAPSHOT_ID,
&self.snapshot_data(),
)?);