VM Related Interfaces
Clean Up Metadata Files of Specified VM Instances on Primary Storage
Headers
Authorization: OAuth the-session-uuidBody
{
"cleanupVmInstanceMetadata": {
"vmUuids": [
"96783411c8c737c5a97e3c50ff774f7f",
"61f1952f9841316d896011a0ef17f701"
]
},
"systemTags": [],
"userTags": []
}In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can include these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"cleanupVmInstanceMetadata":{"vmUuids":["96783411c8c737c5a97e3c50ff774f7f","61f1952f9841316d896011a0ef17f701"]}}' \
http://localhost:8080/zstack/v1/vm-instances/metadata/cleanupParameters
| Name | Type | Location | Description | Optional Values | Since |
|---|---|---|---|---|---|
| vmUuids | List | body (contained in the cleanupVmInstanceMetadata structure) | List of VM instance UUIDs whose metadata needs to be cleaned up | 5.0.0 | |
| systemTags (Optional) | List | body | System tags | 5.0.0 | |
| userTags (Optional) | List | body | User tags | 5.0.0 |
API Response
Response Example
{
"totalCleaned": 5,
"totalFailed": 0,
"failedVmUuids": []
}| Name | Type | Description | Since |
|---|---|---|---|
| totalCleaned | Integer | Number of metadata files successfully cleaned up | 5.0.0 |
| totalFailed | Integer | Number of metadata files that failed to be cleaned up | 5.0.0 |
| failedVmUuids | List | List of VM instance UUIDs for which cleanup failed | 5.0.0 |
| success | boolean | Whether the operation succeeded | 5.0.0 |
| error | ErrorCode | For details, see error | 5.0.0 |
error
| Name | Type | Description | Since |
|---|---|---|---|
| code | String | Error code, which is the globally unique identifier of the error, such as SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. The default value is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null. | 0.6 |
| cause | ErrorCode | Root error that caused the current error. If there is no original error, this field is null. | 0.6 |
SDK Example
Java SDK
CleanupVmInstanceMetadataAction action = new CleanupVmInstanceMetadataAction();
action.vmUuids = asList("96783411c8c737c5a97e3c50ff774f7f","61f1952f9841316d896011a0ef17f701");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CleanupVmInstanceMetadataAction.Result res = action.call();Python SDK
action = CleanupVmInstanceMetadataAction()
action.vmUuids = [96783411c8c737c5a97e3c50ff774f7f, 61f1952f9841316d896011a0ef17f701]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()