vmm: api: Allow to delete non-booted VMs

The action of "vm.delete" should not report errors on non-booted
VMs. This patch also revised the "docs/api.md" to reflect the right
'Prerequisites' of different API actions, e.g. on "vm.delete" and
"vm.boot".

Fixes: #1110

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2020-06-08 13:41:35 -07:00
committed by Rob Bradford
parent 313883f6e4
commit 625bab69bd
2 changed files with 8 additions and 7 deletions

View File

@@ -424,8 +424,10 @@ impl Vmm {
return Ok(());
}
// First we try to shut the current VM down.
self.vm_shutdown()?;
// If a VM is booted, we first try to shut it down.
if self.vm.is_some() {
self.vm_shutdown()?;
}
self.vm_config = None;