VM Scheduling Policy Interfaces
CreateHostSchedulingRuleGroup
API Request
URLs
POST zstack/v1/hostSchedulingRuleGroupHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "test",
"description": "test desc",
"zoneUuid": "4e083eaa197835778fa94d9bfcf012d6",
"clusterUuid": "e7127ff00fbb3ed3a9755c37447b7bf8"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"name":"test","description":"test desc","zoneUuid":"4e083eaa197835778fa94d9bfcf012d6","clusterUuid":"e7127ff00fbb3ed3a9755c37447b7bf8"}}' http://localhost:8080/zstack/v1/hostSchedulingRuleGroupParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the params structure) | Detailed description of the resource | 4.6.0 | |
| zoneUuid | String | body (contained in the params structure) | Data Center UUID | 4.6.0 | |
| clusterUuid | String | body (contained in the params structure) | Cluster UUID | 4.6.0 | |
| resourceUuid (optional) | String | body (contained in the params structure) | Resource UUID | 4.6.0 | |
| tagUuids (optional) | List | body (contained in the params structure) | Tag UUID list | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"name": "test",
"description": "test desc",
"zoneUuid": "1eca7fc3081a3750b55930b194d82991",
"clusterUuid": "e73c4aa3e6a03ee3bb4f325ab3b395b1"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| clusterUuid | String | Cluster UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
CreateHostSchedulingRuleGroupAction action = new CreateHostSchedulingRuleGroupAction();
action.name = "test";
action.description = "test desc";
action.zoneUuid = "4e083eaa197835778fa94d9bfcf012d6";
action.clusterUuid = "e7127ff00fbb3ed3a9755c37447b7bf8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateHostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
CreateHostSchedulingRuleGroupAction action = CreateHostSchedulingRuleGroupAction()
action.name = "test"
action.description = "test desc"
action.zoneUuid = "4e083eaa197835778fa94d9bfcf012d6"
action.clusterUuid = "e7127ff00fbb3ed3a9755c37447b7bf8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateHostSchedulingRuleGroupAction.Result res = action.call()DeleteHostSchedulingRuleGroup
API Request
URLs
DELETE zstack/v1/hostSchedulingRuleGroup/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/hostSchedulingRuleGroup/8e02276953ab35e2b591505b0f3167c9Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 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
DeleteHostSchedulingRuleGroupAction action = new DeleteHostSchedulingRuleGroupAction();
action.uuid = "8e02276953ab35e2b591505b0f3167c9";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteHostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
DeleteHostSchedulingRuleGroupAction action = DeleteHostSchedulingRuleGroupAction()
action.uuid = "8e02276953ab35e2b591505b0f3167c9"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteHostSchedulingRuleGroupAction.Result res = action.call()UpdateHostSchedulingRuleGroup
API Request
URLs
PUT zstack/v1/hostSchedulingRuleGroup/{uuid}Headers
Authorization: OAuth the-session-uuidBody
{
"updateHostSchedulingRuleGroup": {
"name": "test",
"description": "desc"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateHostSchedulingRuleGroup":{"name":"test","description":"desc"}}' http://localhost:8080/zstack/v1/hostSchedulingRuleGroup/7127bed5295f3a3c94d9b3dbc307450dParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 4.6.0 | |
| name (optional) | String | body (contained in the updateHostSchedulingRuleGroup structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the updateHostSchedulingRuleGroup structure) | Detailed description of the resource | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"uuid": "b96c8635e48435eca42d3cbfca25704f",
"name": "test",
"description": "desc",
"zoneUuid": "afcd30e31ebb38a8b0a2f013fce73f7a",
"clusterUuid": "ae9b2f516fd43913b1d458ebe5f7222d"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| clusterUuid | String | Cluster UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
UpdateHostSchedulingRuleGroupAction action = new UpdateHostSchedulingRuleGroupAction();
action.uuid = "7127bed5295f3a3c94d9b3dbc307450d";
action.name = "test";
action.description = "desc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateHostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
UpdateHostSchedulingRuleGroupAction action = UpdateHostSchedulingRuleGroupAction()
action.uuid = "7127bed5295f3a3c94d9b3dbc307450d"
action.name = "test"
action.description = "desc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateHostSchedulingRuleGroupAction.Result res = action.call()AddHostToHostSchedulingRuleGroup
API Request
URLs
POST zstack/v1/hostSchedulingRuleGroup/{hostGroupUuid}/host/{hostUuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/hostSchedulingRuleGroup/801af67a7f1f3610a76e834e45aebf5b/host/602ca3d56dca40fcb04944dbaa9861eeParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| hostGroupUuid | String | url | Host scheduling group UUID | 4.6.0 | |
| hostUuid | String | body | Host 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
AddHostTohostSchedulingRuleGroupAction action = new AddHostTohostSchedulingRuleGroupAction();
action.hostGroupUuid = "663fb7c5b74f3bc9bf629ca3523fb8cc";
action.hostUuid = "64d7de2d3eb431c99998292d1ed5411e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddHostTohostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
AddHostTohostSchedulingRuleGroupAction action = AddHostTohostSchedulingRuleGroupAction()
action.hostGroupUuid = "663fb7c5b74f3bc9bf629ca3523fb8cc"
action.hostUuid = "64d7de2d3eb431c99998292d1ed5411e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddHostTohostSchedulingRuleGroupAction.Result res = action.call()DetachHostFromHostSchedulingRuleGroup
API Request
URLs
DELETE zstack/v1/hostSchedulingRuleGroup/{hostGroupUuid}/hostHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/hostSchedulingRuleGroup/801af67a7f1f3610a76e834e45aebf5b/hostParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| hostGroupUuid | String | url | Host scheduling group UUID | 4.6.0 | |
| hostUuid | String | body | Host 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
DetachHostFromHostSchedulingRuleGroupAction action = new DetachHostFromHostSchedulingRuleGroupAction();
action.hostGroupUuid = "801af67a7f1f3610a76e834e45aebf5b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachHostFromHostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
DetachHostFromHostSchedulingRuleGroupAction action = DetachHostFromHostSchedulingRuleGroupAction()
action.hostGroupUuid = "801af67a7f1f3610a76e834e45aebf5b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachHostFromHostSchedulingRuleGroupAction.Result res = action.call()CreateVmSchedulingRuleGroup
API Request
URLs
POST zstack/v1/vmSchedulingRuleGroupHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"zoneUuid": "eae13168e86b3698807837ca88c3b2ae",
"name": "test",
"description": "test desc"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"zoneUuid":"eae13168e86b3698807837ca88c3b2ae","name":"test","description":"test desc"}}' http://localhost:8080/zstack/v1/vmSchedulingRuleGroupParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| zoneUuid | String | body (contained in the params structure) | Data Center UUID | 4.6.0 | |
| name | String | body (contained in the params structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the params structure) | Detailed description of the resource | 4.6.0 | |
| resourceUuid (optional) | String | body (contained in the params structure) | Resource UUID | 4.6.0 | |
| tagUuids (optional) | List | body (contained in the params structure) | Tag UUID list | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"uuid": "e79dc7a0170c31d18429c7478772c5d7",
"name": "test",
"description": "test desc",
"appliance": "CUSTOMER",
"zoneUuid": "e6a7cd7917473bedbfd420797d93ed50"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
CreateVmSchedulingRuleGroupAction action = new CreateVmSchedulingRuleGroupAction();
action.zoneUuid = "eae13168e86b3698807837ca88c3b2ae";
action.name = "test";
action.description = "test desc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
CreateVmSchedulingRuleGroupAction action = CreateVmSchedulingRuleGroupAction()
action.zoneUuid = "eae13168e86b3698807837ca88c3b2ae"
action.name = "test"
action.description = "test desc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmSchedulingRuleGroupAction.Result res = action.call()DeleteVmSchedulingRuleGroup
API Request
URLs
DELETE zstack/v1/vmSchedulingRuleGroup/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vmSchedulingRuleGroup/d150bf5dca4c32768464817ab2937ac4Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 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
DeleteVmSchedulingRuleGroupAction action = new DeleteVmSchedulingRuleGroupAction();
action.uuid = "d150bf5dca4c32768464817ab2937ac4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
DeleteVmSchedulingRuleGroupAction action = DeleteVmSchedulingRuleGroupAction()
action.uuid = "d150bf5dca4c32768464817ab2937ac4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVmSchedulingRuleGroupAction.Result res = action.call()UpdateVmSchedulingRuleGroup
API Request
URLs
PUT zstack/v1/vmSchedulingRuleGroup/{uuid}/updateHeaders
Authorization: OAuth the-session-uuidBody
{
"updateVmSchedulingRuleGroup": {
"name": "test",
"description": "test desc"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateVmSchedulingRuleGroup":{"name":"test","description":"test desc"}}' http://localhost:8080/zstack/v1/vmSchedulingRuleGroup/0e8a74e4ff8d3da9bff07f0cc7d58f91/updateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 4.6.0 | |
| name (optional) | String | body (contained in the updateVmSchedulingRuleGroup structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the updateVmSchedulingRuleGroup structure) | Detailed description of the resource | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"uuid": "75840459a5f83afebc36e605a3189289",
"name": "test",
"description": "test desc",
"appliance": "CUSTOMER",
"zoneUuid": "261246b65f253787b06a29c6c266543c"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
UpdateVmSchedulingRuleGroupAction action = new UpdateVmSchedulingRuleGroupAction();
action.uuid = "0e8a74e4ff8d3da9bff07f0cc7d58f91";
action.name = "test";
action.description = "test desc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
UpdateVmSchedulingRuleGroupAction action = UpdateVmSchedulingRuleGroupAction()
action.uuid = "0e8a74e4ff8d3da9bff07f0cc7d58f91"
action.name = "test"
action.description = "test desc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVmSchedulingRuleGroupAction.Result res = action.call()AddVmToVmSchedulingRuleGroup
API Request
URLs
POST zstack/v1/vmSchedulingRuleGroup/{vmGroupUuid}/vmInstance/{vmUuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/vmSchedulingRuleGroup/663fb7c5b74f3bc9bf629ca3523fb8cc/vmInstance/64d7de2d3eb431c99998292d1ed5411eParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmGroupUuid | String | url | VM scheduling group UUID | 4.6.0 | |
| vmUuid | String | url | VM 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
AddVmToVmSchedulingRuleGroupAction action = new AddVmToVmSchedulingRuleGroupAction();
action.vmGroupUuid = "663fb7c5b74f3bc9bf629ca3523fb8cc";
action.vmUuid = "64d7de2d3eb431c99998292d1ed5411e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddVmToVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
AddVmToVmSchedulingRuleGroupAction action = AddVmToVmSchedulingRuleGroupAction()
action.vmGroupUuid = "663fb7c5b74f3bc9bf629ca3523fb8cc"
action.vmUuid = "64d7de2d3eb431c99998292d1ed5411e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddVmToVmSchedulingRuleGroupAction.Result res = action.call()DetachVmFromVmSchedulingRuleGroup
API Request
URLs
DELETE zstack/v1/vmSchedulingRuleGroup/{vmGroupUuid}/vmInstance/Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vmSchedulingRuleGroup/90c8c8b53cfc302684532e1c447e0a16/vmInstance/Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmGroupUuid | String | url | VM scheduling group UUID | 4.6.0 | |
| vmUuid | String | body | VM 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
DetachVmFromVmSchedulingRuleGroupAction action = new DetachVmFromVmSchedulingRuleGroupAction();
action.vmGroupUuid = "90c8c8b53cfc302684532e1c447e0a16";
action.vmUuid = "560967aeab103cedb06a4a8d440c8d3d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachVmFromVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
DetachVmFromVmSchedulingRuleGroupAction action = DetachVmFromVmSchedulingRuleGroupAction()
action.vmGroupUuid = "90c8c8b53cfc302684532e1c447e0a16"
action.vmUuid = "560967aeab103cedb06a4a8d440c8d3d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachVmFromVmSchedulingRuleGroupAction.Result res = action.call()GetVmSchedulingRulesExecuteState
API Request
URLs
POST zstack/v1/get/vmSchedulingRules/conflict/stateHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"uuids": [
"c6bb1e89239235f8b49bb10bc5d484cc"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"uuids":["c6bb1e89239235f8b49bb10bc5d484cc"]}}' http://localhost:8080/zstack/v1/get/vmSchedulingRules/conflict/stateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuids | List | body (contained in the params structure) | VM scheduling group UUID | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"ruleMapState": {
"2951e237b86630ac84d8eeb382513260": "Normal"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| ruleMapState | Map | For details, see ruleMapState | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#ruleMapState
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Conflict | VmSchedulingRuleExecuteState | Conflict | 4.6.0 |
| Normal | VmSchedulingRuleExecuteState | Normal | 4.6.0 |
| Invalid | VmSchedulingRuleExecuteState | Invalid | 4.6.0 |
SDK Examples
Java
SDK
GetVmSchedulingRulesExecuteStateAction action = new GetVmSchedulingRulesExecuteStateAction();
action.uuids = asList("c6bb1e89239235f8b49bb10bc5d484cc");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVmSchedulingRulesExecuteStateAction.Result res = action.call();Python
SDK
GetVmSchedulingRulesExecuteStateAction action = GetVmSchedulingRulesExecuteStateAction()
action.uuids = [c6bb1e89239235f8b49bb10bc5d484cc]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVmSchedulingRulesExecuteStateAction.Result res = action.call()CreateVmSchedulingRule
API Request
URLs
POST zstack/v1/vmsSchedulingRuleHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"rule": "AFFINITY",
"mode": "SOFT",
"vmGroupUuid": "814bca77193f3e7a871891b17f8e4122",
"hostGroupUuid": "e4241841b9083aed84726be7cbb966bf",
"name": "vm-scheduling-rule",
"description": "desc"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"rule":"AFFINITY","mode":"SOFT","vmGroupUuid":"814bca77193f3e7a871891b17f8e4122","hostGroupUuid":"e4241841b9083aed84726be7cbb966bf","name":"vm-scheduling-rule","description":"desc"}}' http://localhost:8080/zstack/v1/vmsSchedulingRuleParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| rule | String | body (contained in the params structure) | Rule |
|
4.6.0 |
| mode | String | body (contained in the params structure) | Enforcement level |
|
4.6.0 |
| vmGroupUuid | String | body (contained in the params structure) | VM scheduling group UUID | 4.6.0 | |
| hostGroupUuid (optional) | String | body (contained in the params structure) | Host scheduling group UUID | 4.6.0 | |
| name | String | body (contained in the params structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the params structure) | Detailed description of the resource | 4.6.0 | |
| policy (optional) | String | body (contained in the params structure) | Optional. The policy. |
|
4.6.0 |
| type (optional) | String | body (contained in the params structure) | Optional. The resource type. | host | 4.6.0 |
| zoneUuid (optional) | String | body (contained in the params structure) | Data Center UUID | 4.6.0 | |
| subType (optional) | String | body (contained in the params structure) | Optional. The sub type. | 4.6.0 | |
| resourceUuid (optional) | String | body (contained in the params structure) | Resource UUID | 4.6.0 | |
| tagUuids (optional) | List | body (contained in the params structure) | Tag UUID list | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"uuid": "d517b42f669b324288fe8977a7df2e4d",
"name": "affinity-group-test",
"description": "affinity group for test",
"policy": "ANTISOFT",
"version": "1.0",
"type": "HOST"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| policy | String | The policy. | 4.6.0 |
| version | String | The version. | 4.6.0 |
| type | String | The resource type. | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| state | String | The resource state. | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
| usages | List | For details, see usages | 4.6.0 |
#usages
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| affinityGroupUuid | String | The affinity group UUID. | 4.6.0 |
| resourceUuid | String | The resource UUID. | 4.6.0 |
| resourceType | String | The resource type. | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
CreateVmSchedulingRuleAction action = new CreateVmSchedulingRuleAction();
action.rule = "AFFINITY";
action.mode = "SOFT";
action.vmGroupUuid = "814bca77193f3e7a871891b17f8e4122";
action.hostGroupUuid = "e4241841b9083aed84726be7cbb966bf";
action.name = "vm-scheduling-rule";
action.description = "desc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmSchedulingRuleAction.Result res = action.call();Python
SDK
CreateVmSchedulingRuleAction action = CreateVmSchedulingRuleAction()
action.rule = "AFFINITY"
action.mode = "SOFT"
action.vmGroupUuid = "814bca77193f3e7a871891b17f8e4122"
action.hostGroupUuid = "e4241841b9083aed84726be7cbb966bf"
action.name = "vm-scheduling-rule"
action.description = "desc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmSchedulingRuleAction.Result res = action.call()RemoveVmSchedulingRule
API Request
URLs
DELETE zstack/v1/vmSchedulingRule/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vmSchedulingRule/b247592a7e773a338a8965dc0d2cffadParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 4.6.0 | |
| deleteMode (optional) | String | body | Deletion mode |
|
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
RemoveVmSchedulingRuleAction action = new RemoveVmSchedulingRuleAction();
action.uuid = "b247592a7e773a338a8965dc0d2cffad";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveVmSchedulingRuleAction.Result res = action.call();Python
SDK
RemoveVmSchedulingRuleAction action = RemoveVmSchedulingRuleAction()
action.uuid = "b247592a7e773a338a8965dc0d2cffad"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveVmSchedulingRuleAction.Result res = action.call()ChangeVmSchedulingRuleState
API Request
URLs
PUT zstack/v1/vmSchedulingRule/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"changeVmSchedulingRuleState": {
"state": "enable"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"changeVmSchedulingRuleState":{"state":"enable"}}' http://localhost:8080/zstack/v1/vmSchedulingRule/907848e59a963a97a237c6dcb26d96ba/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 4.6.0 | |
| state | String | body (contained in the changeVmSchedulingRuleState structure) |
Target state |
|
4.6.0 |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"rule": "AFFINITY",
"mode": "SOFT",
"uuid": "8ab474e792183589b6a58bbe473c635a",
"name": "Test-AffinityGroup",
"description": "Test-AffinityGroup",
"version": "1.0",
"type": "HOST",
"appliance": "CUSTOMER",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| rule | String | Rule | 4.6.0 |
| mode | String | Execution mode | 4.6.0 |
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| policy | String | The policy. | 4.6.0 |
| version | String | The version. | 4.6.0 |
| type | String | The resource type. | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| state | String | The resource state. | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
| usages | List | For details, see usages | 4.6.0 |
#usages
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the VM scheduling group-to-resource binding relationship | 4.6.0 |
| affinityGroupUuid | String | Affinity group UUID | 4.6.0 |
| resourceUuid | String | Resource UUID | 4.6.0 |
| resourceType | String | Resource type | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
ChangeVmSchedulingRuleStateAction action = new ChangeVmSchedulingRuleStateAction();
action.uuid = "907848e59a963a97a237c6dcb26d96ba";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVmSchedulingRuleStateAction.Result res = action.call();Python
SDK
ChangeVmSchedulingRuleStateAction action = ChangeVmSchedulingRuleStateAction()
action.uuid = "907848e59a963a97a237c6dcb26d96ba"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVmSchedulingRuleStateAction.Result res = action.call()UpdateVmSchedulingRule
API Request
URLs
PUT zstack/v1/vmSchedulingRule/{uuid}/updateHeaders
Authorization: OAuth the-session-uuidBody
{
"updateVmSchedulingRule": {
"name": "new name",
"description": "desc",
"mode": "SOFT"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateVmSchedulingRule":{"name":"new name","description":"desc","mode":"SOFT"}}' http://localhost:8080/zstack/v1/vmSchedulingRule/5c23ac3de87f33ff955430556e9d1104/updateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | UUID of the resource. Uniquely identifies the resource | 4.6.0 | |
| name (optional) | String | body (contained in the updateVmSchedulingRule structure) | Resource name | 4.6.0 | |
| description (optional) | String | body (contained in the updateVmSchedulingRule structure) | Detailed description of the resource | 4.6.0 | |
| mode (optional) | String | body (contained in the updateVmSchedulingRule structure) | Optional. The mode. | 4.6.0 | |
| systemTags (optional) | List | body | System tags | 4.6.0 | |
| userTags (optional) | List | body | User tags | 4.6.0 |
API Response
Response Example
{
"inventory": {
"rule": "AFFINITY",
"mode": "SOFT",
"uuid": "36f4174c0fcf3aefa24927f33aa2eba8",
"name": "group",
"description": "group for test",
"policy": "ANTISOFT",
"type": "HOST"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.6.0 |
| inventory | AffinityGroupInventory | For details, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.6.0 |
| description | String | Brief description of the error | 4.6.0 |
| details | String | Detailed information about the error | 4.6.0 |
| elaboration | String | Reserved field. Default is null | 4.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.6.0 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| rule | String | Rule | 4.6.0 |
| mode | String | Execution mode | 4.6.0 |
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| policy | String | The policy. | 4.6.0 |
| version | String | The version. | 4.6.0 |
| type | String | The resource type. | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| state | String | The resource state. | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
| usages | List | For details, see usages | 4.6.0 |
#usages
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the VM scheduling group-to-resource binding relationship | 4.6.0 |
| affinityGroupUuid | String | Affinity group UUID | 4.6.0 |
| resourceUuid | String | Resource UUID | 4.6.0 |
| resourceType | String | Resource type | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
SDK Examples
Java
SDK
UpdateVmSchedulingRuleAction action = new UpdateVmSchedulingRuleAction();
action.uuid = "5c23ac3de87f33ff955430556e9d1104";
action.name = "new name";
action.description = "desc";
action.mode = "SOFT";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVmSchedulingRuleAction.Result res = action.call();Python
SDK
UpdateVmSchedulingRuleAction action = UpdateVmSchedulingRuleAction()
action.uuid = "5c23ac3de87f33ff955430556e9d1104"
action.name = "new name"
action.description = "desc"
action.mode = "SOFT"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVmSchedulingRuleAction.Result res = action.call()ValidateVmSchedulingRule
API Request
URLs
PUT zstack/v1/validate/vmSchedulingRuleHeaders
Authorization: OAuth the-session-uuidBody
{
"validateVmSchedulingRule": {
"vmGroupUuid": "2bce1a0af86a3ceebd70ef1aaa3633d1",
"hostGroupUuid": "15b9f0a9a3c43708890eef7552959746",
"rule": "AFFINITY",
"mode": "HARD",
"zoneUuid": "538bdbde4d9d3b919e2cc9ae44542f09"
},
"systemTags": [],
"userTags": []
}
Note: 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()QueryVmSchedHistory
API Request
URLs
GET zstack//v1/vm/sched-historyGET zstack//v1/vm/sched-history/{vmInstanceUuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm/sched-history?q=vmInstanceUuid=15b5b8ab631d300592bf83d66331f914curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm/sched-history/{vmInstanceUuid}?q=vmInstanceUuid=4240a319fabf3728960d1d7639f3fc0fQueryable Fields
Run the CLI tool, enter QueryVmSchedHistory and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
{
"inventories": [
{
"id": 0.0,
"vmInstanceUuid": "ec8fe40b4b0a38bc8f195bfc8bfc72e9",
"accountUuid": "b07dda064256343c894cecfa5d50b42c",
"schedType": "VMHA",
"success": true,
"lastHostUuid": "d4d26f65cfff3fafb98d3da284290455",
"destHostUuid": "bc001bb4d762395db4b2ed97c6d6dae3"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| inventories | List | For details, see inventories | 4.4.24 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vmInstanceUuid | String | Virtual Machine UUID | 4.4.24 |
| accountUuid | String | Account UUID | 4.4.24 |
| schedType | String | The sched type. | 4.4.24 |
| success | Boolean | Whether the operation succeeded. | 4.4.24 |
| lastHostUuid | String | The last host UUID. | 4.4.24 |
| destHostUuid | String | The dest host UUID. | 4.4.24 |
| createDate | Timestamp | Creation time | 4.4.24 |
| lastOpDate | Timestamp | Last modification time | 4.4.24 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 4.4.24 |
| description | String | Brief description of the error | 4.4.24 |
| details | String | Detailed information about the error | 4.4.24 |
| elaboration | String | Reserved field. Default is null | 4.4.24 |
| opaque | LinkedHashMap | Reserved field. Default is null | 4.4.24 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 4.4.24 |
SDK Examples
Java
SDK
QueryVmSchedHistoryAction action = new QueryVmSchedHistoryAction();
action.conditions = asList("vmInstanceUuid=b35d14e4af4c3f4c8f745e73df083020");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmSchedHistoryAction.Result res = action.call();Python
SDK
QueryVmSchedHistoryAction action = QueryVmSchedHistoryAction()
action.conditions = ["vmInstanceUuid=f9bd0652c3843cb285c2e7b8c9f4561b"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmSchedHistoryAction.Result res = action.call()QueryHostSchedulingRuleGroup
API Request
URLs
GET zstack/v1/query/host/schedulingRule/groupHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/query/host/schedulingRule/group?q=uuid=dfa2eb73ea3e3fd48371d91dc19a53b6Queryable Fields
Run the CLI tool, enter QueryHostSchedulingRuleGroup and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
Response Example
{
"inventories": [
{
"uuid": "8236e15b68f9391b84c6375033b50b68",
"name": "test",
"description": "description",
"zoneUuid": "54a86b72e1ec3a22b7525996031aabfc"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.7.0 |
| inventories | List | For details, see inventories | 4.7.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.7.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| clusterUuid | String | Cluster UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null | 0.6 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 0.6 |
SDK Examples
Java
SDK
QueryHostSchedulingRuleGroupAction action = new QueryHostSchedulingRuleGroupAction();
action.conditions = asList("uuid=a1ded772a30a3e0a99abffef4eeb17dc");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryHostSchedulingRuleGroupAction.Result res = action.call();Python
SDK
QueryHostSchedulingRuleGroupAction action = QueryHostSchedulingRuleGroupAction()
action.conditions = ["uuid=45cfff84ae4637678b5b2f52b9f6e88d"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryHostSchedulingRuleGroupAction.Result res = action.call()QueryVmSchedulingRuleGroup
API Request
URLs
GET zstack/v1/query/vm/schedulingRule/groupHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/query/vm/schedulingRule/group?q=uuid=f0e0262e8a003001a13d0f61ea51baf1Queryable Fields
Run the CLI tool, enter QueryVmSchedulingRuleGroup and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
Response Example
{
"inventories": [
{
"uuid": "11ff7ecb7d2b3f129f28e7f48982ca18",
"name": "test",
"description": "description",
"appliance": "appliance",
"zoneUuid": "9839f67b087f37a19360c24e83b1b7a2"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.7.0 |
| inventories | List | For details, see inventories | 4.7.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.7.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null | 0.6 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 0.6 |
SDK Examples
Java
SDK
QueryVmSchedulingRuleGroupAction action = new QueryVmSchedulingRuleGroupAction();
action.conditions = asList("uuid=3415c61c47643a9989f81aabcf1945db");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmSchedulingRuleGroupAction.Result res = action.call();Python
SDK
QueryVmSchedulingRuleGroupAction action = QueryVmSchedulingRuleGroupAction()
action.conditions = ["uuid=dc69c1d78fd236748df8597b74c78861"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmSchedulingRuleGroupAction.Result res = action.call()QueryVmSchedulingRule
API Request
URLs
GET zstack/v1/query/vm/schedulingRuleHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/query/vm/schedulingRule?q=uuid=2964e2f366e73491b858ca2da4052624Queryable Fields
Run the CLI tool, enter QueryVmSchedulingRule and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
Response Example
{
"inventories": [
{
"rule": "rule",
"mode": "mode",
"uuid": "ef5e45f916b03e7cae291e3134c3eaa1",
"name": "test",
"description": "description"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.7.0 |
| inventories | List | For details, see inventories | 4.7.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.7.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| rule | String | Rule | 4.6.0 |
| mode | String | Execution mode | 4.6.0 |
| uuid | String | UUID of the resource. Uniquely identifies the resource | 4.6.0 |
| name | String | Resource name | 4.6.0 |
| description | String | Detailed description of the resource | 4.6.0 |
| policy | String | The policy. | 4.6.0 |
| version | String | The version. | 4.6.0 |
| type | String | The resource type. | 4.6.0 |
| appliance | String | The appliance. | 4.6.0 |
| zoneUuid | String | Data Center UUID | 4.6.0 |
| state | String | The resource state. | 4.6.0 |
| createDate | Timestamp | Creation time | 4.6.0 |
| lastOpDate | Timestamp | Last modification time | 4.6.0 |
| usages | List | For details, see usages | 4.6.0 |
#usages
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource. Uniquely identifies the resource | 2.2 |
| affinityGroupUuid | String | The affinity group UUID. | 2.2 |
| resourceUuid | String | The resource UUID. | 2.2 |
| resourceType | String | The resource type. | 2.2 |
| createDate | Timestamp | Creation time | 2.2 |
| lastOpDate | Timestamp | Last modification time | 2.2 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null | 0.6 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists | 0.6 |
SDK Examples
Java
SDK
QueryVmSchedulingRuleAction action = new QueryVmSchedulingRuleAction();
action.conditions = asList("uuid=8a051adee823307e82d355b6385b589d");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmSchedulingRuleAction.Result res = action.call();Python
SDK
QueryVmSchedulingRuleAction action = QueryVmSchedulingRuleAction()
action.conditions = ["uuid=39b75b6de9113e4f9915a024ebd2f05c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmSchedulingRuleAction.Result res = action.call()GetVmsSchedulingStateFromSchedulingRule
API Request
URLs
POST zstack/v1/get/vms/schedulingState/from/SchedulingRuleHeaders
Authorization: OAuth the-session-uuidBody
Note: The
{
"params": {
"ruleUuid": "ff0e4855dd0f309f8b8e4914edbcbf00",
"vmUuids": [
"ff01ec80fd11327cba7519b66119d900"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"ruleUuid":"ff0e4855dd0f309f8b8e4914edbcbf00","vmUuids":["ff01ec80fd11327cba7519b66119d900"]}}' \
http://localhost:8080/zstack/v1/get/vms/schedulingState/from/SchedulingRuleParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| ruleUuid | String | body (contained in the params structure) |
Scheduling rule UUID | 4.6.0 | |
| vmUuids | List | body (contained in the params structure) |
Virtual Machine 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
GetVmsSchedulingStateFromSchedulingRuleAction action = new GetVmsSchedulingStateFromSchedulingRuleAction();
action.ruleUuid = "ff0e4855dd0f309f8b8e4914edbcbf00";
action.vmUuids = asList("ff01ec80fd11327cba7519b66119d900");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVmsSchedulingStateFromSchedulingRuleAction.Result res = action.call();Python
SDK
GetVmsSchedulingStateFromSchedulingRuleAction action = GetVmsSchedulingStateFromSchedulingRuleAction()
action.ruleUuid = "ff0e4855dd0f309f8b8e4914edbcbf00"
action.vmUuids = [ff01ec80fd11327cba7519b66119d900]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVmsSchedulingStateFromSchedulingRuleAction.Result res = action.call()ListVmSchedulingRulesFromExecuteState
API Request
URLs
POST zstack/v1/list/vmSchedulingRules/from/conflict/stateHeaders
Authorization: OAuth the-session-uuidBody
Note: The
{
"params": {
"executeStates": [
"Enabled"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"executeStates":["Enabled"]}}' \
http://localhost:8080/zstack/v1/list/vmSchedulingRules/from/conflict/stateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| executeStates | List | body (contained in the params structure) |
Scheduling state (Conflict, Normal, Invalid) | 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
ListVmSchedulingRulesFromExecuteStateAction action = new ListVmSchedulingRulesFromExecuteStateAction();
action.executeStates = asList("Enabled");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ListVmSchedulingRulesFromExecuteStateAction.Result res = action.call();Python
SDK
ListVmSchedulingRulesFromExecuteStateAction action = ListVmSchedulingRulesFromExecuteStateAction()
action.executeStates = [Enabled]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ListVmSchedulingRulesFromExecuteStateAction.Result res = action.call()ListVmsFromSchedulingState
API Request
URLs
POST zstack/v1/list/vms/from/executeStateHeaders
Authorization: OAuth the-session-uuidBody
Note: The
{
"params": {
"ruleUuid": "ff0e4855dd0f309f8b8e4914edbcbf00",
"executeStates": [
"SCHEDULED",
"EXECUTING"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"ruleUuid":"ff0e4855dd0f309f8b8e4914edbcbf00","executeStates":["SCHEDULED","EXECUTING"]}}' \
http://localhost:8080/zstack/v1/list/vms/from/executeStateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| ruleUuid | String | body (contained in the params structure) |
Scheduling rule UUID | 4.6.0 | |
| executeStates | List | body (contained in the params structure) |
Scheduling state (Conflict, Normal, Invalid) | 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
ListVmsFromSchedulingStateAction action = new ListVmsFromSchedulingStateAction();
action.ruleUuid = "ff0e4855dd0f309f8b8e4914edbcbf00";
action.executeStates = asList("SCHEDULED","EXECUTING");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ListVmsFromSchedulingStateAction.Result res = action.call();Python
SDK
ListVmsFromSchedulingStateAction action = ListVmsFromSchedulingStateAction()
action.ruleUuid = "ff0e4855dd0f309f8b8e4914edbcbf00"
action.executeStates = [SCHEDULED, EXECUTING]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ListVmsFromSchedulingStateAction.Result res = action.call()