mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +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:
parent
313883f6e4
commit
625bab69bd
@ -81,8 +81,8 @@ Shut the VMM down | `/vmm.shutdown` | N/A | N/A
|
|||||||
Action | Endpoint | Request Body | Response Body | Prerequisites
|
Action | Endpoint | Request Body | Response Body | Prerequisites
|
||||||
-----------------------------------|---------------------|---------------------------|-------------------|---------------------------
|
-----------------------------------|---------------------|---------------------------|-------------------|---------------------------
|
||||||
Create the VM | `/vm.create` | `/schemas/VmConfig` | N/A | The VM is not created yet
|
Create the VM | `/vm.create` | `/schemas/VmConfig` | N/A | The VM is not created yet
|
||||||
Delete the VM | `/vm.delete` | N/A | N/A | The VM is created but not booted
|
Delete the VM | `/vm.delete` | N/A | N/A | N/A
|
||||||
Boot the VM | `/vm.boot` | N/A | N/A | The VM is created
|
Boot the VM | `/vm.boot` | N/A | N/A | The VM is created but not booted
|
||||||
Shut the VM down | `/vm.shutdown` | N/A | N/A | The VM is booted
|
Shut the VM down | `/vm.shutdown` | N/A | N/A | The VM is booted
|
||||||
Reboot the VM | `/vm.reboot` | N/A | N/A | The VM is booted
|
Reboot the VM | `/vm.reboot` | N/A | N/A | The VM is booted
|
||||||
Pause the VM | `/vm.pause` | N/A | N/A | The VM is booted
|
Pause the VM | `/vm.pause` | N/A | N/A | The VM is booted
|
||||||
@ -375,4 +375,3 @@ APIs work together, let's look at a complete VM creation flow, from the
|
|||||||
user. This is abstracted by the
|
user. This is abstracted by the
|
||||||
[micro_http](https://github.com/firecracker-microvm/firecracker/tree/master/src/micro_http)
|
[micro_http](https://github.com/firecracker-microvm/firecracker/tree/master/src/micro_http)
|
||||||
crate.
|
crate.
|
||||||
|
|
||||||
|
@ -424,8 +424,10 @@ impl Vmm {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// First we try to shut the current VM down.
|
// If a VM is booted, we first try to shut it down.
|
||||||
|
if self.vm.is_some() {
|
||||||
self.vm_shutdown()?;
|
self.vm_shutdown()?;
|
||||||
|
}
|
||||||
|
|
||||||
self.vm_config = None;
|
self.vm_config = None;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user