mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
vmm: Unreference the VM when shutting down
This way, we are forced to re-create the VM object when moving from shutdown to boot. Fixes: #321 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
14eb071b29
commit
228adebc32
@ -252,7 +252,7 @@ impl Vmm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn vm_shutdown(&mut self) -> result::Result<(), VmError> {
|
fn vm_shutdown(&mut self) -> result::Result<(), VmError> {
|
||||||
if let Some(ref mut vm) = self.vm {
|
if let Some(ref mut vm) = self.vm.take() {
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
} else {
|
} else {
|
||||||
Err(VmError::VmNotBooted)
|
Err(VmError::VmNotBooted)
|
||||||
@ -312,13 +312,10 @@ impl Vmm {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.vm_config = None;
|
// First we try to shut the current VM down.
|
||||||
|
self.vm_shutdown()?;
|
||||||
|
|
||||||
// First we shut the current VM down if necessary.
|
self.vm_config = None;
|
||||||
if let Some(ref mut vm) = self.vm {
|
|
||||||
vm.shutdown()?;
|
|
||||||
self.vm = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user