SetVmInstanceHaLevel

API Request

URLs
POST zstack/v1/vm-instances/{uuid}/ha-levels
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "level": "NeverStop"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The VM instance UUID. 0.6
level String body (contained in the params structure) The HA level of the VM instance. Option:
  • NeverStop:

    The VM instance will never be stopped.

  • NeverStop
0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

If the API succeeded, an empty JSON structure {} is returned. If the API failed, the returned JSON structure includes an error field. For example,
{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout"
    }
}

SDK Sample

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()