mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: virtio-devices: Restore every VirtioDevice upon creation
Following the new design proposal to improve the restore codepath when migrating a VM, all virtio devices are supplied with an optional state they can use to restore from. The restore() implementation every device was providing has been removed in order to prevent from going through the restoration twice. Here is the list of devices now following the new restore design: - Block (virtio-block) - Net (virtio-net) - Rng (virtio-rng) - Fs (vhost-user-fs) - Blk (vhost-user-block) - Net (vhost-user-net) - Pmem (virtio-pmem) - Vsock (virtio-vsock) - Mem (virtio-mem) - Balloon (virtio-balloon) - Watchdog (virtio-watchdog) - Vdpa (vDPA) - Console (virtio-console) - Iommu (virtio-iommu) Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -236,6 +236,23 @@ impl Snapshot {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn snapshot_from_id(snapshot: Option<&Snapshot>, id: &str) -> Option<Snapshot> {
|
||||
snapshot.and_then(|s| s.snapshots.get(id).map(|s| *s.clone()))
|
||||
}
|
||||
|
||||
pub fn versioned_state_from_id<T>(
|
||||
snapshot: Option<&Snapshot>,
|
||||
id: &str,
|
||||
) -> Result<Option<T>, MigratableError>
|
||||
where
|
||||
T: Versionize + VersionMapped,
|
||||
{
|
||||
snapshot
|
||||
.and_then(|s| s.snapshots.get(id).map(|s| *s.clone()))
|
||||
.map(|s| s.to_versioned_state(id))
|
||||
.transpose()
|
||||
}
|
||||
|
||||
/// A snapshottable component can be snapshotted.
|
||||
pub trait Snapshottable: Pausable {
|
||||
/// The snapshottable component id.
|
||||
|
||||
Reference in New Issue
Block a user