diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 8911e8e405..ce224272b8 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1524,6 +1524,11 @@ impl DeviceManager { Ok(()) } + /// Drop restore-only state once all devices have consumed it. + pub(crate) fn clear_restore_snapshot(&mut self) { + self.snapshot = None; + } + #[cfg(feature = "fw_cfg")] pub fn create_fw_cfg_device(&mut self) -> Result<(), DeviceManagerError> { let fw_cfg = Arc::new(Mutex::new(devices::legacy::FwCfg::new( diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 96928b4c1f..9daf5ff8dd 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -639,6 +639,9 @@ impl Vm { snapshot, )?; + // Remove any snapshot artifacts after the hypervisor-specific init. + device_manager.lock().unwrap().clear_restore_snapshot(); + // Load kernel and initramfs files #[cfg(feature = "tdx")] let kernel = config