VM Related Interfaces

Set VM HA Level

POST/zstack/v1/vm-instances/{uuid}/ha-levels

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "level": "NeverStop"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"level":"NeverStop"}}' \
http://localhost:8080/zstack/v1/vm-instances/76d39c6862b840a3aa4568d83db99022/ha-levels

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

Virtual Machine resource UUID

 

0.6

level

String

body (contained in params structure)

Virtual Machine HA level:- NeverStop

Never stop

  • NeverStop

0.6

systemTags (Optional)

List

body

System Tags

 

0.6

userTags (Optional)

List

body

User Tags

 

0.6

API Response

On success, this API returns an empty JSON structure {}. On error, the returned JSON structure contains an error field. For example:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout"
  }
}

SDK Examples

Java SDK

SetVmInstanceHaLevelAction action = new SetVmInstanceHaLevelAction();
action.uuid = "76d39c6862b840a3aa4568d83db99022";
action.level = "NeverStop";
action.sessionId = "673a3db55e4a43739aa2b701462547f3";
SetVmInstanceHaLevelAction.Result res = action.call();

Python SDK

SetVmInstanceHaLevelAction action = SetVmInstanceHaLevelAction()
action.uuid = "76d39c6862b840a3aa4568d83db99022"
action.level = "NeverStop"
action.sessionId = "f631227267ef445a9d8066e163c6618a"
SetVmInstanceHaLevelAction.Result res = action.call()