Chapter 5. Sample Optimize service workflows


Important

This content in this section is available in this release as a Technology Preview, and therefore is not fully supported by Red Hat. It should only be used for testing, and should not be deployed in a production environment. For more information, see Technology Preview.

Two sample workflows ship with this release of the Optimize service (watcher) in Red Hat OpenStack Services on OpenShift (RHOSO). One workflow uses the OpenStack CLI, and the other workflow uses the OpenStack Dashboard (horizon). The two sample workflows require you to create instances. For information about creating instances, see Creating an instance in Creating and managing instances.

The topics included in this section are:

Prerequisites

  • A functional RHOSO 18.0 deployment that contains two or more Compute nodes.
  • The Compute service (nova) live migration feature is operational.
  • The Optimize service is operational.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

5.1. Consolidating node resources

Use the node resource consolidation strategy to reduce the spread of workloads, and consolidate instances onto a smaller subset of Compute nodes. The Red Hat OpenStack Services on OpenShift (RHOSO) administrator can use the Optimize service (watcher) with the node resource consolidation strategy to migrate all running instances from a source Compute node to a destination Compute node without user interruption. Unlike the VM workload consolidation strategy, the node resource consolidation strategy does not set the status of the source Compute node to disabled.

Expand
Table 5.1. Goal and strategy demonstrated
GoalStrategy

server_consolidation

node_resource_consolidation

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • Your RHOSO environment contains at least two Compute nodes that run at least one instance on each node.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Access the remote shell for the OpenStackClient pod from your workstation:

    $ oc rsh -n openstack openstackclient
    Copy to Clipboard Toggle word wrap
  2. Verify that your RHOSO environment contains at least two Compute nodes that run at least one instance on each node:

    $ openstack server list --long -c Name -c Host
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, instances test01 and test02 that are running on compute1 and compute2, respectively:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  3. Create an audit template that uses the strategy, node_resource_consolidation, and the goal, server_consolidation.

    Example

    In this example, the audit template is named NodeResourceConsolidation:

    $ openstack optimize audittemplate create -s node_resource_consolidation NodeResourceConsolidation server_consolidation
    Copy to Clipboard Toggle word wrap

    Sample output

    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | UUID        | 6e7f98fc-c311-4097-9370-fa66e5bfedcf |
    | Created At  | 2025-07-11T17:39:37.776106+00:00     |
    | Updated At  | None                                 |
    | Deleted At  | None                                 |
    | Description | None                                 |
    | Name        | NodeResourceConsolidation            |
    | Goal        | server_consolidation                 |
    | Strategy    | node_resource_consolidation          |
    | Audit Scope | []                                   |
    +-------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  4. Confirm that the audit template has been created:

    $ openstack optimize audittemplate list
    Copy to Clipboard Toggle word wrap

    Sample output

    +----------------------+-----------------------------+
    | Goal                 | Strategy                    |
    +----------------------+-----------------------------+
    | server_consolidation | node_resource_consolidation |
    +----------------------+-----------------------------+
    Copy to Clipboard Toggle word wrap
  5. Run an audit that uses an audit template based on the strategy, node_resource_consolidation, and the goal, server_consolidation.

    Example

    In this audit the NodeResourceConsolidation audit template is used, and checks the resource usage of both Compute nodes. The strategy parameter host_choice=specify is set, which means that the strategy will specify the node where the instances will be migrated:

    $ openstack optimize audit create -a NodeResourceConsolidation \
    -p host_choice=specify
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see Node resource consolidation strategy.

    Sample output

    +---------------+--------------------------------------------------------+
    | Field         | Value                                                  |
    +---------------+--------------------------------------------------------+
    | UUID          | 7984626e-cc14-4b87-ab96-f0127f2da51e                   |
    | Name          | node_resource_consolidation-2025-07-11T17:45:36.604178 |
    | Created At    | 2025-07-11T17:45:36.615613+00:00                       |
    | Updated At    | None                                                   |
    | Deleted At    | None                                                   |
    | State         | PENDING                                                |
    | Audit Type    | ONESHOT                                                |
    | Parameters    | {'host_choice': 'specify'}                             |
    | Interval      | None                                                   |
    | Goal          | server_consolidation                                   |
    | Strategy      | node_resource_consolidation                            |
    | Audit Scope   | []                                                     |
    | Auto Trigger  | False                                                  |
    | Next Run Time | None                                                   |
    | Hostname      | None                                                   |
    | Start Time    | None                                                   |
    | End Time      | None                                                   |
    | Force         | False                                                  |
    +---------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  6. Confirm that the Optimize service ran the audit:

    $ openstack optimize audit list
    Copy to Clipboard Toggle word wrap

    Sample output

    If the audit State has a value of SUCCEEDED then the audit ran and has created an action plan:

    +----------------------------+-----------+-----------------------------+
    | UUID                       | State     | Strategy                    |
    +----------------------------+-----------+-----------------------------+
    | 7984626e-cc14-4b87-ab96-   | SUCCEEDED | node_resource_consolidation |
    | f0127f2da51e               |           |                             |
    +----------------------------+-----------+-----------------------------+
    Copy to Clipboard Toggle word wrap
  7. Review the action plan.

    Example

    $ openstack optimize actionplan list \
    --audit 7984626e-cc14-4b87-ab96-f0127f2da51e
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, Global efficacy is Released_nodes_ratio: 50.00 %. This value indicates that if you execute the action plan, the Compute service will live migrate the instances so that half of the Compute nodes in the environment will be freed up, and host no running instances:

    +---------------------------+-------------+----------------------------+
    | UUID                      | State       | Global efficacy            |
    +---------------------------+-------------+----------------------------+
    | 71fc5c0c-5890-4cd8-b919-  | RECOMMENDED | Released_nodes_ratio:      |
    | f06eb94da94b              |             | 50.00 %                    |
    |                           |             |                            |
    +---------------------------+-------------+----------------------------+
    Copy to Clipboard Toggle word wrap
  8. List the actions contained in the action plan.

    Example

    $ openstack optimize action list \
    --action-plan 71fc5c0c-5890-4cd8-b919-f06eb94da94b
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan contains one action, migrate:

    +--------------------------------------+---------+---------+
    | UUID                                 | State   | Action  |
    +--------------------------------------+---------+---------+
    | bda5053b-2489-49fe-bc04-5b2ad3bc5075 | PENDING | migrate |
    +--------------------------------------+---------+---------+
    Copy to Clipboard Toggle word wrap
  9. You can view more detail about the action:

    Example

    $ openstack optimize action show bda5053b-2489-49fe-bc04-5b2ad3bc5075
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will live migrate all of the instances running on one of the Compute nodes, to free up the node:

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | bda5053b-2489-49fe-bc04-5b2ad3bc5075                   |
    | Created At  | 2025-07-11T17:45:36+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | []                                                     |
    | State       | PENDING                                                |
    | Action Plan | 71fc5c0c-5890-4cd8-b919-f06eb94da94b                   |
    | Action      | migrate                                                |
    | Parameters  | {'migration_type': 'live', 'source_node':              |
    |             | 'compute1.ctlplane.localdomain', 'resource_name':      |
    |             | 'test01', 'destination_node':                          |
    |             | 'compute2.ctlplane.localdomain', 'resource_id':        |
    |             | '331141f0-2335-4bef-8129-c27041c4d632'}                |
    | Description | Moving a VM instance from source_node to               |
    |             | destination_node                                       |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  10. Execute the action plan.

    Example

    $ openstack optimize actionplan start \
    71fc5c0c-5890-4cd8-b919-f06eb94da94b
    Copy to Clipboard Toggle word wrap

    Sample output

    +---------------------+------------------------------------------------+
    | Field               | Value                                          |
    +---------------------+------------------------------------------------+
    | UUID                | 71fc5c0c-5890-4cd8-b919-f06eb94da94b           |
    | Created At          | 2025-07-11T17:45:36+00:00                      |
    | Updated At          | 2025-07-11T18:04:55+00:00                      |
    | Deleted At          | None                                           |
    | Audit               | 7984626e-cc14-4b87-ab96-f0127f2da51e           |
    | Strategy            | node_resource_consolidation                    |
    | State               | PENDING                                        |
    | Efficacy indicators | [{'name': 'compute_nodes_count',               |
    |                     | 'description': 'The total number of enabled    |
    |                     | compute nodes.', 'unit': None, 'value': 2.0},  |
    |                     | {'name': 'released_compute_nodes_count',       |
    |                     | 'description': 'The number of compute nodes to |
    |                     | be released.', 'unit': None, 'value': 1.0},    |
    |                     | {'name': 'instance_migrations_count',          |
    |                     | 'description': 'The number of VM migrations to |
    |                     | be performed.', 'unit': None, 'value': 1.0}]   |
    | Global efficacy     | [{'name': 'released_nodes_ratio',              |
    |                     | 'description': 'Ratio of released compute      |
    |                     | nodes divided by the total number of enabled   |
    |                     | compute nodes.', 'unit': '%', 'value': 50.0}]  |
    | Hostname            | None                                           |
    +---------------------+------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  11. Confirm that the action succeeded.

    Example

    $ openstack optimize action list \
    --action-plan 71fc5c0c-5890-4cd8-b919-f06eb94da94
    Copy to Clipboard Toggle word wrap

    Sample output

    +-----------------------+-----------+------------------------+---------+
    | UUID                  | State     | Action Plan            | Action  |
    +-----------------------+-----------+------------------------+---------+
    | bda5053b-2489-49fe-   | SUCCEEDED | 71fc5c0c-5890-4cd8-    | migrate |
    | bc04-5b2ad3bc5075     |           | b919-f06eb94da94b      |         |
    +-----------------------+-----------+------------------------+---------+
    Copy to Clipboard Toggle word wrap
  12. Confirm that one of the Compute nodes no longer hosts any instances:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, both instances, test01 and test02, are now running on the same Compute node, compute2. This means that the compute1 node is freed up:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute2.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  13. Exit the openstackclient pod:

    $ exit
    Copy to Clipboard Toggle word wrap

5.2. Consolidating VM instances

Use the Optimize service (watcher) with VM workload consolidation strategy to move a VM instance workload when the physical host CPU or RAM utilization percentage exceeds the specified threshold. The instance that is migrated should cause the workload for the host to approximate the average workload of all the Compute nodes in the Red Hat OpenStack Services on OpenShift (RHOSO) cluster. Unlike the node resource consolidation strategy, the VM workload consolidation strategy sets the status of the source Compute node to disabled.

Expand
Table 5.2. Goal and strategy demonstrated
GoalStrategy

server_consolidation

vm_workload_consolidation

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • Your RHOSO environment contains at least two Compute nodes that run at least one instance on each node.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Access the remote shell for the OpenStackClient pod from your workstation:

    $ oc rsh -n openstack openstackclient
    Copy to Clipboard Toggle word wrap
  2. Verify that your RHOSO environment contains at least two Compute nodes that run at least one instance on each node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, instances test01 and test03 that are running on compute1 have a heavy RAM load. We want to use the Optimize service with the workload balance strategy to migrate at least one of these instances to a Compute node that has more capacity without user interruption:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test04 | compute2.ctlplane.localdomain |
    | test03 | compute1.ctlplane.localdomain |
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  3. Create an audit template that uses the strategy, vm_workload_consolidation, and the goal server_consolidation.

    Example

    In this example, the audit template is named WorkLoadConsolidation:

    $ openstack optimize audittemplate create -s vm_workload_consolidation \
    WorkLoadConsolidation server_consolidation
    Copy to Clipboard Toggle word wrap

    Sample output

    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | UUID        | eebd556d-b95b-4f1b-91fa-8a08a04a765b |
    | Created At  | 2025-07-11T19:18:28.283497+00:00     |
    | Updated At  | None                                 |
    | Deleted At  | None                                 |
    | Description | None                                 |
    | Name        | WorkLoadConsolidation                |
    | Goal        | server_consolidation                 |
    | Strategy    | vm_workload_consolidation            |
    | Audit Scope | []                                   |
    +-------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  4. Confirm that the audit template has been created:

    $ openstack optimize audittemplate list
    Copy to Clipboard Toggle word wrap

    Sample output

    +----------------------+-----------------------------+
    | Goal                 | Strategy                    |
    +----------------------+-----------------------------+
    | server_consolidation | vm_workload_consolidation   |
    +----------------------+-----------------------------+
    Copy to Clipboard Toggle word wrap
  5. Run an audit that uses an audit template based on the strategy, vm_workload_consolidation, and the goal server_consolidation. Update the strategy parameters with values appropriate for your environment.

    Example

    In this audit the WorkLoadConsolidation audit template is used, and checks for CPU usage using the workload_balance strategy:

    $ openstack optimize audit create -a WorkLoadConsolidation
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see VM workload consolidation strategy.

    Sample output

    +---------------+------------------------------------------------------+
    | Field         | Value                                                |
    +---------------+------------------------------------------------------+
    | UUID          | bdb0edfa-344a-4897-a7fd-3b1994d87db7                 |
    | Name          | vm_workload_consolidation-2025-07-11T19:23:52.285726 |
    | Created At    | 2025-07-11T19:23:52.296188+00:00                     |
    | Updated At    | None                                                 |
    | Deleted At    | None                                                 |
    | State         | PENDING                                              |
    | Audit Type    | ONESHOT                                              |
    | Parameters    | {'period': 3600, 'granularity': 300}                 |
    | Interval      | None                                                 |
    | Goal          | server_consolidation                                 |
    | Strategy      | vm_workload_consolidation                            |
    | Audit Scope   | []                                                   |
    | Auto Trigger  | False                                                |
    | Next Run Time | None                                                 |
    | Hostname      | None                                                 |
    | Start Time    | None                                                 |
    | End Time      | None                                                 |
    | Force         | False                                                |
    +---------------+------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  6. Confirm that the Optimize service ran the audit:

    $ openstack optimize audit list
    Copy to Clipboard Toggle word wrap

    Sample output

    If the audit State has a value of SUCCEEDED then the audit ran and has created an action plan:

    +----------------------------+-----------+-----------------------------+
    | UUID                       | State     | Strategy                    |
    +----------------------------+-----------+-----------------------------+
    | bdb0edfa-344a-4897-a7fd-   | SUCCEEDED | vm_workload_consolidation   |
    | 3b1994d87db7               |           |                             |
    +----------------------------+-----------+-----------------------------+
    Copy to Clipboard Toggle word wrap
  7. Review the action plan.

    Example

    $ openstack optimize actionplan list \
    --audit bdb0edfa-344a-4897-a7fd-3b1994d87db7
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, Global efficacy is Live_migrations_count: 50.00 %. This value indicates that if you execute the action plan, the Compute service will migrate 50 percent of the currently running instances:

    +---------------------------+-------------+----------------------------+
    | UUID                      | State       | Global efficacy            |
    +---------------------------+-------------+----------------------------+
    | 71bb6d02-50a9-4e18-b030-  | RECOMMENDED | Released_nodes_ratio:      |
    | c070d5b36cde              |             | 50.00 %                    |
    |                           |             |                            |
    +---------------------------+-------------+----------------------------+
    Copy to Clipboard Toggle word wrap
  8. List the actions contained in the action plan.

    Example

    $ openstack optimize action list \
    --action-plan 71bb6d02-50a9-4e18-b030-c070d5b36cde
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan contains one action, migrate:

    +-----------------------------+---------+---------------------------+
    | UUID                        | State   | Action                    |
    +-----------------------------+---------+---------------------------+
    | 7207af7a-569f-4d72-9a9a-    | PENDING | change_nova_service_state |
    | 0be7f9c9b175                |         |                           |
    | 29404127-f9ad-4124-b3d3-    | PENDING | migrate                   |
    | 497420f46e6b                |         |                           |
    | c6cb91d7-26e8-4864-8a5c-    | PENDING | migrate                   |
    | 5ebfe23d6c91                |         |                           |
    +-----------------------------+---------+---------------------------+
    Copy to Clipboard Toggle word wrap
  9. You can view more detail about an action:

    Example

    $ openstack optimize action show 7207af7a-569f-4d72-9a9a-0be7f9c9b175
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will live migrate one of the instances with a heavy CPU usage to a Compute node where the instance CPU usage is lower.

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | 7207af7a-569f-4d72-9a9a-0be7f9c9b175                   |
    | Created At  | 2025-07-11T19:23:52+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | []                                                     |
    | State       | PENDING                                                |
    | Action Plan | 71bb6d02-50a9-4e18-b030-c070d5b36cde                   |
    | Action      | change_nova_service_state                              |
    | Parameters  | {'state': 'disabled', 'disabled_reason':               |
    |             | 'watcher_disabled', 'resource_name':                   |
    |             | 'compute1.ctlplane.localdomain', 'resource_id':        |
    |             | '87254b5a-257b-48ea-aee0-0d4189d84fc7'}                |
    | Description | Disables or enables the nova-compute service.A         |
    |             | disabled nova-compute service can not be selected by   |
    |             | the nova for future deployment of new server.          |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  10. Execute the action plan.

    Example

    $ openstack optimize actionplan start \
    71bb6d02-50a9-4e18-b030-c070d5b36cde
    Copy to Clipboard Toggle word wrap

    Sample output

    +---------------------+------------------------------------------------+
    | Field               | Value                                          |
    +---------------------+------------------------------------------------+
    | UUID                | 71bb6d02-50a9-4e18-b030-c070d5b36cde           |
    | Created At          | 2025-07-11T19:23:52+00:00                      |
    | Updated At          | 2025-07-11T19:30:45+00:00                      |
    | Deleted At          | None                                           |
    | Audit               | bdb0edfa-344a-4897-a7fd-3b1994d87db7           |
    | Strategy            | vm_workload_consolidation                      |
    | State               | PENDING                                        |
    | Efficacy indicators | [{'name': 'compute_nodes_count',               |
    |                     | 'description': 'The total number of enabled    |
    |                     | compute nodes.', 'unit': None, 'value': 2.0},  |
    |                     | {'name': 'released_compute_nodes_count',       |
    |                     | 'description': 'The number of compute nodes to |
    |                     | be released.', 'unit': None, 'value': 1.0},    |
    |                     | {'name': 'instance_migrations_count',          |
    |                     | 'description': 'The number of VM migrations to |
    |                     | be performed.', 'unit': None, 'value': 2.0}]   |
    | Global efficacy     | [{'name': 'released_nodes_ratio',              |
    |                     | 'description': 'Ratio of released compute      |
    |                     | nodes divided by the total number of enabled   |
    |                     | compute nodes.', 'unit': '%', 'value': 50.0}]  |
    | Hostname            | None                                           |
    +---------------------+------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  11. Confirm that the action succeeded.

    Example

    $ openstack optimize action list \
    --action-plan 71bb6d02-50a9-4e18-b030-c070d5b36cde
    Copy to Clipboard Toggle word wrap

    Sample output

    +-----------+----------------------------+---------------------------+
    | State     | Action Plan                | Action                    |
    +-----------+----------------------------+---------------------------+
    | SUCCEEDED | 71bb6d02-50a9-4e18-b030-   | change_nova_service_state |
    |           | c070d5b36cde               |                           |
    | SUCCEEDED | 71bb6d02-50a9-4e18-b030-   | migrate                   |
    |           | c070d5b36cde               |                           |
    | SUCCEEDED | 71bb6d02-50a9-4e18-b030-   | migrate                   |
    |           | c070d5b36cde               |                           |
    +-----------+----------------------------+---------------------------+
    Copy to Clipboard Toggle word wrap
  12. Confirm that one of the instances with a heavy CPU usage has been migrated to a different Compute node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the instances test01 and test03 are now running on a different node, compute2:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test04 | compute2.ctlplane.localdomain |
    | test03 | compute2.ctlplane.localdomain |
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute2.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  13. Exit the openstackclient pod:

    $ exit
    Copy to Clipboard Toggle word wrap

5.3. Stabilizing multiple workloads

Use the Optimize service (watcher) with the workload stabilization strategy to move VM instance workloads when the physical host CPU or RAM utilization percentage exceeds the specified threshold. The instances that are migrated should cause the workload for the host to approximate the average workload of all the Compute nodes in the Red Hat OpenStack Services on OpenShift (RHOSO) cluster.

This topic also demonstrates how to use the OpenStack Dashboard (horizon) when stabilizing multiple workloads.

Expand
Table 5.3. Goal and strategy demonstrated
GoalStrategy

workload_balancing

workload_stabilization

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • You have created at least two instances that run on different nodes.
  • You have the Dashboard service (horizon) installed on your workstation.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Ensure that you are in the project where you have the Admin role assigned:

    Dashboard Admin menu

  2. Click the Compute menu, and choose Instances.

    Compute menu

  3. Verify that your RHOSO environment contains at least two Compute nodes that run at least one instance on each node:

    In this example, instances test01 and test03 that are running on compute1 have a heavy CPU load. Use the Optimize service with the workload stabilization strategy to live migrate at least one of these instances to a Compute node that has more capacity without user interruption:

    Instances panel

  4. Click the Admin tab:

    Admin tab

  5. Click the Optimization menu, and select Audit Templates:

    Optimization panel

  6. In the Audit Templates panel, click Create Template.

    Create Template button

    The Create Audit Template dialog box displays.

  7. Create an Audit Template named WorkLoadStabilization, select the goal Workload Balancing, and select the strategy Workload stabilization. When you are finished, click the Create Audit Template button.

    Create Audit Template dialog box

  8. Click the Audits sub tab, and then click the Create Audit button.

    Audits panel

    The Create Audit dialog box displays.

  9. Select the following values, and then click the Create Audit button:

    1. In Audit Template, choose WorkLoadStabilization.
    2. In Audit Type, choose CONTINUOUS.
    3. In Interval, enter 180.

      Create Audit Template dialog box

  10. Click the UUID for the Audit to see the action plans created for the new audit.

    Audits panel

  11. Click the UUID for the action plan to see more detail.

    Action plan

  12. Click the UUID under Related Actions.

    Action plan

    In the Actions panel, you can see more information about the recommended action.

    In this example, the test01 instance, an instance that has a heavy CPU load, will be live migrated from the compute1 node to the compute2 node.

    Actions panel

  13. When you are finished reviewing the action, click the Action plans sub menu:

    Action plan

  14. In the Action Plans panel, for the RECOMMENDED action plan, click the Start Action Plan button:

    Action plan

    The value of State changes to ONGOING.

    Monitor the Action Plans panel, until the State shows a value of SUCCEEDED.

  15. Click the Compute menu, and choose Instances.

    Compute menu

  16. Confirm that one of the instances with a heavy CPU usage has been migrated to a different Compute node.

    In this example, instance test01 now is running on a different node, compute2:

    Instances panel

  17. Click the Optimization menu, and choose Audits.

    Compute menu

  18. In the Audits panel, from the Go to Action Plan drop-down, select Cancel Audit to stop the CONTINUOUS audit.

    Audits panel

5.4. Balancing single instance workloads

Use the Optimize service (watcher) with the workload balance strategy to move a VM instance workload when the physical host CPU or RAM utilization percentage exceeds the specified threshold. The instance that is migrated should cause the workload for the host to approximate the average workload of all the Compute nodes in the Red Hat OpenStack Services on OpenShift (RHOSO) cluster.

Expand
Table 5.4. Goal and strategy demonstrated
GoalStrategy

workload_balancing

workload_balance

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • Your RHOSO environment contains at least two Compute nodes that run at least one instance on each node.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Access the remote shell for the OpenStackClient pod from your workstation:

    $ oc rsh -n openstack openstackclient
    Copy to Clipboard Toggle word wrap
  2. Verify that your RHOSO environment contains at least two Compute nodes that run at least one instance on each node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, instances test01 and test03 that are running on compute1 have a heavy CPU load. We want to use the Optimize service with the workload balance strategy to live migrate at least one of these instances to a Compute node that has more capacity without user interruption:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test04 | compute2.ctlplane.localdomain |
    | test03 | compute1.ctlplane.localdomain |
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  3. Create an audit template that uses the strategy, workload_balance, and the goal workload_balancing.

    Example

    In this example, the audit template is named WorkLoadBalance:

    $ openstack optimize audittemplate create -s workload_balance \
    WorkLoadBalance workload_balancing
    Copy to Clipboard Toggle word wrap

    Sample output

    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | UUID        | 5990155a-e3f2-46f8-a81e-c87d0b2f09a2 |
    | Created At  | 2025-07-03T14:05:23.231411+00:00     |
    | Updated At  | None                                 |
    | Deleted At  | None                                 |
    | Description | None                                 |
    | Name        | WorkLoadBalance                      |
    | Goal        | workload_balancing                   |
    | Strategy    | workload_balance                     |
    | Audit Scope | []                                   |
    +-------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  4. Confirm that the audit template has been created:

    $ openstack optimize audittemplate list
    Copy to Clipboard Toggle word wrap

    Sample output

    +----------------------+------------------+
    | Goal                 | Strategy         |
    +----------------------+------------------+
    | workload_balancing   | workload_balance |
    +----------------------+------------------+
    Copy to Clipboard Toggle word wrap
  5. Run an audit that uses an audit template based on the strategy, workload_balance, and the goal workload_balancing. Update the strategy parameters with values appropriate for your environment.

    Example

    In this audit the WorkLoadBalance audit template is used, and checks for CPU usage using workload_balance strategy parameters with various values:

    $ openstack optimize audit create -a WorkLoadBalance -p granularity=30 \
    -p threshold=20 -p period=300 -p metrics=instance_cpu_usage
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see Workload balance migration strategy.

    Sample output

    +---------------+------------------------------------------------------+
    | Field         | Value                                                |
    +---------------+------------------------------------------------------+
    | UUID          | ad815d54-5b7d-4562-aa12-17e1b64d0868                 |
    | Name          | workload_balance-2025-07-03T15:55:08.016161          |
    | Created At    | 2025-07-03T15:55:08.026706+00:00                     |
    | Updated At    | None                                                 |
    | Deleted At    | None                                                 |
    | State         | PENDING                                              |
    | Audit Type    | ONESHOT                                              |
    | Parameters    | {'granularity': 30, 'threshold': 20, 'period': 300,  |
    |               | 'metrics': 'instance_cpu_usage'}                     |
    | Interval      | None                                                 |
    | Goal          | workload_balancing                                   |
    | Strategy      | workload_balance                                     |
    | Audit Scope   | []                                                   |
    | Auto Trigger  | False                                                |
    | Next Run Time | None                                                 |
    | Hostname      | None                                                 |
    | Start Time    | None                                                 |
    | End Time      | None                                                 |
    | Force         | False                                                |
    +---------------+------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  6. Confirm that the Optimize service ran the audit:

    $ openstack optimize audit list
    Copy to Clipboard Toggle word wrap

    Sample output

    If the audit State has a value of SUCCEEDED then the audit ran and has created an action plan:

    +--------------------------------------+-----------+------------------+
    | UUID                                 | State     | Strategy         |
    +--------------------------------------+-----------+------------------+
    | ad815d54-5b7d-4562-aa12-17e1b64d0868 | SUCCEEDED | workload_balance |
    +--------------------------------------+-----------+------------------+
    Copy to Clipboard Toggle word wrap
  7. Review the action plan.

    Example

    $ openstack optimize actionplan list \
    --audit ad815d54-5b7d-4562-aa12-17e1b64d0868
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, Global efficacy is Live_migrations_count: 25.00 %. This value indicates that if you execute the action plan, the Compute service will migrate 25% of the currently running instances:

    +---------------------------+-------------+----------------------------+
    | UUID                      | State       | Global efficacy            |
    +---------------------------+-------------+----------------------------+
    | f40dfa4e-1b96-4883-b85f-  | RECOMMENDED | Live_migrations_count:     |
    | 3bfa73554359              |             | 25.00 %                    |
    |                           |             |                            |
    +---------------------------+-------------+----------------------------+
    Copy to Clipboard Toggle word wrap
  8. List the actions contained in the action plan.

    Example

    $ openstack optimize action list \
    --action-plan f40dfa4e-1b96-4883-b85f-3bfa73554359
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan contains one action, migrate:

    +--------------------------------------+---------+---------+
    | UUID                                 | State   | Action  |
    +--------------------------------------+---------+---------+
    | 9a510bf9-ebac-450d-a4ea-a10b66d6d869 | PENDING | migrate |
    +--------------------------------------+---------+---------+
    Copy to Clipboard Toggle word wrap
  9. You can view more detail about the action:

    Example

    $ openstack optimize action show 9a510bf9-ebac-450d-a4ea-a10b66d6d869
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will live migrate one of the instances with a heavy CPU usage to a Compute node where the instance CPU usage is lower.

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | 9a510bf9-ebac-450d-a4ea-a10b66d6d869                   |
    | Created At  | 2025-07-03T15:55:08+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | []                                                     |
    | State       | PENDING                                                |
    | Action Plan | f40dfa4e-1b96-4883-b85f-3bfa73554359                   |
    | Action      | migrate                                                |
    | Parameters  | {'migration_type': 'live', 'source_node':              |
    |             | 'compute1.ctlplane.localdomain', 'destination_node':   |
    |             | 'compute2.ctlplane.localdomain', 'resource_name':      |
    |             | 'test03', 'resource_id':                               |
    |             | 'd6ae1c7c-8e69-45ae-92b3-6218b8c1570b'}                |
    | Description | Moving a VM instance from source_node to               |
    |             | destination_node                                       |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  10. Execute the action plan.

    Example

    $ openstack optimize actionplan start \
    f40dfa4e-1b96-4883-b85f-3bfa73554359
    Copy to Clipboard Toggle word wrap

    Sample output

    +---------------------+------------------------------------------------+
    | Field               | Value                                          |
    +---------------------+------------------------------------------------+
    | UUID                | f40dfa4e-1b96-4883-b85f-3bfa73554359           |
    | Created At          | 2025-07-03T15:55:08+00:00                      |
    | Updated At          | 2025-07-03T16:00:23+00:00                      |
    | Deleted At          | None                                           |
    | Audit               | f878bd64-96bc-4063-97a6-dc7500edfb55           |
    | Strategy            | workload_balance                               |
    | State               | PENDING                                        |
    | Efficacy indicators | [{'name': 'instance_migrations_count',         |
    |                     | 'description': 'The number of VM migrations to |
    |                     | be performed.', 'unit': None, 'value': 1.0},   |
    |                     | {'name': 'instances_count', 'description':     |
    |                     | 'The total number of audited instances in      |
    |                     | strategy.', 'unit': None, 'value': 4.0}]       |
    | Global efficacy     | [{'name': 'live_migrations_count',             |
    |                     | 'description': 'Ratio of migrated virtual      |
    |                     | machines to audited virtual machines', 'unit': |
    |                     | '%', 'value': 25.0}]                           |
    | Hostname            | None                                           |
    +---------------------+------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  11. Confirm that the action succeeded.

    Example

    $ openstack optimize action list \
    --action-plan dfdcb491-89c5-4c07-a5ed-65d2085c488c
    Copy to Clipboard Toggle word wrap

    Sample output

    +------------------+---------+-----------+-------------------+---------+
    | UUID             | Parents | State     | Action Plan       | Action  |
    +------------------+---------+-----------+-------------------+---------+
    | 9a510bf9-ebac-   | []      | SUCCEEDED | f40dfa4e-1b96-    | migrate |
    | 450d-a4ea-       |         |           | 4883-b85f-        |         |
    | a10b66d6d869     |         |           | 3bfa73554359      |         |
    +------------------+---------+-----------+-------------------+---------+
    Copy to Clipboard Toggle word wrap
  12. Confirm that one of the instances with a heavy CPU usage has been migrated to a different Compute node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, instance test03 now is running on a different node, compute2:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test04 | compute2.ctlplane.localdomain |
    | test03 | compute2.ctlplane.localdomain |
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  13. Exit the openstackclient pod:

    $ exit
    Copy to Clipboard Toggle word wrap

5.5. Streamlining workload migrations

Use the Optimize service (watcher) with the zone migration strategy to migrate many instances efficiently without user interruption and with minimum downtime for hardware maintenance.

Note

The term zone in the zone migration strategy refers to a user-defined set of Compute nodes and storage pools. Zone does not a refer to Openstack availability zones.

Expand
Table 5.5. Goal and strategy demonstrated
GoalStrategy

zone_migration

server_consolidation

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • Your RHOSO environment contains at least two Compute nodes that run at least one instance on each node.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Access the remote shell for the OpenStackClient pod from your workstation:

    $ oc rsh -n openstack openstackclient
    Copy to Clipboard Toggle word wrap
  2. Verify that your RHOSO environment contains at least two Compute nodes that run at least one instance on each node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, two instances are running on compute1 and one instance is running on compute2. The compute1 node is scheduled for maintenance, so we want to use the Optimize service with the zone migration strategy to live migrate the instances to the other Compute node without user interruption:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test03 | compute2.ctlplane.localdomain |
    | test02 | compute1.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  3. Create an audit template that uses the strategy, zone_migration, and the goal, hardware_maintenance.

    Example

    In this example, the audit template is named ZoneMigration:

    $ openstack optimize audittemplate create -s zone_migration ZoneMigration hardware_maintenance
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see Zone migration.

    Sample output

    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | UUID        | 519d3a5e-30b2-48ae-aabf-83b246a12e13 |
    | Created At  | 2025-07-04T12:34:54.691287+00:00     |
    | Updated At  | None                                 |
    | Deleted At  | None                                 |
    | Description | None                                 |
    | Name        | ZoneMigration                        |
    | Goal        | hardware_maintenance                 |
    | Strategy    | zone_migration                       |
    | Audit Scope | []                                   |
    +-------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  4. Confirm that the audit template has been created:

    $ openstack optimize audittemplate list
    Copy to Clipboard Toggle word wrap

    Sample output

    +----------------------+------------------+
    | Goal                 | Strategy         |
    +----------------------+------------------+
    | hardware_maintenance | zone_migration   |
    +----------------------+------------------+
    Copy to Clipboard Toggle word wrap
  5. Run an audit that uses an audit template based on the strategy, zone_migration, and the goal, hardware_maintenance. Update the strategy parameters with values appropriate for your environment.

    Example

    The ZoneMigration audit template is used in this example with the following strategy parameter values:

    • src_node: contains the value, compute1, which is the node where maintenance will be performed.
    • dst_node: contains the value, compute2, which is the node where the instances running on compute1 will be migrated.

      $ openstack optimize audit create -a ZoneMigration -p compute_nodes=\
      '[{"src_node":"compute1.ctlplane.localdomain", "dst_node":"compute2.ctlplane.localdomain"}]'
      Copy to Clipboard Toggle word wrap

      Sample output

      +---------------+------------------------------------------------------+
      | Field         | Value                                                |
      +---------------+------------------------------------------------------+
      | UUID          | 9e9eeb70-63bd-427e-a5a6-a2f049f1bc73                 |
      | Name          | zone_migration-2025-07-04T12:38:25.151645            |
      | Created At    | 2025-07-04T12:38:25.163096+00:00                     |
      | Updated At    | None                                                 |
      | Deleted At    | None                                                 |
      | State         | PENDING                                              |
      | Audit Type    | ONESHOT                                              |
      | Parameters    | {'compute_nodes': [{'src_node': 'compute1.ctlplane.  |
      |               | localdomain', 'dst_node': 'compute2.ctlplane.        |
      |               | localdomain'}], 'parallel_total': 6,                 |
      |               | 'parallel_per_node':                                 |
      |               | 2, 'parallel_per_pool': 2, 'with_attached_volume':   |
      |               | False}                                               |
      | Interval      | None                                                 |
      | Goal          | hardware_maintenance                                 |
      | Strategy      | zone_migration                                       |
      | Audit Scope   | []                                                   |
      | Auto Trigger  | False                                                |
      | Next Run Time | None                                                 |
      | Hostname      | None                                                 |
      | Start Time    | None                                                 |
      | End Time      | None                                                 |
      | Force         | False                                                |
      +---------------+------------------------------------------------------+
      Copy to Clipboard Toggle word wrap
  6. Confirm that the Optimize service created the audit:

    $ openstack optimize audit list
    Copy to Clipboard Toggle word wrap

    Sample output

    If State has a value of SUCCEEDED then the audit ran and has created an action plan:

    +--------------------------------------+-----------+------------------+
    | UUID                                 | State     | Strategy         |
    +--------------------------------------+-----------+------------------+
    | 9e9eeb70-63bd-427e-a5a6-a2f049f1bc73 | SUCCEEDED | zone_migration   |
    +--------------------------------------+-----------+------------------+
    Copy to Clipboard Toggle word wrap
  7. Review the action plan.

    Example

    $ openstack optimize actionplan list \
    --audit  9e9eeb70-63bd-427e-a5a6-a2f049f1bc73 \
    -c UUID -c State -c "Global efficacy"
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the Live_instance_migrate_ratio represents the percentage of instances that are live migrated in the action plan: the number of live migrations in the action plan divided by the number of instances that could be migrated according to user input. For example, if the src_node had 4 active instances but 2 are migrated in the action plan, the ratio would be 50%

    +---------------------------+-------------+----------------------------+
    | UUID                      | State       | Global efficacy            |
    +---------------------------+-------------+----------------------------+
    | 40305df2-c240-464b-ac56-  | RECOMMENDED | Live_instance_migrate_rati |
    | 62e51bf139ef              |             | o: 100.00 %                |
    |                           |             | Cold_instance_migrate_rati |
    |                           |             | o: 0.00 %                  |
    |                           |             | Volume_migrate_ratio: 0.00 |
    |                           |             | %                          |
    |                           |             | Volume_update_ratio: 0.00  |
    |                           |             | %                          |
    |                           |             |                            |
    +---------------------------+-------------+----------------------------+
    Copy to Clipboard Toggle word wrap
  8. List the actions contained in the action plan.

    Example

    $ openstack optimize action list \
    --action-plan 40305df2-c240-464b-ac56-62e51bf139ef \
    -c 'UUID' -c 'State' -c 'Action'
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan contains two actions to migrate two instances:

    +--------------------------------------+---------+---------+
    | UUID                                 | State   | Action  |
    +--------------------------------------+---------+---------+
    | 680e6152-e163-443d-9bd4-178b73494aa4 | PENDING | migrate |
    | 51a04b16-7231-4001-b3be-d5125bcd2365 | PENDING | migrate |
    +--------------------------------------+---------+---------+
    Copy to Clipboard Toggle word wrap
  9. You can view more detail about an action:

    Example

    In this example, more detail is requested for the migrate action, 680e6152-e163-443d-9bd4-178b73494aa4:

    $ openstack optimize action show 680e6152-e163-443d-9bd4-178b73494aa4
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will migrate the test01 instance from the compute1 node to the compute2 node:

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | 680e6152-e163-443d-9bd4-178b73494aa4                   |
    | Created At  | 2025-07-04T12:38:26+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | []                                                     |
    | State       | PENDING                                                |
    | Action Plan | 40305df2-c240-464b-ac56-62e51bf139ef                   |
    | Action      | migrate                                                |
    | Parameters  | {'migration_type': 'live', 'source_node':              |
    |             | 'compute1.ctlplane.localdomain', 'resource_name':      |
    |             | 'test01', 'destination_node':                          |
    |             | 'compute2.ctlplane.localdomain', 'resource_id':        |
    |             | 'd6ae1c7c-8e69-45ae-92b3-6218b8c1570b'}                |
    | Description | Moving a VM instance from source_node to               |
    |             | destination_node                                       |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  10. Execute the action plan.

    Example

    $ openstack optimize actionplan start \
    40305df2-c240-464b-ac56-62e51bf139ef
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, both instances are being live migrated from compute1 to compute2:

    +---------------------+------------------------------------------------+
    | Field               | Value                                          |
    +---------------------+------------------------------------------------+
    | UUID                | 40305df2-c240-464b-ac56-62e51bf139ef           |
    | Created At          | 2025-07-04T12:38:26+00:00                      |
    | Updated At          | 2025-07-04T13:06:53+00:00                      |
    | Deleted At          | None                                           |
    | Audit               | 9e9eeb70-63bd-427e-a5a6-a2f049f1bc73           |
    | Strategy            | zone_migration                                 |
    | State               | PENDING                                        |
    | Efficacy indicators | [{'name': 'live_migrate_instance_count',       |
    |                     | 'description': 'The number of instances        |
    |                     | actually live migrated.', 'unit': None,        |
    |                     | 'value': 2.0}, {'name':                        |
    |                     | 'planned_live_migrate_instance_count',         |
    |                     | 'description': 'The number of instances        |
    |                     | planned to live migrate.', 'unit': None,       |
    |                     | 'value': 2.0}, {'name':                        |
    |                     | 'cold_migrate_instance_count', 'description':  |
    |                     | 'The number of instances actually cold         |
    |                     | migrated.', 'unit': None, 'value': 0.0},       |
    |                     | {'name':                                       |
    |                     | 'planned_cold_migrate_instance_count',         |
    |                     | 'description': 'The number of instances        |
    |                     | planned to cold migrate.', 'unit': None,       |
    |                     | 'value': 0.0}, {'name':                        |
    |                     | 'volume_migrate_count', 'description': 'The    |
    |                     | number of detached volumes actually            |
    |                     | migrated.', 'unit': None, 'value': 0.0},       |
    |                     | {'name': 'planned_volume_migrate_count',       |
    |                     | 'description': 'The number of detached volumes |
    |                     | planned to migrate.', 'unit': None, 'value':   |
    |                     | 0.0}, {'name': 'volume_update_count',          |
    |                     | 'description': 'The number of attached volumes |
    |                     | actually migrated.', 'unit': None, 'value':    |
    |                     | 0.0}, {'name': 'planned_volume_update_count',  |
    |                     | 'description': 'The number of attached volumes |
    |                     | planned to migrate.', 'unit': None, 'value':   |
    |                     | 0.0}]                                          |
    | Global efficacy     | [{'name': 'live_instance_migrate_ratio',       |
    |                     | 'description': 'Ratio of actual live migrated  |
    |                     | instances to planned live migrate instances.', |
    |                     | 'unit': '%', 'value': 100.0}, {'name':         |
    |                     | 'cold_instance_migrate_ratio', 'description':  |
    |                     | 'Ratio of actual cold migrated instances to    |
    |                     | planned cold migrate instances.', 'unit': '%', |
    |                     | 'value': 0}, {'name': 'volume_migrate_ratio',  |
    |                     | 'description': 'Ratio of actual detached       |
    |                     | volumes migrated to planned detached volumes   |
    |                     | migrate.', 'unit': '%', 'value': 0}, {'name':  |
    |                     | 'volume_update_ratio', 'description': 'Ratio   |
    |                     | of actual attached volumes migrated to planned |
    |                     | attached volumes migrate.', 'unit': '%',       |
    |                     | 'value': 0}]                                   |
    | Hostname            | None                                           |
    +---------------------+------------------------------------------------+
    Copy to Clipboard Toggle word wrap

    Confirm that the actions succeeded.

    Example

    $ openstack optimize action list \
    --action-plan 40305df2-c240-464b-ac56-62e51bf139ef
    Copy to Clipboard Toggle word wrap

    Sample output

    +--------------------------------------+-----------+---------+
    | UUID                                 | State     | Action  |
    +--------------------------------------+-----------+---------+
    | 680e6152-e163-443d-9bd4-178b73494aa4 | SUCCEEDED | migrate |
    | 51a04b16-7231-4001-b3be-d5125bcd2365 | SUCCEEDED | migrate |
    +--------------------------------------+-----------+---------+
    Copy to Clipboard Toggle word wrap
  11. Confirm that all of the instances have been migrated to a different Compute node:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the two instances that were running on compute1 are now running on compute2:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test03 | compute2.ctlplane.localdomain |
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute2.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  12. Exit the openstackclient pod:

    $ exit
    Copy to Clipboard Toggle word wrap

Use the Optimize service (watcher) with the host maintenance strategy to migrate all of the instances off a Compute node in your Red Hat OpenShift Container Platform (RHOCP) environment to perform host maintenance, without user interruption. If the backup node is not provided, the Optimize service migrates all instances by relying on nova-scheduler. In both use cases, the Compute maintenance node will be disabled.

Note

Use the host maintenance strategy in a planned maintenance window where the load is low to minimize impact on the workloads. When you run the audit, ensure that do not change the default audit_type value, ONESHOT.

Expand
Table 5.6. Goal and strategy demonstrated
GoalStrategy

cluster_maintaining

host_maintenance

Prerequisites

  • You have an operational RHOSO 18.0 on which the Optimize service (watcher) is running.
  • You have at least two Compute nodes:

    • One Compute node with at least one instance running.
    • A second Compute node that serves as a back-up node.
  • You have the oc command line tool installed on your workstation.
  • You are logged on to a workstation that has access to the RHOSO control plane as a user with cluster-admin privileges.

Procedure

  1. Access the remote shell for the OpenStackClient pod from your workstation:

    $ oc rsh -n openstack openstackclient
    Copy to Clipboard Toggle word wrap
  2. Verify that there are at least two compute nodes and at least one instance.

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, one instance is running on compute1 and one instance running on compute2. The compute1 node is scheduled for maintenance, so we want to use the Optimize service with the host maintenance strategy to migrate the instances from compute1 to compute2 without user interruption:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute1.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  3. Create an audit template that uses the strategy, host_maintenance, and the goal, cluster_maintaining.

    Example

    In this example, the audit template is named HostMaintenance:

    $ openstack optimize audittemplate create -s host_maintenance \
    HostMaintenance cluster_maintaining
    Copy to Clipboard Toggle word wrap

    Sample output

    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | UUID        | 96c46352-352d-43eb-97ef-4bf3235d9574 |
    | Created At  | 2025-07-04T14:52:19.919765+00:00     |
    | Updated At  | None                                 |
    | Deleted At  | None                                 |
    | Description | None                                 |
    | Name        | HostMaintenance                      |
    | Goal        | cluster_maintaining                  |
    | Strategy    | host_maintenance                     |
    | Audit Scope | []                                   |
    +-------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  4. Confirm that the audit template has been created:

    $ openstack optimize audittemplate list
    Copy to Clipboard Toggle word wrap

    Sample output

    +----------------------+------------------+
    | Goal                 | Strategy         |
    +----------------------+------------------+
    | cluster_maintaining  | host_maintenance |
    +----------------------+------------------+
    Copy to Clipboard Toggle word wrap
  5. Run an audit that uses an audit template based on the strategy, host_maintenance, and the goal, cluster_maintaining. Update the strategy parameters with values appropriate for your environment.

    Example

    The HostMaintenance audit template is used in this example, with the compute1 host scheduled for maintenance:

    $ openstack optimize audit create -a HostMaintenance \
    -p maintenance_node=compute1.ctlplane.localdomain
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see Host maintenance strategy.

    Sample output

    +---------------+-------------------------------------------------------+
    | Field         | Value                                                 |
    +---------------+-------------------------------------------------------+
    | UUID          | 8cfb4abe-3720-4af2-a8a9-fba8fff1f442                  |
    | Name          | host_maintenance-2025-07-04T14:54:58.410413           |
    | Created At    | 2025-07-04T14:54:58.419668+00:00                      |
    | Updated At    | None                                                  |
    | Deleted At    | None                                                  |
    | State         | PENDING                                               |
    | Audit Type    | ONESHOT                                               |
    | Parameters    | {'maintenance_node': 'compute1.ctlplane.localdomain'} |
    | Interval      | None                                                  |
    | Goal          | cluster_maintaining                                   |
    | Strategy      | host_maintenance                                      |
    | Audit Scope   | []                                                    |
    | Auto Trigger  | False                                                 |
    | Next Run Time | None                                                  |
    | Hostname      | None                                                  |
    | Start Time    | None                                                  |
    | End Time      | None                                                  |
    | Force         | False                                                 |
    +---------------+-------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  6. Confirm that the Optimize service created the audit:

    $ openstack optimize audit list
    Copy to Clipboard Toggle word wrap

    Sample output

    If State has a value of SUCCEEDED then the audit ran and has created an action plan:

    +--------------------------------------+-----------+------------------+
    | UUID                                 | State     | Strategy         |
    +--------------------------------------+-----------+------------------+
    | 8cfb4abe-3720-4af2-a8a9-fba8fff1f442 | SUCCEEDED | host_maintenance |
    +--------------------------------------+-----------+------------------+
    Copy to Clipboard Toggle word wrap
  7. Review the action plan.

    Example

    $ openstack optimize actionplan list \
    --audit 8cfb4abe-3720-4af2-a8a9-fba8fff1f442
    Copy to Clipboard Toggle word wrap

    Sample output

    +--------------------------------------+-------------+-----------------+
    | UUID                                 | State       | Global efficacy |
    +--------------------------------------+-------------+-----------------+
    | 40017617-7698-4ce7-b5ce-2917ec522a08 | RECOMMENDED |                 |
    +--------------------------------------+-------------+-----------------+
    Copy to Clipboard Toggle word wrap
  8. List the actions contained in the action plan.

    Example

    $ openstack optimize action list \
    --action-plan 40017617-7698-4ce7-b5ce-2917ec522a08
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan contains two actions:

    +--------------------------------------+---------+---------------------------+
    | UUID                                 | State   | Action                    |
    +--------------------------------------+---------+---------------------------+
    | 19afe53e-4cf4-4b67-b910-92bca5f40186 | PENDING | change_nova_service_state |
    | 6e3154ac-279a-4b26-b993-9a6eea70309b | PENDING | migrate                   |
    +--------------------------------------+---------+---------------------------+
    Copy to Clipboard Toggle word wrap
  9. You can view more detail about an action.

    Example

    $ openstack optimize action show \
    6e3154ac-279a-4b26-b993-9a6eea70309b
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will migrate the one instance currently running on the compute1 node to the compute2 node:

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | 6e3154ac-279a-4b26-b993-9a6eea70309b                   |
    | Created At  | 2025-07-04T14:54:58+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | ['19afe53e-4cf4-4b67-b910-92bca5f40186']               |
    | State       | PENDING                                                |
    | Action Plan | 40017617-7698-4ce7-b5ce-2917ec522a08                   |
    | Action      | migrate                                                |
    | Parameters  | {'migration_type': 'live', 'source_node':              |
    |             | '87254b5a-257b-48ea-aee0-0d4189d84fc7',                |
    |             | 'resource_name': 'test01', 'resource_id':              |
    |             | '19bb7593-1b6d-43aa-a0a1-f88921fb4b42'}                |
    | Description | Moving a VM instance from source_node to               |
    |             | destination_node                                       |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap

    Example

    $ openstack optimize action show \
    19afe53e-4cf4-4b67-b910-92bca5f40186
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the action plan will change the compute1 node state to disabled.

    +-------------+--------------------------------------------------------+
    | Field       | Value                                                  |
    +-------------+--------------------------------------------------------+
    | UUID        | 19afe53e-4cf4-4b67-b910-92bca5f40186                   |
    | Created At  | 2025-07-04T14:54:58+00:00                              |
    | Updated At  | None                                                   |
    | Deleted At  | None                                                   |
    | Parents     | []                                                     |
    | State       | PENDING                                                |
    | Action Plan | 40017617-7698-4ce7-b5ce-2917ec522a08                   |
    | Action      | change_nova_service_state                              |
    | Parameters  | {'state': 'disabled', 'disabled_reason':               |
    |             | 'watcher_maintaining', 'resource_name':                |
    |             | 'compute1.ctlplane.localdomain', 'resource_id':        |
    |             | '87254b5a-257b-48ea-aee0-0d4189d84fc7'}                |
    | Description | Disables or enables the nova-compute service.A         |
    |             | disabled nova-compute service can not be selected by   |
    |             | the nova for future deployment of new server.          |
    +-------------+--------------------------------------------------------+
    Copy to Clipboard Toggle word wrap
  10. Execute the action plan.

    Example

    $ openstack optimize actionplan start \
    40017617-7698-4ce7-b5ce-2917ec522a08
    Copy to Clipboard Toggle word wrap

    Sample output

    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | UUID                | 40017617-7698-4ce7-b5ce-2917ec522a08 |
    | Created At          | 2025-07-04T14:54:58+00:00            |
    | Updated At          | 2025-07-04T15:04:47+00:00            |
    | Deleted At          | None                                 |
    | Audit               | 8cfb4abe-3720-4af2-a8a9-fba8fff1f442 |
    | Strategy            | host_maintenance                     |
    | State               | PENDING                              |
    | Efficacy indicators | []                                   |
    | Global efficacy     | []                                   |
    | Hostname            | None                                 |
    +---------------------+--------------------------------------+
    Copy to Clipboard Toggle word wrap
  11. Confirm that the action succeeded.

    Example

    $ openstack optimize action list \
    --action-plan 40017617-7698-4ce7-b5ce-2917ec522a08
    Copy to Clipboard Toggle word wrap

    For more information about the parameters this strategy uses, see Host maintenance strategy.

    Sample output

    In this example, the instance was migrated from the compute1 node, and the state of compute1 was set to disabled:

    +--------------------------------------+-----------+---------------------------+
    | UUID                                 | State     | Action                    |
    +--------------------------------------+-----------+---------------------------+
    | 19afe53e-4cf4-4b67-b910-92bca5f40186 | SUCCEEDED | change_nova_service_state |
    | 6e3154ac-279a-4b26-b993-9a6eea70309b | SUCCEEDED | migrate                   |
    +--------------------------------------+-----------+---------------------------+
    Copy to Clipboard Toggle word wrap
  12. Confirm that all instances running on the maintenance node have been migrated:

    $ openstack server list --long
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the instance that was running on the compute1 node, test01 now is running on the compute2 node:

    +--------+-------------------------------+
    | Name   | Host                          |
    +--------+-------------------------------+
    | test02 | compute2.ctlplane.localdomain |
    | test01 | compute2.ctlplane.localdomain |
    +--------+-------------------------------+
    Copy to Clipboard Toggle word wrap
  13. Confirm that the maintenance node has been disabled.

    $ openstack compute service list
    Copy to Clipboard Toggle word wrap

    Sample output

    In this example, the compute1 node has a Status of disabled:

    +-------------------------------+----------+
    | Host                          | Status   |
    +-------------------------------+----------+
    | nova-cell0-conductor-0        | enabled  |
    | nova-scheduler-0              | enabled  |
    | nova-cell1-conductor-0        | enabled  |
    | compute2.ctlplane.localdomain | enabled  |
    | compute1.ctlplane.localdomain | disabled |
    +-------------------------------+----------+
    Copy to Clipboard Toggle word wrap
  14. Exit the openstackclient pod:

    $ exit
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat