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

@@ -403,10 +403,7 @@ impl Snapshottable for Vcpu {
// TODO: The special format of the CPU id can be removed once ready to
// break live upgrade.
let mut vcpu_snapshot = Snapshot::new(&format!("{:03}", self.id));
vcpu_snapshot.add_data_section(SnapshotDataSection::new_from_state(
VCPU_SNAPSHOT_ID,
&saved_state,
)?);
vcpu_snapshot.add_data_section(SnapshotDataSection::new_from_state(&saved_state)?);
self.saved_state = Some(saved_state);
@@ -717,7 +714,7 @@ impl CpuManager {
#[cfg(target_arch = "aarch64")]
vcpu.init(&self.vm)?;
let state: CpuState = snapshot.to_state(VCPU_SNAPSHOT_ID).map_err(|e| {
let state: CpuState = snapshot.to_state().map_err(|e| {
Error::VcpuCreate(anyhow!("Could not get vCPU state from snapshot {:?}", e))
})?;
vcpu.vcpu