Validate VM Scheduling Policy from VM Scheduling Group
Headers
Authorization: OAuth the-session-uuidBody
{
"validateVmSchedulingRule": {
"vmGroupUuid": "2bce1a0af86a3ceebd70ef1aaa3633d1",
"hostGroupUuid": "15b9f0a9a3c43708890eef7552959746",
"rule": "AFFINITY",
"mode": "HARD",
"zoneUuid": "538bdbde4d9d3b919e2cc9ae44542f09"
},
"systemTags": [],
"userTags": []
}The systemTags and userTags fields in the above example are optional. 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 '{"validateVmSchedulingRule":{"vmGroupUuid":"2bce1a0af86a3ceebd70ef1aaa3633d1","hostGroupUuid":"15b9f0a9a3c43708890eef7552959746","rule":"AFFINITY","mode":"HARD","zoneUuid":"538bdbde4d9d3b919e2cc9ae44542f09"}}' http://localhost:8080/zstack/v1/validate/vmSchedulingRuleParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
vmGroupUuid | String | body (contained in the validateVmSchedulingRule structure) | VM scheduling group UUID |
| 4.6.0 |
hostGroupUuid (optional) | String | body (contained in the validateVmSchedulingRule structure) | Host scheduling group UUID |
| 4.6.0 |
rule | String | body (contained in the validateVmSchedulingRule structure) | Scheduling rule |
| 4.6.0 |
mode | String | body (contained in the validateVmSchedulingRule structure) | Execution mode |
| 4.6.0 |
zoneUuid (optional) | String | body (contained in the validateVmSchedulingRule structure) | Data Center UUID |
| 4.6.0 |
systemTags (optional) | List | body | System tags |
| 4.6.0 |
userTags (optional) | List | body | User tags |
| 4.6.0 |
API Response
This API returns an empty JSON structure {} on success. 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
ValidateVmSchedulingRuleAction action = new ValidateVmSchedulingRuleAction();
action.vmGroupUuid = "2bce1a0af86a3ceebd70ef1aaa3633d1";
action.hostGroupUuid = "15b9f0a9a3c43708890eef7552959746";
action.rule = "AFFINITY";
action.mode = "HARD";
action.zoneUuid = "538bdbde4d9d3b919e2cc9ae44542f09";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ValidateVmSchedulingRuleAction.Result res = action.call();Python SDK
ValidateVmSchedulingRuleAction action = ValidateVmSchedulingRuleAction()
action.vmGroupUuid = "2bce1a0af86a3ceebd70ef1aaa3633d1"
action.hostGroupUuid = "15b9f0a9a3c43708890eef7552959746"
action.rule = "AFFINITY"
action.mode = "HARD"
action.zoneUuid = "538bdbde4d9d3b919e2cc9ae44542f09"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ValidateVmSchedulingRuleAction.Result res = action.call()