mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
@@ -966,7 +966,7 @@ impl DeviceManager {
|
||||
trace_scoped!("DeviceManager::new");
|
||||
|
||||
let (device_tree, device_id_cnt) = if let Some(snapshot) = snapshot.as_ref() {
|
||||
let state: DeviceManagerState = snapshot.to_state(DEVICE_MANAGER_SNAPSHOT_ID).unwrap();
|
||||
let state: DeviceManagerState = snapshot.to_state().unwrap();
|
||||
(
|
||||
Arc::new(Mutex::new(state.device_tree.clone())),
|
||||
state.device_id_cnt,
|
||||
@@ -1389,7 +1389,7 @@ impl DeviceManager {
|
||||
}
|
||||
|
||||
let vgic_state = vgic_snapshot
|
||||
.to_state(&id)
|
||||
.to_state()
|
||||
.map_err(DeviceManagerError::RestoreGetState)?;
|
||||
let saved_vcpu_states = self.cpu_manager.lock().unwrap().get_saved_states();
|
||||
interrupt_controller
|
||||
@@ -2150,7 +2150,7 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::EventFd)?,
|
||||
self.force_iommu,
|
||||
snapshot
|
||||
.map(|s| s.to_versioned_state(&id))
|
||||
.map(|s| s.to_versioned_state())
|
||||
.transpose()
|
||||
.map_err(DeviceManagerError::RestoreGetState)?,
|
||||
) {
|
||||
@@ -2249,7 +2249,7 @@ impl DeviceManager {
|
||||
.try_clone()
|
||||
.map_err(DeviceManagerError::EventFd)?,
|
||||
snapshot
|
||||
.map(|s| s.to_versioned_state(&id))
|
||||
.map(|s| s.to_versioned_state())
|
||||
.transpose()
|
||||
.map_err(DeviceManagerError::RestoreGetState)?,
|
||||
)
|
||||
@@ -2332,7 +2332,7 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::EventFd)?,
|
||||
self.force_iommu,
|
||||
snapshot
|
||||
.map(|s| s.to_versioned_state(&id))
|
||||
.map(|s| s.to_versioned_state())
|
||||
.transpose()
|
||||
.map_err(DeviceManagerError::RestoreGetState)?,
|
||||
) {
|
||||
@@ -2349,7 +2349,7 @@ impl DeviceManager {
|
||||
)
|
||||
} else {
|
||||
let state = snapshot
|
||||
.map(|s| s.to_versioned_state(&id))
|
||||
.map(|s| s.to_versioned_state())
|
||||
.transpose()
|
||||
.map_err(DeviceManagerError::RestoreGetState)?;
|
||||
|
||||
@@ -4456,10 +4456,7 @@ impl Snapshottable for DeviceManager {
|
||||
}
|
||||
|
||||
// Then we store the DeviceManager state.
|
||||
snapshot.add_data_section(SnapshotDataSection::new_from_state(
|
||||
DEVICE_MANAGER_SNAPSHOT_ID,
|
||||
&self.state(),
|
||||
)?);
|
||||
snapshot.add_data_section(SnapshotDataSection::new_from_state(&self.state())?);
|
||||
|
||||
Ok(snapshot)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user