mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 11:35:46 +00:00
vmm: Don't use migratable_devices for restore
This commit switches from migratable_devices to device_tree in order to restore devices exclusively based on the device tree. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
bc6084390f
commit
1be7037229
@ -3162,9 +3162,11 @@ impl Snapshottable for DeviceManager {
|
|||||||
let mut snapshot = Snapshot::new(DEVICE_MANAGER_SNAPSHOT_ID);
|
let mut snapshot = Snapshot::new(DEVICE_MANAGER_SNAPSHOT_ID);
|
||||||
|
|
||||||
// We aggregate all devices snapshots.
|
// We aggregate all devices snapshots.
|
||||||
for (_, dev) in self.migratable_devices.iter() {
|
for (_, device_node) in self.device_tree.iter() {
|
||||||
let device_snapshot = dev.lock().unwrap().snapshot()?;
|
if let Some(migratable) = &device_node.migratable {
|
||||||
snapshot.add_snapshot(device_snapshot);
|
let device_snapshot = migratable.lock().unwrap().snapshot()?;
|
||||||
|
snapshot.add_snapshot(device_snapshot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then we store the DeviceManager state.
|
// Then we store the DeviceManager state.
|
||||||
@ -3212,10 +3214,10 @@ impl Snapshottable for DeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore the node
|
// Restore the node
|
||||||
if let Some(device) = self.migratable_devices.get(id) {
|
if let Some(migratable) = &node.migratable {
|
||||||
debug!("Restoring {} from DeviceManager", id);
|
debug!("Restoring {} from DeviceManager", id);
|
||||||
if let Some(snapshot) = snapshot.snapshots.get(id) {
|
if let Some(snapshot) = snapshot.snapshots.get(id) {
|
||||||
device.lock().unwrap().restore(*snapshot.clone())?;
|
migratable.lock().unwrap().restore(*snapshot.clone())?;
|
||||||
} else {
|
} else {
|
||||||
return Err(MigratableError::Restore(anyhow!("Missing device {}", id)));
|
return Err(MigratableError::Restore(anyhow!("Missing device {}", id)));
|
||||||
}
|
}
|
||||||
@ -3223,15 +3225,17 @@ impl Snapshottable for DeviceManager {
|
|||||||
|
|
||||||
// Restore the parent if it exists
|
// Restore the parent if it exists
|
||||||
if let Some(parent) = &node.parent {
|
if let Some(parent) = &node.parent {
|
||||||
if let Some(device) = self.migratable_devices.get(parent) {
|
if let Some(node) = self.device_tree.get(parent) {
|
||||||
debug!("Restoring {} from DeviceManager", parent);
|
if let Some(migratable) = &node.migratable {
|
||||||
if let Some(snapshot) = snapshot.snapshots.get(parent) {
|
debug!("Restoring {} from DeviceManager", parent);
|
||||||
device.lock().unwrap().restore(*snapshot.clone())?;
|
if let Some(snapshot) = snapshot.snapshots.get(parent) {
|
||||||
} else {
|
migratable.lock().unwrap().restore(*snapshot.clone())?;
|
||||||
return Err(MigratableError::Restore(anyhow!(
|
} else {
|
||||||
"Missing parent device {}",
|
return Err(MigratableError::Restore(anyhow!(
|
||||||
id
|
"Missing parent device {}",
|
||||||
)));
|
id
|
||||||
|
)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user