Document navigation

SetVmMachineType

API Request

URLs
PUT zstack/v1/vm-instances/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "setVmMachineType": {
    "machineType": "q35"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmMachineType":{"machineType":"q35"}}' \
http://localhost:8080/zstack/v1/vm-instances/8b45bba4578f3e6eacc6f0a67f8603d6/actions
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
uuidStringurlThe VM instance UUID.5.5.38
machineTypeStringbody (contained in the setVmMachineType structure)The target machine type. Only q35 is supported.5.5.38
systemTagsListbodyOptional. The system tags.5.5.38
userTagsListbodyOptional. The user tags.5.5.38
Note: Changing the machine type requires the VM instance to be in the Stopped state. Machine types that are not set, pc, and q35 can all be changed to q35. Repeated calls on a VM instance whose machine type is already q35 are idempotent. If the current machine type of a VM instance is not q35 and the VM instance has memory snapshots, the conversion is not allowed.

API Response

The API returns an empty JSON structure {} when the operation succeeds. If an error occurs, 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 Sample

Java SDK
SetVmMachineTypeAction action = new SetVmMachineTypeAction();
action.uuid = "8b45bba4578f3e6eacc6f0a67f8603d6";
action.machineType = "q35";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmMachineTypeAction.Result res = action.call();
Python SDK
action = SetVmMachineTypeAction()
action.uuid = "8b45bba4578f3e6eacc6f0a67f8603d6"
action.machineType = "q35"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
API Reference | 5.5.38 | ZStack Cloud · ZCF | ZStack Resource Center