vm-migration: Don't store the id as part of Snapshot structure

The information about the identifier related to a Snapshot is only
relevant from the BTreeMap perspective, which is why we can get rid of
the duplicated identifier in every Snapshot structure.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-12-02 15:31:53 +01:00
parent 426ee39972
commit 748018ace3
32 changed files with 76 additions and 85 deletions
@@ -321,7 +321,7 @@ impl Snapshottable for VirtioPciCommonConfig {
}
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
Snapshot::new_from_versioned_state(&self.id(), &self.state())
Snapshot::new_from_versioned_state(&self.state())
}
}
+7 -5
View File
@@ -1272,18 +1272,20 @@ impl Snapshottable for VirtioPciDevice {
}
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
let mut virtio_pci_dev_snapshot =
Snapshot::new_from_versioned_state(&self.id, &self.state())?;
let mut virtio_pci_dev_snapshot = Snapshot::new_from_versioned_state(&self.state())?;
// Snapshot PciConfiguration
virtio_pci_dev_snapshot.add_snapshot(self.configuration.snapshot()?);
virtio_pci_dev_snapshot
.add_snapshot(self.configuration.id(), self.configuration.snapshot()?);
// Snapshot VirtioPciCommonConfig
virtio_pci_dev_snapshot.add_snapshot(self.common_config.snapshot()?);
virtio_pci_dev_snapshot
.add_snapshot(self.common_config.id(), self.common_config.snapshot()?);
// Snapshot MSI-X
if let Some(msix_config) = &self.msix_config {
virtio_pci_dev_snapshot.add_snapshot(msix_config.lock().unwrap().snapshot()?);
let mut msix_config = msix_config.lock().unwrap();
virtio_pci_dev_snapshot.add_snapshot(msix_config.id(), msix_config.snapshot()?);
}
Ok(virtio_pci_dev_snapshot)