Image Operations
AddImage
API Request
URLs
POST zstack/v1/imagesHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, the userTags field is optional. This field can be
included in the body structure.
{
"params": {
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"architecture": "x86_64",
"system": false,
"format": "qcow2",
"platform": "Linux",
"backupStorageUuids": [
"b8fc9c1c027438c28d36af24eca06595"
],
"virtio": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, the userTags field is optional. This field can be
included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d'{"params":{"name":"TinyLinux","url":"http://192.168.1.20/share/images/tinylinux.qcow2","mediaType":"RootVolumeTemplate","architecture":"x86_64","system":false,"format":"qcow2","platform":"Linux","backupStorageUuids":["b8fc9c1c027438c28d36af24eca06595"],"virtio":false}}' http://localhost:8080/zstack/v1/imagesRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The image name. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the image. | 0.6 | |
| url | String | body (contained in the params structure) | The URL of the image to be added. | 0.6 | |
| mediaType | String | body (contained in the params structure) | Optional. The image type. |
|
0.6 |
| guestOsType | String | body (contained in the params structure) | Optional. The operating system type of the guest VM instance that corresponds to the image. | 0.6 | |
| system | boolean | body (contained in the params structure) | Optional. Whether the image is a system image, for example, vRouter image. | 0.6 | |
| format | String | body (contained in the params structure) | Optional. The image format, for example, raw. | 0.6 | |
| platform | String | body (contained in the params structure) | Optional. The system platform of the image. |
|
0.6 |
| backupStorageUuids | List | body (contained in the params structure) | The UUID list of the backup storages on which the image is to be added. | 0.6 | |
| type | String | body (contained in the params structure) | Optional. The reserved field for internal use. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. If specified, the image will use the specified value as UUID. | 0.6 | |
| architecture | String | body (contained in the params structure) | Optional. |
|
4.0.0 |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "1eb26d06364036b7860d2b7dbb462b8c",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"architecture": "x86_64",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "1eb26d06364036b7860d2b7dbb462b8c",
"backupStorageUuid": "902dcc8d1015318fb4903df890765c4d",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
AddImageAction action = new AddImageAction();
action.name = "TinyLinux";
action.url = "http://192.168.1.20/share/images/tinylinux.qcow2";
action.mediaType = "RootVolumeTemplate";
action.architecture = "x86_64";
action.system = false;
action.format = "qcow2";
action.platform = "Linux";
action.backupStorageUuids = asList("b8fc9c1c027438c28d36af24eca06595");
action.virtio = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddImageAction.Result res = action.call();Python
SDK
AddImageAction action = AddImageAction()
action.name = "TinyLinux"
action.url = "http://192.168.1.20/share/images/tinylinux.qcow2"
action.mediaType = "RootVolumeTemplate"
action.architecture = "x86_64"
action.system = false
action.format = "qcow2"
action.platform = "Linux"
action.backupStorageUuids = [b8fc9c1c027438c28d36af24eca06595]
action.virtio = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddImageAction.Result res = action.call()DeleteImage
API Request
URLs
DELETE zstack/v1/images/{uuid}?backupStorageUuids={backupStorageUuids}&deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"backupStorageUuids": [
"2499cd48fc33450a8737efff67ccb920"
],
"deleteMode": "Permissive"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fb8be86094544022ad3e3abd0027b420" \
-X DELETE http://localhost:8080/zstack/v1/images/f92e888c970c4f739d91e59f6dd94b1e?Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The image UUID. | 0.6 | |
| backupStorageUuids | List | body | Optional. The backup storage UUID list. | 0.6 | |
| deleteMode | String | body | Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
DeleteImageAction action = new DeleteImageAction();
action.uuid = "22850dff70934ffdaa839a950cb5a470";
action.backupStorageUuids = asList("32974c8955cd4ed79d13458e41490883");
action.deleteMode = "Permissive";
action.sessionId = "517a458b87ca49cf80bf26e6000bc611";
DeleteImageAction.Result res = action.call();Python
SDK
DeleteImageAction action = DeleteImageAction()
action.uuid = "5bbd892e048b48b283e5d2f49a6a4e94"
action.backupStorageUuids = [fd127191bf504e3daf5292800c1ea2d8]
action.deleteMode = "Permissive"
action.sessionId = "cf5cf2689379496aaa4449fd14dc8330"
DeleteImageAction.Result res = action.call()ExpungeImage
API Request
URLs
PUT zstack/v1/images/{imageUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"expungeImage": {
"backupStorageUuids": [
"ef3843bdde80427e9c8c0d4f05aa5cde"
]
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"expungeImage":{"backupStorageUuids":["3be136c8d8b8323bb94b8464aae4b0a7"]}}' \
http://localhost:8080/zstack/v1/images/4dcddfadcd113b5f89f181c4f4a080c7/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| Uuid | String | body (contained in the params structure) | The resource UUID. | 0.6 | |
| imageUuid | String | url | The image UUID. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | Optional. The backup storage UUID list. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
ExpungeImageAction action = new ExpungeImageAction();
action.imageUuid = "ddb63556ae714ee78bf468d5067beedd";
action.backupStorageUuids = asList("6f21a1307fb24117a25ed907c00a3e47");
action.sessionId = "b12c879167d3459a844b6ac1f8ff3b74";
ExpungeImageAction.Result res = action.call();Python
SDK
ExpungeImageAction action = ExpungeImageAction()
action.imageUuid = "59fcc3775336469facfd93c5c16bdb2d"
action.backupStorageUuids = [2dfcf2dfadb14022ac09172a82fb3aac]
action.sessionId = "11fe68c420514cb0a8d8e1d1c5755d11"
ExpungeImageAction.Result res = action.call()QueryImage
API Request
URLs
GET zstack/v1/images
GET zstack/v1/images/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ecf1dc42b51d4c7c8f814bd10ac0ba79" \
-X GET http://localhost:8080/zstack/v1/images?q=uuid=0538611eb03a48e0bbcfd08e528f0aa1curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 69e2477d74ae4b53a19b21ee6e88f9da" \
-X GET http://localhost:8080/zstack/v1/images/21897673f8274d319c4aeba92e8e4c73Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryImage, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"actualSize": 7995392,
"backupStorageRefs": [
{
"backupStorageUuid": "bbc730b63081460198c1c7cb63025255",
"createDate": "Mar 10, 2018 2:35:09 PM",
"imageUuid": "2402b660b6f1582bb65246597b2f47f2",
"installPath": "zstore://2402b660b6f1582bb65246597b2f47f2/2ab567b512cc696f2207cf0e3260baa4982e1c02",
"lastOpDate": "Mar 10, 2018 2:35:09 PM",
"status": "Ready"
}
],
"createDate": "Mar 10, 2018 2:35:09 PM",
"description": "",
"format": "qcow2",
"lastOpDate": "Mar 10, 2018 2:35:10 PM",
"md5Sum": "f0fde821df71aaec63063bef1fb0a46a231e5a3fbb37ed5671eabee7563eb3f8",
"mediaType": "RootVolumeTemplate",
"name": "Image-1",
"platform": "Linux",
"size": 12682240,
"state": "Enabled",
"status": "Ready",
"system": false,
"type": "zstack",
"url": "file:///opt/zstack-dvd/zstack-image-1.4.qcow2",
"uuid": "2402b660b6f1582bb65246597b2f47f2"
}
],
"success": true
}SDK Sample
Java
SDK
QueryImageAction action = new QueryImageAction();
action.conditions = asList("uuid=02928c0d94a847b0b785bc9830f931c6");
action.sessionId = "512102357b3e44c7a1704240176c8661";
QueryImageAction.Result res = action.call();Python
SDK
QueryImageAction action = QueryImageAction()
action.conditions = ["uuid=4d4b95071b09499e9e15a206714d1586"]
action.sessionId = "893c8fe44f5b4b799b095c54ee7ae075"
QueryImageAction.Result res = action.call()RecoverImage
API Request
URLs
PUT zstack/v1/images/{imageUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"recoverImage": {
"backupStorageUuids": [
"b63989ade2194ce8b8f1823083395681"
]
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 5ab0e924388a44d7aa96b9e7df9d8df3" \
-X PUT -d '{"recoverImage":{"backupStorageUuids":["29849ef8f0fe3abeb8fff5e6d947d002"]}}' \
http://localhost:8080/zstack/v1/images/e55bb56eee93338cad8d7d1048a6b0c3/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| imageUuid | String | url | The image UUID. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | Optional. The backup storage UUID list. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "c019173f2b5742868058049be43033a1",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "c019173f2b5742868058049be43033a1",
"backupStorageUuid": "609d29fb59ee414f90cedbc3a71038c6",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| platform | String | The system platform of the image. | 0.6 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | The installation path on the backup storage. | 0.6 |
| exportUrl | String | The URL for exporting the image. | 0.6 |
| exportMd5Sum | String | The MD5 checksum of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
RecoverImageAction action = new RecoverImageAction();
action.imageUuid = "3220b5ea2ae24883a4eb847634e3e349";
action.backupStorageUuids = asList("ad4dcd853b894362bfd18c06779ed758");
action.sessionId = "66ba41da8526424d9ab70ed0072b8d22";
RecoverImageAction.Result res = action.call();Python
SDK
RecoverImageAction action = RecoverImageAction()
action.imageUuid = "7f8bb365b8d3413ab5d09f6d381552c3"
action.backupStorageUuids = [14d99a1ade5a431ea254902c808d7319]
action.sessionId = "044d56deddd849a092ff02ae54386cf1"
RecoverImageAction.Result res = action.call()ChangeImageState
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"changeImageState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeImageState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/images/5a4e7e1f1a653505925da09d0a64936b/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The image UUID. | 0.6 | |
| stateEvent | String | body (contained in the params structure) | The state of the image. |
|
0.6 |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "e4891e6ef3a64ea08ce91ab379a5c856",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "e4891e6ef3a64ea08ce91ab379a5c856",
"backupStorageUuid": "8bf8f2f17e7c4cca8d684ae5d89eee9e",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | SeebackupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
ChangeImageStateAction action = new ChangeImageStateAction();
action.uuid = "d6d3cf3feace41ae9fe519fcfdf337e1";
action.stateEvent = "disable";
action.sessionId = "e510317dfbf64f7c9423652cefba6583";
ChangeImageStateAction.Result res = action.call();Python
SDK
ChangeImageStateAction action = ChangeImageStateAction()
action.uuid = "d33d29f7695a4376a9a37a094f89d9f2"
action.stateEvent = "disable"
action.sessionId = "ae3587d0cbf844c2921a97798d4dc37b"
ChangeImageStateAction.Result res = action.call()UpdateImage
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateImage": {
"platform": "Windows",
"virtio": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateImage":{"platform":"Windows","virtio":false}}' http://localhost:8080/zstack/v1/images/38549d5d5a3d3c5caefc18d8a9e0aa13/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The image UUID. | 0.6 | |
| name | String | body (contained in the updateImage structure) | Optional. The image name. | 0.6 | |
| description | String | body (contained in the updateImage structure) | Optional. The detailed description of the image. | 0.6 | |
| guestOsType | String | body (contained in the updateImage structure) | Optional. The operating system type of the guest VM instance that corresponds to the image. | 0.6 | |
| mediaType | String | body (contained in the updateImage structure) | Optional. The image type. |
|
0.6 |
| architecture | String | body (contained in the updateImage structure) | Optional. |
|
4.0.0 |
| format | String | body (contained in the updateImage structure) | Optional. The image format. |
|
0.6 |
| system | Boolean | body (contained in the updateImage structure) | Optional. Specifies whether the image is a system image. | 0.6 | |
| platform | String | body (contained in the updateImage structure) | Optional. The system platform of the image. |
|
0.6 |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 | |
| virtio | Boolean | body (contained in the updateImage structure) | 5.0.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Windows",
"architecture": "x86_64",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"backupStorageUuid": "b94ff32725d133fea53e8ada5ea7f0fc",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
UpdateImageAction action = new UpdateImageAction();
action.uuid = "38549d5d5a3d3c5caefc18d8a9e0aa13";
action.platform = "Windows";
action.virtio = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateImageAction.Result res = action.call();Python
SDK
UpdateImageAction action = UpdateImageAction()
action.uuid = "38549d5d5a3d3c5caefc18d8a9e0aa13"
action.platform = "Windows"
action.virtio = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateImageAction.Result res = action.call()SyncImageSize
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"syncImageSize": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3a29210c52824730884918d670745453" \
-X PUT -d '{"syncImageSize":{}}' \
http://localhost:8080/zstack/v1/images/7d0fb69a716330bba16a3ee557ee0ab2/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The image UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "a5288a2598074daabb0450db1eaf0e69",
"name": "TinyLinux",
"size": 2.097152E8,
"actualSize": 2329057.0,
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "a5288a2598074daabb0450db1eaf0e69",
"backupStorageUuid": "1a917c0b47c6475a996ed678f230419d",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
SyncImageSizeAction action = new SyncImageSizeAction();
action.uuid = "46638764dfcb47b2bf916bce60d50f9f";
action.sessionId = "557e2989aa7d4178861c4fcacb85e40c";
SyncImageSizeAction.Result res = action.call();Python
SDK
SyncImageSizeAction action = SyncImageSizeAction()
action.uuid = "0073e30d1fd84cd0b47896e5bb22b205"
action.sessionId = "e6896c8311824d718e330908ec04d9a6"
SyncImageSizeAction.Result res = action.call()DeleteImagePackage
API Request
URLs
DELETE zstack/v1/image-packages/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/image-packages/e7660c815f483befb15905bf6c776781?Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.4.6 | |
| deleteMode | String | body | Optional. The deletion mode. |
|
4.4.6 |
| systemTags | List | body | Optional. The system tags. | 4.4.6 | |
| userTags | List | body | Optional. The user tags. | 4.4.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
DeleteImagePackageAction action = new DeleteImagePackageAction();
action.uuid = "e7660c815f483befb15905bf6c776781";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteImagePackageAction.Result res = action.call();Python
SDK
DeleteImagePackageAction action = DeleteImagePackageAction()
action.uuid = "e7660c815f483befb15905bf6c776781"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteImagePackageAction.Result res = action.call()QueryImagePackage
API Request
URLs
GET zstack/v1/image-packagesGET zstack/v1/image-packages/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/image-packages?q=uuid=7cd2f1b456ce3045b78d3c1eb58cc03dcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/image-packages/1c57c91becf431f3b098800fc900c708
Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryImage, and pressing the Tab key.
API Response
Sample Response
{
"inventories": [
{
"uuid": "e97e03503a5d3bf19a23f91c9a79e009",
"name": "ova",
"description": "description",
"vmUuid": "b3da643979eb3452abbeb978208cb672",
"backupStorageUuid": "6185f4e18a993ece84a06ec8c469b530",
"state": "Exported",
"exportUrl": "http://bs-host-name/path/to/ova.ova",
"md5Sum": "sampleMd5Sum",
"format": "OVA",
"size": 1.073741824E10,
"createDate": "May 10, 2022 5:26:20 AM",
"lastOpDate": "May 10, 2022 5:26:20 AM"
}
]
}| Name | Type | Location | Description |
|---|---|---|---|
| success | boolean | 4.4.6 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.4.6 |
| inventories | List | See inventories. | 4.4.6 |
#error
| Name | Type | Location | Description |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.4.6 |
| description | String | The brief description of the error. | 4.4.6 |
| details | String | The details about the error. | 4.4.6 |
| elaboration | String | The reserved field. Default value: null. | 4.4.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.4.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.4.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.4.6 |
| name | String | The resource name. | 4.4.6 |
| description | String | The resource description. | 4.4.6 |
| vmUuid | String | The source VM UUID. | 4.4.6 |
| backupStorageUuid | String | The backup storage UUID. | 4.4.6 |
| exportUrl | String | The download address. | 4.4.6 |
| md5Sum | String | The MD5 sum of the image package. | 4.4.6 |
| format | String | The image package format. | 4.4.6 |
| size | Long | The image package size. | 4.4.6 |
| createDate | Timestamp | The creation time. | 4.4.6 |
| lastOpDate | Timestamp | The last operation time. | 4.4.6 |
| state | ImagePackageState | See state. | 4.4.6 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Exporting | ImagePackageState | The image package is exporting. | 4.4.6 |
| Exported | ImagePackageState | The image package is exported. | 4.4.6 |
SDK Sample
Java
SDK
QueryImagePackageAction action = new QueryImagePackageAction();
action.conditions = asList("uuid=5319396fe8f0393d998ac6c0939e780e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryImagePackageAction.Result res = action.call();Python
SDK
QueryImagePackageAction action = QueryImagePackageAction()
action.conditions = ["uuid=99435bfd7903372289db27c8a2b1038c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryImagePackageAction.Result res = action.call()UpdateImagePackage
API Request
URLs
PUT zstack/v1/image-packages/{uuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, the userTags field is optional. This field can be
included in the body structure.
{
"updateImagePackage": {
"name": "ova-update",
"description": "description-update"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, the userTags field is optional. This field can be
included in the body structure.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/image-packages/eeed157556d2328c9c3aeec71ab75463Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.4.6 | |
| name | String | body(contained in the updateImagePackagestructure) |
Optional. The resource name. | 4.4.6 | |
| description | String | body(contained in the updateImagePackagestructure) |
Optional. The resource description. | 4.4.6 | |
| systemTags | List | body | Optional. The system tags. | 4.4.6 | |
| userTags | List | body | Optional. The user tags. | 4.4.6 |
API Response
Sample Response
{
"inventory": {
"uuid": "ecdea1f236a13e74a5712edabb4cfe9e",
"name": "ova",
"description": "description",
"vmUuid": "21c4183acbf737128aba034313e1f909",
"backupStorageUuid": "99630920a09138ab93823380286efc57",
"state": "Exported",
"exportUrl": "http://bs-host-name/path/to/ova.ova",
"md5Sum": "sampleMd5Sum",
"format": "OVA",
"size": 1.073741824E10,
"createDate": "May 10, 2022 5:27:16 AM",
"lastOpDate": "May 10, 2022 5:27:16 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.4.6 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.4.6 |
| inventory | ImagePackageInventory | See inventory. | 4.4.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.4.6 |
| description | String | The brief description of the error. | 4.4.6 |
| details | String | The details about the error. | 4.4.6 |
| elaboration | String | The reserved field. Default value: null. | 4.4.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.4.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.4.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.4.6 |
| name | String | The resource name. | 4.4.6 |
| description | String | The resource description. | 4.4.6 |
| vmUuid | String | The source VM UUID. | 4.4.6 |
| backupStorageUuid | String | The backup storage UUID. | 4.4.6 |
| exportUrl | String | The download address. | 4.4.6 |
| md5Sum | String | The MD5 sum of the image package. | 4.4.6 |
| format | String | The image package format. | 4.4.6 |
| size | Long | The image package size. | 4.4.6 |
| createDate | Timestamp | The creation time. | 4.4.6 |
| lastOpDate | Timestamp | The last operation time. | 4.4.6 |
| state | ImagePackageState | See state. | 4.4.6 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Exporting | ImagePackageState | The image package is exporting. | 4.4.6 |
| Exported | ImagePackageState | The image package is exported. | 4.4.6 |
SDK Sample
Java
SDK
QueryImagePackageAction action = new QueryImagePackageAction();
action.conditions = asList("uuid=5319396fe8f0393d998ac6c0939e780e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryImagePackageAction.Result res = action.call();Python
SDK
QueryImagePackageAction action = QueryImagePackageAction()
action.conditions = ["uuid=99435bfd7903372289db27c8a2b1038c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryImagePackageAction.Result res = action.call()GetCandidateBackupStorageForCreatingImage
API Request
URLs
GET zstack/v1/images/volumes/{volumeUuid}/candidate-backup-storage
GET zstack/v1/images/volume-snapshots/{volumeSnapshotUuid}/candidate-backup-storageHeaders
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 146b6ded7a9744068ba57b87ca1bd0c0" \
-X GET http://localhost:8080/zstack/v1/images/volumes/1e816db3824f489a944f1f6c6beb83cc/candidate-backup-storage?\
volumeUuid=1e816db3824f489a944f1f6c6beb83cc&volumeSnapshotUuid=223f7f53ce544036a916a73116a484f8curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dcd0948b7a90449ba8b09270ad3041d2" \
-X GET http://localhost:8080/zstack/v1/images/volume-snapshots/98fcb829c80a4b08b700fb3e43c2d8ce/candidate-backup-storage?\
volumeUuid=17d1d7becabf4800937b23d2f505a56d&volumeSnapshotUuid=98fcb829c80a4b08b700fb3e43c2d8ceRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| volumeUuid | String | query | Optional. The volume UUID. Make sure that at least one of volumeUuid and volumeSnapshotUuid is not null. | 0.6 | |
| volumeSnapshotUuid | String | query | Optional. The volume snapshot UUID. Make sure that at least one of volumeUuid and volumeSnapshotUuid is not null. | 0.6 | |
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
GetCandidateBackupStorageForCreatingImageAction action = new GetCandidateBackupStorageForCreatingImageAction();
action.volumeUuid = "77e77779b5f94617af0a8b08b4a50129";
action.volumeSnapshotUuid = "4a5220b5b1f044f8826520eb506d0f98";
action.sessionId = "45b0a87571c2476ba2fe6623daaa79cf";
GetCandidateBackupStorageForCreatingImageAction.Result res = action.call();Python
SDK
GetCandidateBackupStorageForCreatingImageAction action = GetCandidateBackupStorageForCreatingImageAction()
action.volumeUuid = "83792660358b4e14b266c5d0920b8b21"
action.volumeSnapshotUuid = "3d562e4325cc42ce8bd3115b48f79ae4"
action.sessionId = "2ba3d333ac284a20adc782766f597330"
GetCandidateBackupStorageForCreatingImageAction.Result res = action.call()CreateRootVolumeTemplateFromRootVolume
API Request
URLs
POST zstack/v1/images/root-volume-templates/from/volumes/{rootVolumeUuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "My Root Volume Template",
"backupStorageUuids": [
"e67b9791a8204b31842c3b36457ce56c"
],
"platform": "Linux",
"system": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
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/3bfc6f9eaf243299b8515382310be47bRequest Parameters
Note:
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the root volume image. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the root volume image. | 0.6 | |
| guestOsType | String | body (contained in the params structure) | Optional. The operating system type of the guest VM instance that corresponds to the root volume image. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | Optional. The backup storage UUID list. | 0.6 | |
| rootVolumeUuid | String | body (contained in the params structure) | The root volume UUID. | 0.6 | |
| platform | String | body (contained in the params structure) | Optional. The system platform of the root volume image. |
|
0.6 |
| system | boolean | body (contained in the params structure) | Optional. Whether the root volume image is a system root volume image. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the root volume image. If specified, the root volume image will use the specified value as UUID. | 0.6 | |
| architecture | String | body (contained in the params structure) | Optional. |
|
4.0.0 |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 | |
| virtio | List | body (contained in the params structure) | Optional. | 5.0.0 |
Note:
- When you create an image from a root volume, ZStack Cloud copies the value of the GuestTools tag
from VM instance to image. When you use this image to create a VM
instance, the value of the GuestTools tag will be copied from the image
to the target VM instance. Note that you can add the GuestTools
option to SystemTags.
- Format of the GuestTools option:
GuestTools::TOOLS_VERSION. Here, the initial value of TOOLS_VERSION is 1.0.0. This value will change as the version of GuestTools is upgraded. - Example:
GuestTools::1.0.0 - Note: When you create an image from the root volume of a VM instance, the value of the GuestTools tag will be copied from the VM instance to the target image.
- Format of the GuestTools option:
API Response
Sample
Response
{
"inventory": {
"uuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Windows",
"architecture": "x86_64",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"backupStorageUuid": "b94ff32725d133fea53e8ada5ea7f0fc",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
CreateRootVolumeTemplateFromRootVolumeAction action = new CreateRootVolumeTemplateFromRootVolumeAction();
action.name = "My Root Volume Template";
action.backupStorageUuids = asList("76fc4abc5650483fa1b2028fcd6ac64d");
action.rootVolumeUuid = "f368c5b20a0a4ab08ffe4e94f535ffb5";
action.platform = "Linux";
action.system = false;
action.sessionId = "50f84f52a23342a4aab43f2288a187dc";
CreateRootVolumeTemplateFromRootVolumeAction.Result res = action.call();Python
SDK
CreateRootVolumeTemplateFromRootVolumeAction action = CreateRootVolumeTemplateFromRootVolumeAction()
action.name = "My Root Volume Template"
action.backupStorageUuids = [f9dc4b8cc4254836ae46713b88e1e763]
action.rootVolumeUuid = "c89cf9d298084680a0240b49015806a6"
action.platform = "Linux"
action.system = false
action.sessionId = "ca2d794d080a4686adf31758d82926c8"
CreateRootVolumeTemplateFromRootVolumeAction.Result res = action.call()CreateRootVolumeTemplateFromVolumeSnapshot
API Request
URLs
POST zstack/v1/images/root-volume-templates/from/volume-snapshots/{snapshotUuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "My Root Volume Template",
"backupStorageUuids": [
"0d793ede7b47471cbd53eb38ce890e79"
],
"system": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"e0911cc720ea3583b21ad79892632f1a","name":"template","description":"data template from volume backup","system":false}}' \
http://localhost:8080/zstack/v1/images/data-volume-templates/from/volume-template/0c809415d427345983de1123c5be1dfbRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| snapshotUuid | String | url | The snapshot UUID. | 0.6 | |
| name | String | body (contained in the params structure) | The name of the root volume image. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the root volume image. | 0.6 | |
| guestOsType | String | body (contained in the params structure) | Optional. The operating system type of the guest VM instance that corresponds to the root volume image. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | The backup storage UUID list. | 0.6 | |
| platform | String | body (contained in the params structure) | Optional. The operating system platform of the root volume image. |
|
0.6 |
| system | boolean | body (contained in the params structure) | Optional. Whether the root volume image is a system root volume image. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the root volume image. If specified, the root volume image will use the specified value as UUID. | 0.6 | |
| architecture | String | body (contained in the params structure) | Optional. |
|
4.0.0 |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "200e14e0f67d4b7a87fbaa6821c3a250",
"name": "My Root Volume Template",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "raw",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "200e14e0f67d4b7a87fbaa6821c3a250",
"backupStorageUuid": "9b24855411df4652a521ca4d1d4e86f2",
"installPath": "ceph://zs-images/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
#failures
| Name | Type | Description | Starting Version |
|---|---|---|---|
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| error | ErrorCode | See error. | 0.6 |
SDK Sample
Java
SDK
CreateRootVolumeTemplateFromVolumeSnapshotAction action = new CreateRootVolumeTemplateFromVolumeSnapshotAction();
action.snapshotUuid = "5d10e4111e0c44f58ee13d3584110c8d";
action.name = "My Root Volume Template";
action.backupStorageUuids = asList("49a984343c554f6aa9cac7b038494f5d");
action.system = false;
action.sessionId = "bac023f582c24fc9af1097392ce1d12b";
CreateRootVolumeTemplateFromVolumeSnapshotAction.Result res = action.call();Python
SDK
CreateRootVolumeTemplateFromVolumeSnapshotAction action = CreateRootVolumeTemplateFromVolumeSnapshotAction()
action.snapshotUuid = "6dd726f9727a4358ab2aaf8cdd4675d3"
action.name = "My Root Volume Template"
action.backupStorageUuids = [c653cb53d5154a48b53d95a36e7dbae6]
action.system = false
action.sessionId = "edd92cba4301455fb15532b8bbf43459"
CreateRootVolumeTemplateFromVolumeSnapshotAction.Result res = action.call()CreateDataVolumeTemplateFromVolume
API Request
URLs
POST zstack/v1/images/data-volume-templates/from/volumes/{volumeUuid}Hearders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "My Data Volume Template",
"backupStorageUuids": [
"7fd08286addc4b388fac61935892acd7"
]
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"My Data Volume Template","backupStorageUuids":["08e337886b873e8685991d1c7ba4d1ab"]}}' \
http://localhost:8080/zstack/v1/images/data-volume-templates/from/volumes/4c941eb9faeb3976803fce2f3609a475Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the data volume image. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the data volume image. | 0.6 | |
| volumeUuid | String | body (contained in the params structure) | The UUID of the volume from which the data volume image is to be created. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | Optional. The backup storage UUID list. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the data volume image. If specified, the data volume image will use the specified value as UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID. | 5.0.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "7247cf569e2b4104832071822cf845c5",
"name": "My Data Volume Template",
"mediaType": "DataVolumeTemplate",
"platform": "Linux",
"format": "raw",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "7247cf569e2b4104832071822cf845c5",
"backupStorageUuid": "1b8ab68b7e224a30aa31f00f1db2b5a6",
"installPath": "ceph://zs-data-volume/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | Optional. The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The image size. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The image type. | 0.6 |
| guestOsType | String | The guest operating system type of the image. | 0.6 |
| type | String | The reserved field. | 0.6 |
| platform | String | The system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
CreateDataVolumeTemplateFromVolumeAction action = new CreateDataVolumeTemplateFromVolumeAction();
action.name = "My Data Volume Template";
action.volumeUuid = "816fb7184ae2498189000d7c0fe66112";
action.backupStorageUuids = asList("26b9d22ef1af4bdb880c3d77a8b1feda");
action.sessionId = "c17620d57db14c9383fbdd2650c80a73";
CreateDataVolumeTemplateFromVolumeAction.Result res = action.call();Python
SDK
CreateDataVolumeTemplateFromVolumeAction action = CreateDataVolumeTemplateFromVolumeAction()
action.name = "My Data Volume Template"
action.volumeUuid = "38b644a29b2d498ebc5b50d1d212d904"
action.backupStorageUuids = [1954c35eb0a844d8bb6a64f9963be0f5]
action.sessionId = "343ff2f080414010adb1a35957f8b700"
CreateDataVolumeTemplateFromVolumeAction.Result res = action.call()CreateDataVolumeTemplateFromVolumeSnapshot
API Request
URLs
POST zstack/v1/images/data-volume-templates/from/volume-snapshots/{snapshotUuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "My Data Volume Template",
"backupStorageUuids": [
"dbf107f8efa531f786f243850499e010"
],
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"My Data Volume Template","backupStorageUuids":["dbf107f8efa531f786f243850499e010"]}}' \
http://localhost:8080/zstack/v1/images/data-volume-templates/from/volume-snapshots/58976137bf95309692762077cd7077e3Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| snapshotUuid | String | url | The snapshot UUID. | 0.6 | |
| name | String | body (contained in the params structure) | The name of the data volume image. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the data volume image. | 0.6 | |
| backupStorageUuids | List | body (contained in the params structure) | The backup storage UUID list. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the data volume image. If specified, the data volume image will use the specified value as UUID. | 0.6 | |
| tagUuids | List | body (contained in the params structure) | The tag UUID list. | ||
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The system tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "314d80c2feb5352c984b3ffd36108c32",
"name": "My Data Volume Template",
"mediaType": "DataVolumeTemplate",
"platform": "Linux",
"format": "raw",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "314d80c2feb5352c984b3ffd36108c32",
"backupStorageUuid": "d861144baadf31e3b1cbbb282242adcf",
"installPath": "ceph://zs-images/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The state of the image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| size | Long | The size of the image. | 0.6 |
| actualSize | Long | The actual size of the image. | 0.6 |
| md5Sum | String | The MD5 checksum value of the image. | 0.6 |
| url | String | The URL of the image. | 0.6 |
| mediaType | String | The type of the image. | 0.6 |
| guestOsType | String | The type of the guest operating system that corresponds to the image. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| platform | String | The operating system platform of the image. | 0.6 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 0.6 |
| system | Boolean | Whether the image is a system image. | 0.6 |
| virtio | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| backupStorageRefs | List | See backupStorageRefs. | 0.6 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 0.6 |
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| installPath | String | The path to install the image on the backup storage. | 0.6 |
| exportUrl | String | The URL of the exported image. | 0.6 |
| exportMd5Sum | String | The MD5 checksum value of the exported image. | 0.6 |
| status | String | The status of the image. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
#failures
| Name | Type | Description | Starting Version |
|---|---|---|---|
| backupStorageUuid | String | The backup storage UUID. | 0.6 |
| error | ErrorCode | See error. | 0.6 |
SDK Sample
Java
SDK
CreateDataVolumeTemplateFromVolumeSnapshotAction action = new CreateDataVolumeTemplateFromVolumeSnapshotAction();
action.snapshotUuid = "58976137bf95309692762077cd7077e3";
action.name = "My Data Volume Template";
action.backupStorageUuids = asList("dbf107f8efa531f786f243850499e010");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeTemplateFromVolumeSnapshotAction.Result res = action.call();Python
SDK
CreateDataVolumeTemplateFromVolumeSnapshotAction action = CreateDataVolumeTemplateFromVolumeSnapshotAction()
action.snapshotUuid = "58976137bf95309692762077cd7077e3"
action.name = "My Data Volume Template"
action.backupStorageUuids = [dbf107f8efa531f786f243850499e010]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDataVolumeTemplateFromVolumeSnapshotAction.Result res = action.call()GetImageQga
API Request
URLs
GET zstack/v1/images/{uuid}/qgaHeaders
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e74211f026f741c1898d4377ecf58bd1" \
-X GET http://localhost:8080/zstack/v1/images/34a5bf0cc1014286bd944771c77e1c07/qgaRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
Sample Response
{
"enable": false
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| enable | boolean | 0.6 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
SDK Sample
Java
SDK
GetImageQgaAction action = new GetImageQgaAction();
action.uuid = "0d7b698ccb174702ae5fa7f15bce8612";
action.sessionId = "3e59586b589d4dbeb0afd078bb887655";
GetImageQgaAction.Result res = action.call();Python
SDK
GetImageQgaAction action = GetImageQgaAction()
action.uuid = "82a89e52f2c54fab9b73f095e23ddecb"
action.sessionId = "fc8ea8bda61143cea7db98957ccd026f"
GetImageQgaAction.Result res = action.call()SetImageQga
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setImageQga": {
"enable": true
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setImageQga":{"enable":true}}' \
http://localhost:8080/zstack/v1/images/f85a077c64883070ac3ba72079edc804/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| enable | boolean | body (contained in the setImageQga structure) | 0.6 | ||
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
SetImageQgaAction action = new SetImageQgaAction();
action.uuid = "0eca41aa133a43d2b8d14958cd3b3f26";
action.enable = true;
action.sessionId = "a05d7d13fb514bb5bd16060c7584d6e6";
SetImageQgaAction.Result res = action.call();Python
SDK
SetImageQgaAction action = SetImageQgaAction()
action.uuid = "f397649bf07049efb0be7836962d03fe"
action.enable = true
action.sessionId = "0bfcd0ef201142bcb00ab5903b178da5"
SetImageQgaAction.Result res = action.call()SetImageBootMode
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"setImageBootMode": {
"bootMode": "Legacy"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setImageBootMode":{"bootMode":"Legacy"}}' http://localhost:8080/zstack/v1/images/4efcba4c12cc35f4a1b262038f7e7b80/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.9.0 | |
| bootMode | String | body(contained in the setImageBootMode structure) | The image boot mode. |
|
3.9.0 |
| systemTags | List | body | Optional. The system tags. | 3.9.0 | |
| userTags | List | body | Optional. The user tags. | 3.9.0 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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
SetImageBootModeAction action = new SetImageBootModeAction();
action.uuid = "4efcba4c12cc35f4a1b262038f7e7b80";
action.bootMode = "Legacy";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetImageBootModeAction.Result res = action.call();Python
SDK
SetImageBootModeAction action = SetImageBootModeAction()
action.uuid = "4efcba4c12cc35f4a1b262038f7e7b80"
action.bootMode = "Legacy"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetImageBootModeAction.Result res = action.call()GetUploadImageJobDetails
API Request
URLs
GET zstack/v1/images/upload-job/details/{imageId}Headers
Authorization: OAuth the-session-uuidCurl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/images/upload-job/details/d41d8cd98f00b204e9800998ecf8427e?Request Parameters
| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| imageId | String | url | The user-defined image ID. We recommend that you use an MD5 value. | 4.1.0 | |
| systemTags | List | query | Optional. The system tags. | 4.1.0 | |
| userTags | List | query | Optional. The user tags. | 4.1.0 |
API Response
Sample
Response
{
"existingJobDetails": [
{
"longJobUuid": "0792dd52aeb9329cb1e677fae6465f23",
"longJobState": "Suspended",
"imageUuid": "ccf943310d86335bb3d2511ca8e14137",
"imageUploadUrl": "http://127.0.0.1:8001/imagestore/upload",
"offset": 452984832
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.1.0 |
| existingJobDetails | List | See existingJobDetails. | 4.1.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.1.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.1.0 |
#existingJobDetails
| Name | Type | Description | Starting Version |
|---|---|---|---|
| longJobUuid | String | The long job UUID. | 4.1.0 |
| longJobState | String | The long job state. | 4.1.0 |
| imageUuid | String | The image UUID. | 4.1.0 |
| imageUploadUrl | String | The image upload URL. | 4.1.0 |
| offset | long | The upload offset. Unit: bytes. | 4.1.0 |
SDK Sample
Java
SDK
GetUploadImageJobDetailsAction action = new GetUploadImageJobDetailsAction();
action.imageId = "d41d8cd98f00b204e9800998ecf8427e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetUploadImageJobDetailsAction.Result res = action.call();Python
SDK
GetUploadImageJobDetailsAction action = GetUploadImageJobDetailsAction()
action.imageId = "d41d8cd98f00b204e9800998ecf8427e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetUploadImageJobDetailsAction.Result res = action.call()CalculateImageHash
API Request
URLs
PUT zstack/v1/images/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"calculateImageHash": {
"backupStorageUuid": "0eeaa5988c743c638485304f3d1f867e",
"algorithm": "MD5"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"calculateImageHash":{"backupStorageUuid":"0eeaa5988c743c638485304f3d1f867e","algorithm":"MD5"}}' \
http://localhost:8080/zstack/v1/images/38549d5d5a3d3c5caefc18d8a9e0aa13/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The image UUID. | 5.0.0 | |
| backupStorageUuid | String | body (contained in the calculateImageHash structure) | The backup storage uuid. | 5.0.0 | |
| algorithm | String | body (contained in the calculateImageHash structure) | Optional. | 5.0.0 | |
| systemTags | List | body | Optional. The system tags. | 5.0.0 | |
| userTags | List | body | Optional. The user tags. | 5.0.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "368da584193638818c480bef63732659",
"name": "TinyLinux",
"md5Sum": "6fc2357e711877c14c09eec960e51aed",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "368da584193638818c480bef63732659",
"backupStorageUuid": "17f9f8d310763247b5dc31779d880a41",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 5.0.0 |
| description | String | The brief description of the error. | 5.0.0 |
| details | String | The details about the error. | 5.0.0 |
| elaboration | String | The reserved field. Default value: null. | 5.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 5.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 5.0.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 5.0.0 |
| name | String | The resource name. | 5.0.0 |
| description | String | The detailed description of the resource. | 5.0.0 |
| state | String | The state of the image. | 5.0.0 |
| status | String | The status of the image. | 5.0.0 |
| size | Long | The image size. | 5.0.0 |
| actualSize | Long | The actual size of the image. | 5.0.0 |
| md5Sum | String | The MD5 checksum of the image. | 5.0.0 |
| url | String | The URL of the image. | 5.0.0 |
| mediaType | String | The image type. | 5.0.0 |
| guestOsType | String | The guest operating system type of the image. | 5.0.0 |
| type | String | The reserved field. | 5.0.0 |
| platform | String | The system platform of the image. | 5.0.0 |
| architecture | String | The image architecture. | 5.0.0 |
| format | String | The image format, for example, raw. | 5.0.0 |
| virtio | Boolean | Whether the image is a system image. | 5.0.0 |
| system | Boolean | Whether virtio is supported or not. | 5.0.0 |
| createDate | Timestamp | The creation date. | 5.0.0 |
| lastOpDate | Timestamp | The last operation date. | 5.0.0 |
| backupStorageRefs | List | See backupStorageRefs. | 5.0.0 |
#backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The image UUID. | 5.0.0 |
| backupStorageUuid | String | The backup storage UUID. | 5.0.0 |
| installPath | String | The installation path on the backup storage. | 5.0.0 |
| exportUrl | String | Exporting the url of the image. | 5.0.0 |
| exportMd5Sum | String | Exporting the MD5 value of the image. | 5.0.0 |
| status | String | The image ready status. | 5.0.0 |
| createDate | Timestamp | The creation date. | 5.0.0 |
| lastOpDate | Timestamp | The last operation date. | 5.0.0 |
SDK Sample
Java
SDK
CalculateImageHashAction action = new CalculateImageHashAction();
action.uuid = "383bcf0b1515369a8169b66a91de1e00";
action.backupStorageUuid = "0eeaa5988c743c638485304f3d1f867e";
action.algorithm = "MD5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CalculateImageHashAction.Result res = action.call();Python
SDK
CalculateImageHashAction action = CalculateImageHashAction()
action.uuid = "383bcf0b1515369a8169b66a91de1e00"
action.backupStorageUuid = "0eeaa5988c743c638485304f3d1f867e"
action.algorithm = "MD5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CalculateImageHashAction.Result res = action.call()