...
The VM state link is a link in the VM object with the "rel" attribute set to state. The "title" attribute contains the current state. You can send a PUT request of a virtualmachine state object to the link (in the "href" attribute) to change the state of the VM.
Code Block |
---|
{ "titlehref": "ON", "rel": "state", https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/2/virtualmachines/6/state", "type": "application/vnd.abiquo.virtualmachinestate+json", "rel": "state", "hreftitle": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/26/virtualappliances/37/virtualmachines/198/state" ON" }, |
Examples of virtualmachinestate objects
...
Example of VM hard power off via API
To hard power off a VM using the API, perform a request like the one shown below.
...
title | Click here to show or hide the request example |
---|
cURL:
Code Block |
---|
curl -X PUT http://localhost:9000/api/cloud/virtualdatacenters/2205/virtualappliances/1080/virtualmachines/1121/state \
-H 'Accept:application/vnd.abiquo.acceptedrequest+json; version=4.2' \
-H 'Content-Type:application/vnd.abiquo.virtualmachinestate+json; version=4.2' \
-d @requestpayload.json \
-u user:password --verbose |
Success status code: 202
Request payload:
Code Block |
---|
{
"state": "OFF",
"links": []
} |
Response payload:
Code Block |
---|
{
"message": "You can keep track of the progress in the link",
"links": [
{
"href": "http://localhost:9009/api/cloud/virtualdatacenters/2205/virtualappliances/1080/virtualmachines/1121/tasks/1fd663d5-1e66-4443-b94c-f78d13c9e62f",
"rel": "status"
}
]
} |
The API will return a link where you can monitor the progress of this operation.The API will return a link where you can monitor the progress of this operation.
Example of failed graceful shutdown
...