VM Related Interfaces

Clean Up Metadata Files of Specified VM Instances on Primary Storage

PUT/zstack/v1/vm-instances/metadata/cleanup

Headers

Authorization: OAuth the-session-uuid

Body

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

Parameters

NameTypeLocationDescriptionOptional ValuesSince
vmUuidsListbody (contained in the cleanupVmInstanceMetadata structure)List of VM instance UUIDs whose metadata needs to be cleaned up 5.0.0
systemTags (Optional)ListbodySystem tags 5.0.0
userTags (Optional)ListbodyUser tags 5.0.0

API Response

Response Example

{
  "totalCleaned": 5,
  "totalFailed": 0,
  "failedVmUuids": []
}
NameTypeDescriptionSince
totalCleanedIntegerNumber of metadata files successfully cleaned up5.0.0
totalFailedIntegerNumber of metadata files that failed to be cleaned up5.0.0
failedVmUuidsListList of VM instance UUIDs for which cleanup failed5.0.0
successbooleanWhether the operation succeeded5.0.0
errorErrorCodeFor details, see error5.0.0

error

NameTypeDescriptionSince
codeStringError code, which is the globally unique identifier of the error, such as SYS.1000 or HOST.10010.6
descriptionStringSummary description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. The default value is null.0.6
opaqueLinkedHashMapReserved field. The default value is null.0.6
causeErrorCodeRoot 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()