diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 9fd5d85b0..63a62d8a1 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -2749,14 +2749,6 @@ impl Vm { return self.resume().map_err(Error::Resume); } - // We acquire all advisory disk image locks here and not on device creation - // to enable live-migration without locking issues. - self.device_manager - .lock() - .unwrap() - .try_lock_disks() - .map_err(Error::LockingError)?; - let new_state = if self.stop_on_boot { VmState::BreakPoint } else { @@ -2765,6 +2757,14 @@ impl Vm { current_state.valid_transition(new_state)?; + // We acquire all advisory disk image locks here and not on device creation + // to enable live-migration without locking issues. + self.device_manager + .lock() + .unwrap() + .try_lock_disks() + .map_err(Error::LockingError)?; + #[cfg(feature = "fw_cfg")] { let fw_cfg_enabled = self