mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15: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> {
|
||||
if let Some(ref mut vm) = self.vm {
|
||||
if let Some(ref mut vm) = self.vm.take() {
|
||||
vm.shutdown()
|
||||
} else {
|
||||
Err(VmError::VmNotBooted)
|
||||
@ -312,13 +312,10 @@ impl Vmm {
|
||||
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.
|
||||
if let Some(ref mut vm) = self.vm {
|
||||
vm.shutdown()?;
|
||||
self.vm = None;
|
||||
}
|
||||
self.vm_config = None;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user