Clear Data Storage Image Cache

PUT/zstack/v1/primary-storage/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "cleanUpImageCacheOnPrimaryStorage": {},
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"cleanUpImageCacheOnPrimaryStorage":{}}' \
http://localhost:8080/zstack/v1/primary-storage/06e884ad8dbf3ed0bb061f4645b17075/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

Data Storage UUID, uniquely identifies the resource

 

0.6

mode (Optional)

String

body

Mode

  • soft
  • hard

3.10.0

systemTags (Optional)

List

body

System Tags

 

0.6

userTags (Optional)

List

body

User Tags

 

0.6

API Response

When this API succeeds, it returns an empty JSON structure {}. When an error occurs, the returned JSON structure contains 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 Examples

Java SDK

CleanUpImageCacheOnPrimaryStorageAction action = new CleanUpImageCacheOnPrimaryStorageAction();
action.uuid = "cb50319265d540e19cbf98137fcbca0e";
action.sessionId = "5dc546cb18cc46b885412564a39c512f";
CleanUpImageCacheOnPrimaryStorageAction.Result res = action.call();

Python SDK

CleanUpImageCacheOnPrimaryStorageAction action = CleanUpImageCacheOnPrimaryStorageAction()
action.uuid = "cd35f62a64cd4daf9397f2e3bf5e910b"
action.sessionId = "e3ef197e97264195903b0fbdf52ae4c7"
CleanUpImageCacheOnPrimaryStorageAction.Result res = action.call()