mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user