VM Related Interfaces
Convert Virtual Machine To Templated Virtual Machine
Headers
Authorization: OAuth the-session-uuidBody
{
"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-templatedVmInstanceParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | Virtual Machine UUID | 4.2.6 | |
| systemTags (Optional) | List | body | System Tag | 4.2.6 | |
| userTags (Optional) | List | body | User 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"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.2.6 | |
| error | ErrorCode | Error code. If not null, the operation failed. When the operation succeeds, this field is null. For details, see error | 4.2.6 |
| inventory | TemplatedVmInstanceInventory | For details, see inventory | 4.2.6 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier of the error, for example SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause. The error that triggered the current error. If there is no original error, this field is null | 0.6 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.2.6 |
| name | String | Resource name | 4.2.6 |
| zoneUuid | String | Data Center UUID | 4.2.6 |
| createDate | Timestamp | Create time | 4.2.6 |
| lastOpDate | Timestamp | Last modification time | 4.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()