Image Storage Related InterfacesImage Related Interfaces
Calculate Image Hash
Headers
Authorization: OAuth the-session-uuidBody
{
"calculateImageHash": {
"backupStorageUuid": "0eeaa5988c743c638485304f3d1f867e",
"algorithm": "MD5"
},
"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 PUT -d '{"calculateImageHash":{"backupStorageUuid":"0eeaa5988c743c638485304f3d1f867e","algorithm":"MD5"}}' \
http://localhost:8080/zstack/v1/images/383bcf0b1515369a8169b66a91de1e00/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, uniquely identifies the resource | 4.1.0 | |
| backupStorageUuid | String | body (contained in calculateImageHash structure) | Backup Storage UUID | 4.1.0 | |
| algorithm (Optional) | String | body (contained in calculateImageHash structure) | 4.1.0 | ||
| systemTags (Optional) | List | body | System Tags | 4.1.0 | |
| userTags (Optional) | List | body | User Tags | 4.1.0 |
API Response
Response Example
{
"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"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| inventory | ImageInventory | See inventory | 4.1.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 4.1.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 | 5.0.0 |
| description | String | Brief description of the error | 5.0.0 |
| details | String | Detailed error information | 5.0.0 |
| elaboration | String | Reserved field, defaults to null | 5.0.0 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 5.0.0 |
| cause | ErrorCode | Root cause. The source error that triggered the current error. This field is null if there is no original error | 5.0.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.1.0 |
| name | String | Resource name | 4.1.0 |
| description | String | Detailed description of the resource | 4.1.0 |
| state | String | Image state | 4.1.0 |
| status | String | Image status | 4.1.0 |
| size | Long | Image size | 4.1.0 |
| actualSize | Long | Actual image size | 4.1.0 |
| md5Sum | String | Image MD5 value | 4.1.0 |
| url | String | Image URL | 4.1.0 |
| mediaType | String | Media type | 4.1.0 |
| guestOsType | String | Guest OS type | 4.1.0 |
| type | String | Internal field | 4.1.0 |
| platform | String | Image platform | 4.1.0 |
| architecture | String | 4.1.0 | |
| format | String | Image format, for example: raw | 4.1.0 |
| system | Boolean | Indicates whether it is a system image | 4.1.0 |
| virtio | Boolean | 4.1.0 | |
| createDate | Timestamp | Creation time | 4.1.0 |
| lastOpDate | Timestamp | Last modification time | 4.1.0 |
| backupStorageRefs | List | See backupStorageRefs | 4.1.0 |
backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | Image UUID | 4.1.0 |
| backupStorageUuid | String | Backup Storage UUID | 4.1.0 |
| installPath | String | Install path on the image repository | 4.1.0 |
| exportUrl | String | Export image URL | 4.1.0 |
| exportMd5Sum | String | Export image MD5 value | 4.1.0 |
| status | String | Image status | 4.1.0 |
| createDate | Timestamp | Creation time | 4.1.0 |
| lastOpDate | Timestamp | Last modification time | 4.1.0 |
SDK Examples
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()