Performing actions on virtual machines

POST /servers/{server_id}/action

Perform an action on a virtual machine with the specified ID.

The request parameters depend on the action. For the list of parameters, follow the source link below.

Source: https://docs.openstack.org/api-ref/compute/#servers-run-an-action-servers-action

Request

Example 1

Suspend a VM with the specified ID.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "suspend": null
}' https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/servers/c3f154f1-c656-49b4-a6c0-4dd1e088817c/action

Example 2

Resume a VM with the specified ID.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "resume": null
}' https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/servers/c3f154f1-c656-49b4-a6c0-4dd1e088817c/action

Response

Status codes

Success

Code Reason
202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

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.