(Click to open topic with navigation)
This section describes behavior of the Policies object in Moab Web Services. It contains the URLs, request bodies, and responses delivered to and from MWS.
The Fields: Policies reference section contains the type and description of fields of all Policies.
Supported policies
Name | ID |
---|---|
Automatic VM Migration | auto-vm-migration |
Fairshare | fairshare |
Hypervisor Allocation Overcommit | hv-allocation-overcommit |
Migration Exclusion List | migration-exclusion-list |
Node Allocation | node-allocation |
Supported methods
Resource | GET | PUT | POST | DELETE |
---|---|---|---|---|
/rest/policies | Get All Policies | -- | -- | -- |
/rest/policies/<id> | Get Single Policy | Modify Policy | -- | -- |
This topic contains these sections:
The HTTP GET method is used to retrieve Policies information.
Quick reference
GET http://localhost:8080/mws/rest/policies?api-version=3
URLs and parameters
GET http://localhost:8080/mws/rest/policies?api-version=3
Parameter | Required | Type | Description | Example |
---|---|---|---|---|
query | No | JSON | Query for specific results. | query={"state":"DISABLED","conflicted":"false"} |
sort | No | JSON | Sort the results. Use 1 for ascending and -1 for descending. | sort={"id":-1} |
See Global URL Parameters for available URL parameters.
Sample response
GET http://localhost:8080/mws/rest/policies?api-version=3&fields=id,state,conflicted
------------------------------------
{
"totalCount": 4,
"resultCount": 4,
"results": [ {
"conflicted": false,
"state": "DISABLED",
"id": "auto-vm-migration"
},{
"conflicted": false,
"state": "DISABLED",
"id": "hv-allocation-overcommit"
},{
"conflicted": false,
"state": "DISABLED",
"id": "node-allocation"
},{
"conflicted": false,
"state": "DISABLED",
"id": "migration-exclusion-list"
}]
}
URLs and parameters
GET http://localhost:8080/mws/rest/policies/<id>?api-version=3
Parameter | Required | Type | Valid values | Description |
---|---|---|---|---|
id | Yes | String | -- | The unique identifier of the object. |
See Global URL Parameters for available URL parameters.
Sample responses
Auto VM Migration ------------------------------------ { "conflicted": false, "description": "Controls how virtual machines are automatically migrated.", "id": "auto-vm-migration", "name": "Auto VM Migration", "potentialConflicts": [], "priority": 1, "state": "DISABLED", "tags": [], "types": [], "version": 0, "genericMetricThresholds":{ "GMETRIC1":1.3 }, "processorUtilizationThreshold":0.5, "memoryUtilizationThreshold":0.4 }
Fairshare ------------------------------------ { "conflicted": false, "decayFactor": 0.44, "depth": 4, "description": "Control job feasibility and priority decisions based on system utilization targets for users, groups, accounts, classes, and QoS levels.", "intervalSeconds": 600, "name": "Fairshare", "potentialConflicts": [], "priority": 16, "state": "ENABLED", "tags": [], "types": [], "usageMetric": "DEDICATED_PROCESSOR_SECONDS_DELIVERED", "version": 3, "id": "fairshare" }
Hypervisor Allocation Overcommit ------------------------------------ { "conflicted": false, "description": "Controls how hypervisors are overallocated with regards to processors and memory.", "id": "hv-allocation-overcommit", "name": "Hypervisor Allocation Overcommit", "potentialConflicts": [], "priority": 2, "state": "DISABLED", "tags": [], "types": [], "version": 0, "processorAllocationLimit":29.5, "memoryAllocationLimit":1.2 }
Migration Exclusion List ------------------------------------ { "conflicted": false, "description": "Controls which machines are excluded from automatic live migration operations.", "hvExclusionList": ["blade05", "blade02"], "name": "Migration Exclusion List", "potentialConflicts": [], "priority": 100, "state": "DISABLED", "tags": [], "types": [], "version": 1, "vmExclusionList": ["vm1", "vm5"], "id": "migration-exclusion-list" }
Node Allocation ------------------------------------ { "conflicted": false, "description": "Controls how nodes are selected for workload placement.", "id": "node-allocation", "name": "Node Allocation", "potentialConflicts": [], "priority": 3, "state": "DISABLED", "tags": [], "types": [], "version": 0, "nodeAllocationAlgorithm": "CustomPriority", "customPriorityFunction": "-100*GMETRIC[vmcount]" }
The HTTP PUT method is used to modify Policies.
Quick reference
PUT http://localhost:8080/mws/rest/policies/<id>?api-version=3
URLs and parameters
PUT http://localhost:8080/mws/rest/policies/<id>?api-version=3[&change-mode=set]
Parameter | Required | Type | Valid values | Description |
---|---|---|---|---|
id | Yes | String | -- | The unique identifier of the object. |
See Global URL Parameters for available URL parameters.
Additional URL parameters
URL parameters for modifying a Migration Exclusion Lists Policy.
Migration Exclusion Lists parameter | Required | Type | Valid values | Description |
---|---|---|---|---|
change-mode | No | String |
set (default) add remove |
If set, replace existing exclusion list(s) with the given one. If add, add the given VMs/HVs to the existing exclusion list(s). If remove, remove the given VMs/HVs from the existing exclusion list(s). |
Request body
In general, the fields shown in the Fields: Policies reference section are not available for modification. However, the state field may be modified to a valid PolicyState. All other fields listed in the specific policy type sections (i.e. AutoVMMigrationPolicy) may be modified unless documented otherwise.
JSON request body for Auto VM Migration Policy ------------------------------------ { "genericMetricThresholds": { "GENERICTHRESHOLD": 5 }, "memoryUtilizationThreshold": 0.5, "processorUtilizationThreshold": 0.4 }
JSON request body for Fairshare Policy ------------------------------------ { "decayFactor": 0.44, "depth": 4, "intervalSeconds": 600, "usageMetric": "DEDICATED_PROCESSOR_SECONDS_DELIVERED", }
JSON request body for Hypervisor Allocation Overcommit Policy ------------------------------------ { "processorAllocationLimit":29.5, "memoryAllocationLimit":1.2 }
JSON request body for Migration Exclusion Lists Policy ------------------------------------ { "vmExclusionList" : ["vm1","vm3","vm5"], "hvExclusionList" : ["hv2","hv3","hv6"] }
JSON request body for Node Allocation Policy ------------------------------------ { "nodeAllocationAlgorithm" : "CustomPriority", "customPriorityFunction" : "-100*GMETRIC[vmcount]" }
Sample response
JSON response ------------------------------------ { "messages": ["Policy auto-vm-migration updated"] }
Samples
Enable the Auto VM Migration Policy and set values.
PUT http://localhost:8080/mws/rest/policies/auto-vm-migration?api-version=3
------------------------------------
{
"state": "enabled",
"migrationAlgorithmType": "overcommit",
"processorUtilizationThreshold": 0.5,
"memoryUtilizationThreshold": 0.4
}
As noted in the Fields: Policies reference section documentation for AutoVMMigrationPolicy, if the state is set to ENABLED, then the migrationAlgorithmType must not be set to NONE.
Restrictions
All policies:
Auto VM Migration
Fairshare
Related Topics