Power Off Virtual Servers on Xen/KVM Compute Resource

To power off all virtual servers that run on the compute resource, use the following request: 

POST /hypervisors/:hypervisor_id/virtual_machines/stop.xml
POST /hypervisors/:hypervisor_id/virtual_machines/stop.json

XML Request Example

curl -i -X POST -u account_email:API_key -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<virtual_machines><virtual_machine>virtual_server_identifier_one</virtual_machine><virtual_machine>virtual_server_identifier_two</virtual_machine><shutdown_type>hard</shutdown_type></virtual_machines>' --url http://onapp.test/hypervisors/13/virtual_machines/stop.xml

JSON Request Example

curl -i -X POST -u account_email:API_key -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"virtual_machines":["virtual_server_identifier_one","virtual_server_identifier_two"], "shutdown_type":"graceful"}' --url http://onapp.test/hypervisors/13/virtual_machines/stop.json

Where: 

virtual_machines - the array of virtual_machine parameters that include identifiers of VSs to be powered off

virtual_machine - the identifier of the VS to be powered off

shutdown_type - specify the shut-down type that can be the following:

  • graceful - to run a graceful shutdown of VSs
  • hard - to run a forceful shutdown of VSs

Returns the 200 OK response if the request was completed successfully.

  • Only the powered-on virtual will be powered off, while the already powered-off VSs will be skipped.
  • The bulk power-off action is available only to virtual servers that are run on Xen and KVM compute resources.