VM Related Interfaces

Change Virtual Machine Password

PUT/zstack/v1/vm-instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeVmPassword": {
    "password": "password",
    "account": "root"
  },
  "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 PUT -d '{"changeVmPassword":{"password":"password","account":"root"}}' \
http://localhost:8080/zstack/v1/vm-instances/6401e6a584b43fcfaebe401fd07f6f92/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlResource UUID, uniquely identifying the resource 0.6
passwordStringbody(contained in the changeVmPassword structure)Password 0.6
accountStringbody(contained in the changeVmPassword structure)Account 0.6
systemTags (Optional)ListbodySystem Tag 0.6
userTags (Optional)ListbodyUser Tag 0.6

API Response

This API returns an empty JSON structure {} on success. On error, the returned JSON structure contains an error field, for example:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
  }
}

SDK Examples

Java SDK

ChangeVmPasswordAction action = new ChangeVmPasswordAction();
action.uuid = "68bbdbf738884c3486f0fc0faf42c42c";
action.password = "password";
action.account = "root";
action.sessionId = "815834f2143b45c0a16fab615616795a";
ChangeVmPasswordAction.Result res = action.call();

Python SDK

ChangeVmPasswordAction action = ChangeVmPasswordAction()
action.uuid = "39f2732b2c214fe29fb2fa82f748a4f6"
action.password = "password"
action.account = "root"
action.sessionId = "fee2d467d9af4dc5b541a56a736cb457"
ChangeVmPasswordAction.Result res = action.call()