VM Related Interfaces

Convert Virtual Machine To Templated Virtual Machine

POST/zstack/v1/vm-instances/{vmInstanceUuid}/convert-to-templatedVmInstance

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {},
  "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":{}}' http://localhost:8080/zstack/v1/vm-instances/ad7a18919c8331f3a3b2fa482414afee/convert-to-templatedVmInstance

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
vmInstanceUuidStringurlVirtual Machine UUID 4.2.6
systemTags (Optional)ListbodySystem Tag 4.2.6
userTags (Optional)ListbodyUser Tag 4.2.6

API Response

Response Example

{
  "inventory": {
    "uuid": "dc492d9719aa36c28c890817a0f739df",
    "name": "templatedVmInstance",
    "zoneUuid": "fcb916b1966c3502903e9781df537c56",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.2.6
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. For details, see error4.2.6
inventoryTemplatedVmInstanceInventoryFor details, see inventory4.2.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier of the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The error that triggered the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.2.6
nameStringResource name4.2.6
zoneUuidStringData Center UUID4.2.6
createDateTimestampCreate time4.2.6
lastOpDateTimestampLast modification time4.2.6

SDK Examples

Java SDK

ConvertVmInstanceToTemplatedVmInstanceAction action = new ConvertVmInstanceToTemplatedVmInstanceAction();
action.vmInstanceUuid = "ad7a18919c8331f3a3b2fa482414afee";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ConvertVmInstanceToTemplatedVmInstanceAction.Result res = action.call();

Python SDK

ConvertVmInstanceToTemplatedVmInstanceAction action = ConvertVmInstanceToTemplatedVmInstanceAction()
action.vmInstanceUuid = "ad7a18919c8331f3a3b2fa482414afee"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ConvertVmInstanceToTemplatedVmInstanceAction.Result res = action.call()