Nova placement policy

Use the compute placement policy API to modify the editable attributes of a policy.

Compute placement policy API options

Table 1. Options for compute placement policy API
Method URI Description

GET

/v2.1/{tenant_id}/ego/policy/placement

Lists all policies.

GET

/v2.1/{tenant_id}/ego/policy/placement/{policy_id}

Lists a specific policy.

PUT

/v2.1/{tenant_id}/ego/policy/placement/{policy_id}

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
Table 2. Parameters in the response for viewing all policies
Name In Type Description

name

body

string

The name of the policy.

description

body

string

A description of the policy.

goal

body

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_vms
    • running_vms: The number of instances that are running in the host.
  • Processor allocation-based load balance: (vcpuConsumed+vcpuRequest)/vc
    • vcpuConsumed: 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)/memSize
    • memConsumed: 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.

threshold

body

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_interval

body

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_parallel

body

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.

action

body

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_ongoing

body

string

List of host aggregates that are using the policy as part of ongoing optimization policy.

stabilization

body

integer

The consecutive number of times a policy engine action is triggered. The value of stabilization is increased by 1 based on the value that is set for goal parameter. For example, when you are migrating a virtual machine if value for stabilization is configured as 3, then after the processor allocation exceeds the configured threshold for 3 run_interval consecutive cycles the virtual machine is considered for migration.

id

body

string

The unique identifier of the placement policy.

host_aggregate_based_initial

body

string

List of host aggregates that are using the current policy as initial placement policy.

Example:
{
 "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
Table 3. Parameters in the response for viewing a policy
Name In Type Description

name

body

string

The name of the policy.

description

body

string

A description of the policy.

goal

body

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_vms
    • running_vms: The number of instances that are running in the host.
  • Processor allocation-based load balance: (vcpuConsumed+vcpuRequest)/vc
    • vcpuConsumed: 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)/memSize
    • memConsumed: 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.

threshold

body

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_interval

body

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_parallel

body

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.

action

body

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_ongoing

body

string

List of host aggregates that are using the policy as part of ongoing optimization policy.

stabilization

body

integer

The consecutive number of times a policy engine action is triggered. The value of stabilization is increased by 1 based on the value that is set for goal parameter. For example, when you are migrating a virtual machine if value for stabilization is configured as 3, then after the processor allocation exceeds the configured threshold for 3 run_interval consecutive cycles the virtual machine is considered for migration.

id

body

string

The unique identifier of the placement policy.

host_aggregate_based_initial

body

string

List of host aggregates that are using the current policy as initial placement policy.

Example:
{
"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

This operation modifies the editable properties of a policy. This operation modifies the editable properties of a policy. This API takes the policy ID in the URI and the attributes that you want to change in the body as input. The response body contains the attributes that are updated by the request. For details, see these sections:
Response codes
  • Normal response code: OK (200)
  • Error response code: Bad Request (400), Policy Not Found (404), Server Error (500)
Request parameters
Table 4. Parameters in the request for modifying a policy
Name In Type Description

name

body

string

The name of the policy.

description

body

string

A description of the policy.

goal

body

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_vms
    • running_vms: The number of instances that are running in the host.
  • Processor allocation-based load balance: (vcpuConsumed+vcpuRequest)/vc
    • vcpuConsumed: 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)/memSize
    • memConsumed: 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.

threshold

body

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_interval

body

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_parallel

body

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.

action

body

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_ongoing

body

string

List of host aggregates that are using the policy as part of ongoing optimization policy.

stabilization

body

integer

The consecutive number of times a policy engine action is triggered. The value of stabilization is increased by 1 based on the value that is set for goal parameter. For example, when you are migrating a virtual machine if value for stabilization is configured as 3, then after the processor allocation exceeds the configured threshold for 3 run_interval consecutive cycles the virtual machine is considered for migration.

host_aggregate_based_initial

body

string

List of host aggregates that are using the current policy as initial placement policy.

Example:
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"
   },
  ]
}
Table 5. Parameters in the response for modifying a policy
Name In Type Description

name

body

string

The name of the policy.

description

body

string

A description of the policy.

goal

body

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_vms
    • running_vms: The number of instances that are running in the host.
  • Processor allocation-based load balance: (vcpuConsumed+vcpuRequest)/vc
    • vcpuConsumed: 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)/memSize
    • memConsumed: 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.

threshold

body

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_interval

body

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_parallel

body

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.

action

body

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_ongoing

body

string

List of host aggregates that are using the policy as part of ongoing optimization policy.

stabilization

body

integer

The consecutive number of times a policy engine action is triggered. The value of stabilization is increased by 1 based on the value that is set for goal parameter. For example, when you are migrating a virtual machine if value for stabilization is configured as 3, then after the processor allocation exceeds the configured threshold for 3 run_interval consecutive cycles the virtual machine is considered for migration.

host_aggregate_based_initial

body

string

List of host aggregates that are using the current policy as initial placement policy.

Example:
{
  "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"
   },
  ]
}