Image Storage Related InterfacesImage Related Interfaces

Calculate Image Hash

PUT/zstack/v1/images/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "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/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlResource UUID, uniquely identifies the resource 4.1.0
backupStorageUuidStringbody (contained in calculateImageHash structure)Backup Storage UUID 4.1.0
algorithm (Optional)Stringbody (contained in calculateImageHash structure)  4.1.0
systemTags (Optional)ListbodySystem Tags 4.1.0
userTags (Optional)ListbodyUser 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"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successboolean 4.1.0
inventoryImageInventorySee inventory4.1.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error4.1.0

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10015.0.0
descriptionStringBrief description of the error5.0.0
detailsStringDetailed error information5.0.0
elaborationStringReserved field, defaults to null5.0.0
opaqueLinkedHashMapReserved field, defaults to null5.0.0
causeErrorCodeRoot cause. The source error that triggered the current error. This field is null if there is no original error5.0.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.1.0
nameStringResource name4.1.0
descriptionStringDetailed description of the resource4.1.0
stateStringImage state4.1.0
statusStringImage status4.1.0
sizeLongImage size4.1.0
actualSizeLongActual image size4.1.0
md5SumStringImage MD5 value4.1.0
urlStringImage URL4.1.0
mediaTypeStringMedia type4.1.0
guestOsTypeStringGuest OS type4.1.0
typeStringInternal field4.1.0
platformStringImage platform4.1.0
architectureString 4.1.0
formatStringImage format, for example: raw4.1.0
systemBooleanIndicates whether it is a system image4.1.0
virtioBoolean 4.1.0
createDateTimestampCreation time4.1.0
lastOpDateTimestampLast modification time4.1.0
backupStorageRefsListSee backupStorageRefs4.1.0

backupStorageRefs

NameTypeDescriptionStarting Version
imageUuidStringImage UUID4.1.0
backupStorageUuidStringBackup Storage UUID4.1.0
installPathStringInstall path on the image repository4.1.0
exportUrlStringExport image URL4.1.0
exportMd5SumStringExport image MD5 value4.1.0
statusStringImage status4.1.0
createDateTimestampCreation time4.1.0
lastOpDateTimestampLast modification time4.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()