mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +00:00
vm-migration: Don't store snapshots through a Box
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
4517b76a23
commit
1d1043316b
@ -147,7 +147,7 @@ pub struct Snapshot {
|
|||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
||||||
/// The Snapshottable component snapshots.
|
/// The Snapshottable component snapshots.
|
||||||
pub snapshots: std::collections::BTreeMap<String, Box<Snapshot>>,
|
pub snapshots: std::collections::BTreeMap<String, Snapshot>,
|
||||||
|
|
||||||
/// The Snapshottable component's snapshot data.
|
/// The Snapshottable component's snapshot data.
|
||||||
/// A map of snapshot sections, indexed by the section ids.
|
/// A map of snapshot sections, indexed by the section ids.
|
||||||
@ -187,8 +187,7 @@ impl Snapshot {
|
|||||||
|
|
||||||
/// Add a sub-component's Snapshot to the Snapshot.
|
/// Add a sub-component's Snapshot to the Snapshot.
|
||||||
pub fn add_snapshot(&mut self, snapshot: Snapshot) {
|
pub fn add_snapshot(&mut self, snapshot: Snapshot) {
|
||||||
self.snapshots
|
self.snapshots.insert(snapshot.id.clone(), snapshot);
|
||||||
.insert(snapshot.id.clone(), Box::new(snapshot));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a SnapshotData to the component snapshot data.
|
/// Add a SnapshotData to the component snapshot data.
|
||||||
@ -220,7 +219,7 @@ impl Snapshot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn snapshot_from_id(snapshot: Option<&Snapshot>, id: &str) -> Option<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()))
|
snapshot.and_then(|s| s.snapshots.get(id).cloned())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn versioned_state_from_id<T>(
|
pub fn versioned_state_from_id<T>(
|
||||||
@ -231,7 +230,7 @@ where
|
|||||||
T: Versionize + VersionMapped,
|
T: Versionize + VersionMapped,
|
||||||
{
|
{
|
||||||
snapshot
|
snapshot
|
||||||
.and_then(|s| s.snapshots.get(id).map(|s| *s.clone()))
|
.and_then(|s| s.snapshots.get(id).cloned())
|
||||||
.map(|s| s.to_versioned_state())
|
.map(|s| s.to_versioned_state())
|
||||||
.transpose()
|
.transpose()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user