mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Lock disks after validating state change
On `VM::boot` call, lock disks only after the state change has been checked for validity. Otherwise, on invalid state change, boot is aborted, but file locks aren't rolled back. On-behalf-of: SAP julian.schindel@sap.com Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
e0f2d99d6f
commit
4b5e2ef3a0
@@ -2749,14 +2749,6 @@ impl Vm {
|
|||||||
return self.resume().map_err(Error::Resume);
|
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 {
|
let new_state = if self.stop_on_boot {
|
||||||
VmState::BreakPoint
|
VmState::BreakPoint
|
||||||
} else {
|
} else {
|
||||||
@@ -2765,6 +2757,14 @@ impl Vm {
|
|||||||
|
|
||||||
current_state.valid_transition(new_state)?;
|
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")]
|
#[cfg(feature = "fw_cfg")]
|
||||||
{
|
{
|
||||||
let fw_cfg_enabled = self
|
let fw_cfg_enabled = self
|
||||||
|
|||||||
Reference in New Issue
Block a user