Create Cluster DRS
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "test",
"automationLevel": "Automatic",
"thresholds": [
{
"thresholdName": "cpuUsedPercentThreshold",
"thresholdValue": "90",
"operator": ">="
}
],
"thresholdDuration": 10,
"defaultEnable": true
},
"systemTags": [],
"userTags": []
}In the above example, the systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"test","automationLevel":"Automatic","thresholds":[{"thresholdName":"cpuUsedPercentThreshold","thresholdValue":"90","operator":">="}],"thresholdDuration":10,"defaultEnable":true}}' \
http://localhost:8080/zstack/v1/clusters/ff0bcb94de7a3567b641d3fde2329d00/drsParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
name | String | body(included in the | The resource name |
| 4.0.0 |
description (Optional) | String | body(included in the | The detailed description of the resource |
| 4.0.0 |
clusterUuid | String | url | The Cluster UUID |
| 4.0.0 |
automationLevel | String | body(included in the | Whether scheduling is triggered manually or automatically |
| 4.0.0 |
thresholds | List | body(included in the | The threshold criteria |
| 4.0.0 |
thresholdDuration | Integer | body(included in the | The threshold evaluation duration. The system queries the workload data for the period from the current time back to thresholdDuration, calculates the result, and compares it with the threshold to determine whether the Cluster requires scheduling. |
| 4.0.0 |
defaultEnable (Optional) | boolean | body(included in the | The enabled state of the Cluster DRS upon creation |
| 4.0.0 |
resourceUuid (Optional) | String | body(included in the | The resource UUID |
| 4.0.0 |
tagUuids (Optional) | List | body(included in the | The list of tag UUIDs |
| 3.4.0 |
systemTags (Optional) | List | body | System tags |
| 4.0.0 |
userTags (Optional) | List | body | User tags |
| 4.0.0 |
API Response
On success, this API returns an empty JSON structure {}. On failure, 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
CreateClusterDRSAction action = new CreateClusterDRSAction();
action.name = "test";
action.clusterUuid = "ff0bcb94de7a3567b641d3fde2329d00";
action.automationLevel = "Automatic";
action.thresholds = asList([thresholdName:cpuUsedPercentThreshold, thresholdValue:90, operator:>=]);
action.thresholdDuration = 10;
action.defaultEnable = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateClusterDRSAction.Result res = action.call();Python SDK
CreateClusterDRSAction action = CreateClusterDRSAction()
action.name = "test"
action.clusterUuid = "ff0bcb94de7a3567b641d3fde2329d00"
action.automationLevel = "Automatic"
action.thresholds = [[thresholdName:cpuUsedPercentThreshold, thresholdValue:90, operator:>=]]
action.thresholdDuration = 10
action.defaultEnable = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateClusterDRSAction.Result res = action.call()