13.12. Deleting virtual machines¶
DELETE /servers/{server_id}
Delete a server with the specified ID.
By default, the instance is going to be hard-deleted immediately from
the system, but you can set reclaim_instance_interval
> 0 to make
the API soft-delete the instance, so that the instance will not be
deleted until the reclaim_instance_interval
has expired since the
instance was soft-deleted. The instance marked as SOFT_DELETED
can
be recovered via restore
action before it is really deleted from the
system.
Preconditions:
- The server must exist.
- Anyone can delete a server when the status of the server is not locked and when the policy allows.
- If the server is locked, you must have administrator privileges to delete the server.
Asynchronous postconditions:
- With correct permissions, you can see the server status as
deleting
. - The ports attached to the server, which Nova created during the server create process or when attaching interfaces later, are deleted.
- The server does not appear in the list servers response.
- If hard delete, the server managed by OpenStack Compute is deleted on the compute node.
Troubleshooting:
- If server status remains to be
deleting
or another error, the request failed. Ensure that you meet the preconditions. Then, investigate the compute back end. - The request returns the HTTP 409 response code when the server is locked even if you have correct permissions. Ensure that you meet the preconditions then investigate the server status.
- The server managed by OpenStack Compute is not deleted from the compute node.
Source: https://docs.openstack.org/api-ref/compute/?expanded=#delete-server
13.12.1. Request¶
Name | In | Type | Description |
---|---|---|---|
server_id |
path | string | The UUID of the server. |
13.12.1.1. Example¶
# curl -ks -X DELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/servers/642b7726-bc3b-4824-872b-124097d2d20c
13.12.2. Response¶
13.12.2.1. Status codes¶
13.12.2.1.1. Success¶
Code | Reason |
---|---|
204 - No Content |
The server has fulfilled the request. |
13.12.2.1.2. Error¶
Code | Reason |
---|---|
401 - Unauthorized |
User must authenticate before making a request. |
403 - Forbidden |
Policy does not allow current user to do this operation. |
404 - Not Found |
The requested resource could not be found. |
409 - Conflict |
This operation conflicted with another operation on this resource. |
Version 5.0.0 — Feb 01, 2022