vmm: Provide an owned Snapshot rather than a reference

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-12-01 17:00:24 +01:00
committed by Bo Chen
parent a4160c1fef
commit 2e01bf7f74
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1264,7 +1264,7 @@ impl Vmm {
None, None,
None, None,
None, None,
Some(&snapshot), Some(snapshot),
) )
.map_err(|e| { .map_err(|e| {
MigratableError::MigrateReceive(anyhow!("Error creating VM from snapshot: {:?}", e)) MigratableError::MigrateReceive(anyhow!("Error creating VM from snapshot: {:?}", e))
+4 -4
View File
@@ -479,7 +479,7 @@ impl Vm {
serial_pty: Option<PtyPair>, serial_pty: Option<PtyPair>,
console_pty: Option<PtyPair>, console_pty: Option<PtyPair>,
console_resize_pipe: Option<File>, console_resize_pipe: Option<File>,
snapshot: Option<&Snapshot>, snapshot: Option<Snapshot>,
) -> Result<Self> { ) -> Result<Self> {
trace_scoped!("Vm::new_from_memory_manager"); trace_scoped!("Vm::new_from_memory_manager");
@@ -546,7 +546,7 @@ impl Vm {
cpu_manager cpu_manager
.lock() .lock()
.unwrap() .unwrap()
.create_boot_vcpus(snapshot_from_id(snapshot, CPU_MANAGER_SNAPSHOT_ID)) .create_boot_vcpus(snapshot_from_id(snapshot.as_ref(), CPU_MANAGER_SNAPSHOT_ID))
.map_err(Error::CpuManager)?; .map_err(Error::CpuManager)?;
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
@@ -571,7 +571,7 @@ impl Vm {
force_iommu, force_iommu,
boot_id_list, boot_id_list,
timestamp, timestamp,
snapshot_from_id(snapshot, DEVICE_MANAGER_SNAPSHOT_ID), snapshot_from_id(snapshot.as_ref(), DEVICE_MANAGER_SNAPSHOT_ID),
dynamic, dynamic,
) )
.map_err(Error::DeviceManager)?; .map_err(Error::DeviceManager)?;
@@ -799,7 +799,7 @@ impl Vm {
serial_pty, serial_pty,
console_pty, console_pty,
console_resize_pipe, console_resize_pipe,
snapshot.as_ref(), snapshot,
) )
} }