Create Root Volume Template from Root Volume
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "My Root Volume Template",
"backupStorageUuids": [
"a3cb55d45fb63d1da4911b9d16273a55"
],
"platform": "Linux",
"system": false
},
"systemTags": [],
"userTags": []
}In the above example, 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":{"name":"My Root Volume Template","backupStorageUuids":["a3cb55d45fb63d1da4911b9d16273a55"],"platform":"Linux","system":false}}' http://localhost:8080/zstack/v1/images/root-volume-templates/from/volumes/3bfc6f9eaf243299b8515382310be47bParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
name | String | body (contained in params structure) | Root Volume Image name |
| 0.6 |
description (Optional) | String | body (contained in params structure) | Detailed description of the Root Volume Image |
| 0.6 |
guestOsType (Optional) | String | body (contained in params structure) | Guest Operating System type corresponding to the Root Volume Image |
| 0.6 |
backupStorageUuids (Optional) | List | body (contained in params structure) | Image Storage UUID List |
| 0.6 |
rootVolumeUuid | String | body (contained in params structure) | Root Volume UUID |
| 0.6 |
platform (Optional) | String | body (contained in params structure) | System platform corresponding to the Root Volume Image |
| 0.6 |
system (Optional) | boolean | body (contained in params structure) | Whether it is a system Root Volume Image |
| 0.6 |
resourceUuid (Optional) | String | body (contained in params structure) | Root Volume Image UUID. If specified, the Root Volume Image will use this field value as its UUID. |
| 0.6 |
architecture (Optional) | String | body (contained in params structure) |
|
| 4.0.0 |
tagUuids (Optional) | List | body (contained in params structure) | Tag UUID List |
| 4.0.0 |
systemTags (Optional) | List | body | System Tags |
| 0.6 |
userTags (Optional) | List | body | User Tags |
| 0.6 |
- ZSvirt supports copying GuestTools label values from the VM to the Image when creating a Root Volume Image from a Root Volume. When using this Image to create a VM, the GuestTools label values are copied from the Image to the new VM. Add GuestTools option to SystemTags.
- Option format:
GuestTools::TOOLS_VERSION, where TOOLS_VERSION initial value is 1.0.0. This value will change as the tool version advances. - Example:
GuestTools::1.0.0 - Additional note: When creating an Image from a VM's Root Volume, copy the GuestTools label values from the VM to the Image.
- Option format:
API Response
Response Example
{
"inventory": {
"uuid": "cad3a82224363f1e8592a7fd0bf419f9",
"name": "My Root Volume Template",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"architecture": "x86_64",
"format": "raw",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "cad3a82224363f1e8592a7fd0bf419f9",
"backupStorageUuid": "ac938bdf013b3a94acf679955f69f647",
"installPath": "ceph://zs-images/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 0.6 |
| inventory | ImageInventory | See inventory | 0.6 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier for 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 source error that triggered the current error. This field is null if there is no original error | 0.6 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| name | String | Resource name | 0.6 |
| description | String | Detailed description of the resource | 0.6 |
| state | String | Image boot state | 4.0.0 |
| status | String | Image ready state | 4.0.0 |
| size | Long | Image size | 4.0.0 |
| actualSize | Long | Image actual capacity | 4.0.0 |
| md5Sum | String | Image md5 value | 4.0.0 |
| url | String | Image URL address | 4.0.0 |
| mediaType | String | Image type | 4.0.0 |
| guestOsType | String | Guest Operating System type corresponding to the Image | 4.0.0 |
| type | String | Internal use field | 4.0.0 |
| platform | String | Image system platform | 4.0.0 |
| format | String | Image format, for example: raw | 4.0.0 |
| system | Boolean | Indicates whether it is a system Image | 4.0.0 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| backupStorageRefs | List | See backupStorageRefs | 0.6 |
backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | Image UUID | 0.6 |
| backupStorageUuid | String | Image Storage UUID | 0.6 |
| installPath | String | Installation path on the Image Storage | 4.0.0 |
| exportUrl | String | Export Image URL | 4.0.0 |
| exportMd5Sum | String | Export Image md5 value | 4.0.0 |
| status | String | Image ready state | 4.0.0 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
Java SDK
CreateRootVolumeTemplateFromRootVolumeAction action = new CreateRootVolumeTemplateFromRootVolumeAction();
action.name = "My Root Volume Template";
action.backupStorageUuids = asList("a3cb55d45fb63d1da4911b9d16273a55");
action.rootVolumeUuid = "3bfc6f9eaf243299b8515382310be47b";
action.platform = "Linux";
action.system = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateRootVolumeTemplateFromRootVolumeAction.Result res = action.call();Python SDK
CreateRootVolumeTemplateFromRootVolumeAction action = CreateRootVolumeTemplateFromRootVolumeAction()
action.name = "My Root Volume Template"
action.backupStorageUuids = [a3cb55d45fb63d1da4911b9d16273a55]
action.rootVolumeUuid = "3bfc6f9eaf243299b8515382310be47b"
action.platform = "Linux"
action.system = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateRootVolumeTemplateFromRootVolumeAction.Result res = action.call()