Files
watcher/doc/source/strategies/host_maintenance.rst
Quang Ngo cc26b3b334 Add options to disable migration in host maintenance
This change enhances the Host Maintenance strategy by introducing
two new input parameters: `disable_live_migration` and
`disable_cold_migration`. These parameters allow cloud
administrators to control whether live or cold migration should be
considered during host maintenance operations.

If `disable_live_migration` is set, active instances will be cold
migrated if `disable_cold_migration` is not set, otherwise
active instances will be stopped. If `disable_cold_migration` is set,
inactive instances will not be cold migrated.
If both are set, only stop actions will be performed on instances.

The strategy logic and action plan generation have been updated to
reflect these behaviors. A new "stop" action is introduced and
registered, and the weight planner is updated to handle new action.

Documentation for the Host Maintenance strategy is updated to
describe the new parameters and their effects.

Test Plan:
- Unit tests for HostMaintenance strategy with new parameters
- Integration tests for action plan generation with stop action

This implements the specification:
Spec: https://review.opendev.org/c/openstack/watcher-specs/+/943873

Change-Id: I201b8e5c52e1bc1a74f3886a0e301e3c0fa5d351
Signed-off-by: Quang Ngo <quang.ngo@canonical.com>
2025-08-20 22:32:33 +10:00

4.1 KiB

Host Maintenance Strategy

Synopsis

display name: Host Maintenance Strategy

goal: cluster_maintaining

watcher.decision_engine.strategy.strategies.host_maintenance.HostMaintenance

Metrics

None

Cluster data model

Default Watcher's Compute cluster data model:

watcher.decision_engine.model.collector.nova.NovaClusterDataModelCollector

Actions

Default Watcher's actions:

action description
migration

watcher.applier.actions.migration.Migrate

change_nova_service_state

watcher.applier.actions.change_nova_service_state.ChangeNovaServiceState

Planner

Default Watcher's planner:

watcher.decision_engine.planner.weight.WeightPlanner

Configuration

Strategy parameters are:

parameter type description required

maintenance_node

String

The name of the compute node which needs maintenance.

Required

backup_node

String

The name of the compute node which will backup the maintenance node.

Optional

disable_live_migration

Boolean

False: Active instances will be live migrated. True: Active instances will be cold migrated if cold migration is not disabled. Otherwise, they will be stopped. False by default.

Optional

disable_cold_migration

Boolean

False: Inactive instances will be cold migrated. True: Inactive instances will not be cold migrated. False by default.

Optional

Efficacy Indicator

None

Algorithm

For more information on the Host Maintenance Strategy please refer to: https://specs.openstack.org/openstack/watcher-specs/specs/queens/approved/cluster-maintenance-strategy.html

How to use it ?

Run an audit using Host Maintenance strategy. Executing the actions will move the servers from compute01 host to a host determined by the Nova scheduler service.

$ openstack optimize audit create \
  -g cluster_maintaining -s host_maintenance \
  -p maintenance_node=compute01

Run an audit using Host Maintenance strategy with a backup node specified. Executing the actions will move the servers from compute01 host to compute02 host.

$ openstack optimize audit create \
  -g cluster_maintaining -s host_maintenance \
  -p maintenance_node=compute01 \
  -p backup_node=compute02

Run an audit using Host Maintenance strategy with migration disabled. This will only stop active instances on compute01, useful for maintenance scenarios where operators do not want to migrate workloads to other hosts.

$ openstack optimize audit create \
  -g cluster_maintaining -s host_maintenance \
  -p maintenance_node=compute01 \
  -p disable_live_migration=True \
  -p disable_cold_migration=True

Note that after executing this strategy, the maintenance_node will be marked as disabled, with the reason set to watcher_maintaining. To enable the node again:

$ openstack compute service set --enable compute01

None.