Change VM Scheduling Policy State

PUT/zstack/v1/vmSchedulingRule/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeVmSchedulingRuleState": {
    "state": "enable"
  },
  "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 '{"changeVmSchedulingRuleState":{"state":"enable"}}' http://localhost:8080/zstack/v1/vmSchedulingRule/907848e59a963a97a237c6dcb26d96ba/actions

Parameter 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

  • enable
  • disable

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"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.6.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error4.6.0
inventoryAffinityGroupInventoryFor details, see inventory4.6.0

error

NameTypeDescriptionStarting Version
codeStringError code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10014.6.0
descriptionStringBrief description of the error4.6.0
detailsStringDetailed information about the error4.6.0
elaborationStringReserved field. Default is null4.6.0
opaqueLinkedHashMapReserved field. Default is null4.6.0
causeErrorCodeRoot error. The source error that caused the current error. This field is null if no root error exists4.6.0

inventory

NameTypeDescriptionStarting Version
ruleStringRule4.6.0
modeStringExecution mode4.6.0
uuidStringUUID of the resource. Uniquely identifies the resource4.6.0
nameStringResource name4.6.0
descriptionStringDetailed description of the resource4.6.0
policyString 4.6.0
versionString 4.6.0
typeString 4.6.0
applianceString 4.6.0
zoneUuidStringData Center UUID4.6.0
stateString 4.6.0
createDateTimestampCreation time4.6.0
lastOpDateTimestampLast modification time4.6.0
usagesListFor details, see usages4.6.0

usages

NameTypeDescriptionStarting Version
uuidStringUUID of the VM scheduling group-to-resource binding relationship4.6.0
affinityGroupUuidStringAffinity group UUID4.6.0
resourceUuidStringResource UUID4.6.0
resourceTypeStringResource type4.6.0
createDateTimestampCreation time4.6.0
lastOpDateTimestampLast modification time4.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()