Scale back the nova-compute application

Important

This page has been identified as being affected by the breaking changes introduced between versions 2.9.x and 3.x of the Juju client. Read support note Breaking changes between Juju 2.9.x and 3.x before continuing.

Preamble

Scaling in the nova-compute application implies the removal of one or more nova-compute units (i.e. compute nodes). This is easily done with generic Juju commands and actions available to the nova-compute charm.

Procedure

List the nova-compute units

Display the nova-compute units:

juju status nova-compute

This article will be based on the following output:

Unit              Workload  Agent  Machine  Public address  Ports    Message
nova-compute/0*   active    idle   15       10.5.0.5                 Unit is ready
  ntp/0*          active    idle            10.5.0.5        123/udp  chrony: Ready
  ovn-chassis/0*  active    idle            10.5.0.5                 Unit is ready
nova-compute/1    active    idle   16       10.5.0.24                Unit is ready
  ntp/2           active    idle            10.5.0.24       123/udp  chrony: Ready
  ovn-chassis/2   active    idle            10.5.0.24                Unit is ready
nova-compute/2    active    idle   17       10.5.0.10                Unit is ready
  ntp/1           active    idle            10.5.0.10       123/udp  chrony: Ready
  ovn-chassis/1   active    idle            10.5.0.10                Unit is ready

Tip

You can use the openstack client to map compute nodes to nova-compute units by IP address: openstack hypervisor list.

Disable the node

Disable the compute node by referring to its corresponding unit, here nova-compute/0:

juju run nova-compute/0 disable

This will stop nova-compute services and inform nova-scheduler to no longer assign new VMs to the unit.

Warning

Before continuing, make sure that all VMs hosted on the target compute node have been either deleted or migrated to another node.

Unregister the node

Now unregister the compute node from the cloud:

juju run nova-compute/0 remove-from-cloud

The workload status of the unit can be checked with:

juju status nova-compute/0

Sample output:

Unit              Workload  Agent  Machine  Public address  Ports    Message
nova-compute/0*   blocked   idle   15       10.5.0.5                 Unit was removed from the cloud
  ntp/0*          active    idle            10.5.0.5        123/udp  chrony: Ready
  ovn-chassis/0*  active    idle            10.5.0.5                 Unit is ready

At this point (before the unit is actually removed from the model with the remove-unit command) the process can be reverted with the register-to-cloud action, followed by the enable action. This combination will restart nova-compute services and enable nova-scheduler to run new VMs on the unit.

Remove the unit

Now that the compute node has been logically removed at the OpenStack level, remove its unit from the model:

juju remove-unit nova-compute/0

Request the status of the application once more:

juju status nova-compute

The unit’s removal should be confirmed by its absence in the output:

Unit              Workload  Agent  Machine  Public address  Ports    Message
nova-compute/1*   active    idle   16       10.5.0.24                Unit is ready
  ntp/2*          active    idle            10.5.0.24       123/udp  chrony: Ready
  ovn-chassis/2   active    idle            10.5.0.24                Unit is ready
nova-compute/2    active    idle   17       10.5.0.10                Unit is ready
  ntp/1           active    idle            10.5.0.10       123/udp  chrony: Ready
  ovn-chassis/1*  active    idle            10.5.0.10                Unit is ready