mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 23:41:15 +00:00
virtio-devices: pci_device: Deserialise section directly to state
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
08c4e5031f
commit
85f7913bb3
@ -1117,19 +1117,9 @@ impl Snapshottable for VirtioPciDevice {
|
|||||||
self.configuration.restore(*pci_config_snapshot.clone())?;
|
self.configuration.restore(*pci_config_snapshot.clone())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let virtio_pci_dev_state =
|
|
||||||
match serde_json::from_slice(&virtio_pci_dev_section.snapshot) {
|
|
||||||
Ok(state) => state,
|
|
||||||
Err(error) => {
|
|
||||||
return Err(MigratableError::Restore(anyhow!(
|
|
||||||
"Could not deserialize VIRTIO_PCI_DEVICE {}",
|
|
||||||
error
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// First restore the status of the virtqueues.
|
// First restore the status of the virtqueues.
|
||||||
self.set_state(&virtio_pci_dev_state).map_err(|e| {
|
self.set_state(&virtio_pci_dev_section.to_state()?)
|
||||||
|
.map_err(|e| {
|
||||||
MigratableError::Restore(anyhow!(
|
MigratableError::Restore(anyhow!(
|
||||||
"Could not restore VIRTIO_PCI_DEVICE state {:?}",
|
"Could not restore VIRTIO_PCI_DEVICE state {:?}",
|
||||||
e
|
e
|
||||||
|
Loading…
Reference in New Issue
Block a user