Nova placement policy
Use the compute placement policy API to modify the editable attributes of a policy.
Compute placement policy API options
| Method | URI | Description |
|---|---|---|
|
GET |
|
Lists all policies. |
|
GET |
|
Lists a specific policy. |
|
PUT |
|
Modifies the editable attributes of a policy. |
View all policies
This operation lists all the policies that are managed by PowerVC. This does not take a request body.
- Response codes
-
- Normal response code: OK (200)
- Error response code: Bad Request (400), Server Error (500)
- Request
-
GET /v2.1/{tenant_id}/ego/policy/placement - Response body
-
Example:
Table 2. Parameters in the response for viewing all policies Name In Type Description namebody
string
The name of the policy.
descriptionbody
string
A description of the policy.
goalbody
string
The resource requirement string, which is used:- To sort candidates from small to large when the scheduler picks up the host as the response to the instance placement request or the replacement request.
- By the runtime policy engine to evaluate and check against the threshold.
The resource requirement string can be one of the three kinds:- Packing:
0-running_vmsrunning_vms:The number of instances that are running in the host.
- Processor allocation-based load balance:
(vcpuConsumed+vcpuRequest)/vcvcpuConsumed:The host Virtual Central Processing Unit (vCPU) that was used by the instance.vcpuRequested:The vCPU that is requested by instance.vcpu:The total vCPU for the host.
- Memory allocation-based load balance:
(memConsumed+memRequest)/memSizememConsumed: The host memory that was used by the instance.memRequested:The memory that is requested by instance.memSize: The total memory size for the host.
thresholdbody
integer
The starting point for live migration. The value of either the number of running instances, processor usage, or memory usage. The value is based on the configuration of the
<goal>attribute.run_intervalbody
integer
A runtime interval, in minutes, when the policy runs. For example, a value of 1 indicates that the policy runs every 1 minute.
max_parallelbody
integer
The maximum number of live migration operations in the cluster. This attribute is used to control the number of migration operations in the whole system. If the number of operations (that are triggered by policy) meets the <max_parallel> value, the policy does not trigger more migration operations.
actionbody
string
Indicates when the policy meets all conditions. The runtime policy engine runs this action to meet the goal, for example balance the load among the whole system. Currently, only the live migration action is supported.
host_aggregate_based_ongoingbody
string
List of host aggregates that are using the policy as part of ongoing optimization policy.
stabilizationbody
integer
The consecutive number of times a policy engine action is triggered. The value of
stabilizationis increased by 1 based on the value that is set forgoalparameter. For example, when you are migrating a virtual machine if value forstabilizationis configured as 3, then after the processor allocation exceeds the configuredthresholdfor 3 run_interval consecutive cycles the virtual machine is considered for migration.idbody
string
The unique identifier of the placement policy.
host_aggregate_based_initialbody
string
List of host aggregates that are using the current policy as initial placement policy.
{ "placement_policies": [2]-0:{ "host_aggregate_based_ongoing": null, "stabilization": "3", "goal": "running_vms+1", "id": 1, "description": "This policy's goal is to place instances on the host having the fewest number of instances.", "host_aggregate_based_initial": null, "threshold": "10", "run_interval": "52560000", "max_parallel": "25", "action": "migrate_vm", "name": "Striping" }, -1: { "host_aggregate_based_ongoing": null, "stabilization": "3", "goal": "0-running_vms", "id": 2, "description": "This policy's goal is to place instances on the host having the highest number of instances such that the instance fits on the host. "host_aggregate_based_initial": null, "threshold": "10", "run_interval": "52560000", "max_parallel": "25", "action": "migrate_vm", "name": "Packing" } }
View a specific policy
This operation lists the details of a specific policy that is managed by PowerVC based on the policy ID. This does not take a request body.
- Response codes
-
- Normal response code: OK (200)
- Error response code: Bad Request (400), Policy Not Found (404), Server Error (500)
- Request
-
GET /v2.1/{tenant_id}/ego/policy/placement/{policy_id} - Response body
-
Example:
Table 3. Parameters in the response for viewing a policy Name In Type Description namebody
string
The name of the policy.
descriptionbody
string
A description of the policy.
goalbody
string
The resource requirement string, which is used:- To sort candidates from small to large when the scheduler picks up the host as the response to the instance placement request or the replacement request.
- By the runtime policy engine to evaluate and check against the threshold.
The resource requirement string can be one of the three kinds:- Packing:
0-running_vmsrunning_vms:The number of instances that are running in the host.
- Processor allocation-based load balance:
(vcpuConsumed+vcpuRequest)/vcvcpuConsumed:The host Virtual Central Processing Unit (vCPU) that was used by the instance.vcpuRequested:The vCPU that is requested by instance.vcpu:The total vCPU for the host.
- Memory allocation-based load balance:
(memConsumed+memRequest)/memSizememConsumed: The host memory that was used by the instance.memRequested:The memory that is requested by instance.memSize: The total memory size for the host.
thresholdbody
integer
The starting point for live migration. The value of either the number of running instances, processor usage, or memory usage. The value is based on the configuration of the
<goal>attribute.run_intervalbody
integer
A runtime interval, in minutes, when the policy runs. For example, a value of 1 indicates that the policy runs every 1 minute.
max_parallelbody
integer
The maximum number of live migration operations in the cluster. This attribute is used to control the number of migration operations in the whole system. If the number of operations (that are triggered by policy) meets the <max_parallel> value, the policy does not trigger more migration operations.
actionbody
string
Indicates when the policy meets all conditions. The runtime policy engine runs this action to meet the goal, for example balance the load among the whole system. Currently, only the live migration action is supported.
host_aggregate_based_ongoingbody
string
List of host aggregates that are using the policy as part of ongoing optimization policy.
stabilizationbody
integer
The consecutive number of times a policy engine action is triggered. The value of
stabilizationis increased by 1 based on the value that is set forgoalparameter. For example, when you are migrating a virtual machine if value forstabilizationis configured as 3, then after the processor allocation exceeds the configuredthresholdfor 3 run_interval consecutive cycles the virtual machine is considered for migration.idbody
string
The unique identifier of the placement policy.
host_aggregate_based_initialbody
string
List of host aggregates that are using the current policy as initial placement policy.
{ "placement_policy": { "action": "migrate_vm", "description": "This policy's goal is to place instances on the host having the fewest number of instances.", "goal": "running_vms+1", "host_aggregate_based_initial": null, "host_aggregate_based_ongoing": null, "id": 1, "max_parallel": "25", "name": "Striping", "run_interval": "52560000", "stabilization": "3", "threshold": "10" } }
Modify a policy
- Response codes
-
- Normal response code: OK (200)
- Error response code: Bad Request (400), Policy Not Found (404), Server Error (500)
- Request parameters
-
Example:
Table 4. Parameters in the request for modifying a policy Name In Type Description namebody
string
The name of the policy.
descriptionbody
string
A description of the policy.
goalbody
string
The resource requirement string, which is used:- To sort candidates from small to large when the scheduler picks up the host as the response to the instance placement request or the replacement request.
- By the runtime policy engine to evaluate and check against the threshold.
The resource requirement string can be one of the three kinds:- Packing:
0-running_vmsrunning_vms:The number of instances that are running in the host.
- Processor allocation-based load balance:
(vcpuConsumed+vcpuRequest)/vcvcpuConsumed:The host Virtual Central Processing Unit (vCPU) that was used by the instance.vcpuRequested:The vCPU that is requested by instance.vcpu:The total vCPU for the host.
- Memory allocation-based load balance:
(memConsumed+memRequest)/memSizememConsumed: The host memory that was used by the instance.memRequested:The memory that is requested by instance.memSize: The total memory size for the host.
thresholdbody
integer
The starting point for live migration. The value of either the number of running instances, processor usage, or memory usage. The value is based on the configuration of the
<goal>attribute.run_intervalbody
integer
A runtime interval, in minutes, when the policy runs. For example, a value of 1 indicates that the policy runs every 1 minute.
max_parallelbody
integer
The maximum number of live migration operations in the cluster. This attribute is used to control the number of migration operations in the whole system. If the number of operations (that are triggered by policy) meets the <max_parallel> value, the policy does not trigger more migration operations.
actionbody
string
Indicates when the policy meets all conditions. The runtime policy engine runs this action to meet the goal, for example balance the load among the whole system. Currently, only the live migration action is supported.
host_aggregate_based_ongoingbody
string
List of host aggregates that are using the policy as part of ongoing optimization policy.
stabilizationbody
integer
The consecutive number of times a policy engine action is triggered. The value of
stabilizationis increased by 1 based on the value that is set forgoalparameter. For example, when you are migrating a virtual machine if value forstabilizationis configured as 3, then after the processor allocation exceeds the configuredthresholdfor 3 run_interval consecutive cycles the virtual machine is considered for migration.host_aggregate_based_initialbody
string
List of host aggregates that are using the current policy as initial placement policy.
PUT /v2.1/{tenant_id}/ego/policy/placement/{policy_id} X-Auth-Project-Id: ibm-default User-Agent: python-novaclient Content-Type: application/json Accept: application/json X-Auth-Token: fc9b667bf72f4e838408af9056f3e76f { "placement_policies": [ { "action": "migrate_vm", "description": "This policy's goal is to place instances on the host having the fewest number of instances.", "goal": "running_vms+1", "host_aggregate_based_initial": null, "host_aggregate_based_ongoing": null, "max_parallel": "25", "name": "Striping", "run_interval": "52560000", "stabilization": "3", "threshold": "10" }, ] } -
Example:
Table 5. Parameters in the response for modifying a policy Name In Type Description namebody
string
The name of the policy.
descriptionbody
string
A description of the policy.
goalbody
string
The resource requirement string, which is used:- To sort candidates from small to large when the scheduler picks up the host as the response to the instance placement request or the replacement request.
- By the runtime policy engine to evaluate and check against the threshold.
The resource requirement string can be one of the three kinds:- Packing:
0-running_vmsrunning_vms:The number of instances that are running in the host.
- Processor allocation-based load balance:
(vcpuConsumed+vcpuRequest)/vcvcpuConsumed:The host Virtual Central Processing Unit (vCPU) that was used by the instance.vcpuRequested:The vCPU that is requested by instance.vcpu:The total vCPU for the host.
- Memory allocation-based load balance:
(memConsumed+memRequest)/memSizememConsumed: The host memory that was used by the instance.memRequested:The memory that is requested by instance.memSize: The total memory size for the host.
thresholdbody
integer
The starting point for live migration. The value of either the number of running instances, processor usage, or memory usage. The value is based on the configuration of the
<goal>attribute.run_intervalbody
integer
A runtime interval, in minutes, when the policy runs. For example, a value of 1 indicates that the policy runs every 1 minute.
max_parallelbody
integer
The maximum number of live migration operations in the cluster. This attribute is used to control the number of migration operations in the whole system. If the number of operations (that are triggered by policy) meets the <max_parallel> value, the policy does not trigger more migration operations.
actionbody
string
Indicates when the policy meets all conditions. The runtime policy engine runs this action to meet the goal, for example balance the load among the whole system. Currently, only the live migration action is supported.
host_aggregate_based_ongoingbody
string
List of host aggregates that are using the policy as part of ongoing optimization policy.
stabilizationbody
integer
The consecutive number of times a policy engine action is triggered. The value of
stabilizationis increased by 1 based on the value that is set forgoalparameter. For example, when you are migrating a virtual machine if value forstabilizationis configured as 3, then after the processor allocation exceeds the configuredthresholdfor 3 run_interval consecutive cycles the virtual machine is considered for migration.host_aggregate_based_initialbody
string
List of host aggregates that are using the current policy as initial placement policy.
{ "placement_policies": [ { "action": "migrate_vm", "description": "This policy's goal is to place instances on the host having the fewest number of instances.", "goal": "running_vms+1", "host_aggregate_based_initial": null, "host_aggregate_based_ongoing": null, "max_parallel": "25", "name": "Striping", "run_interval": "52560000", "stabilization": "3", "threshold": "10" }, ] }