Often times a host needs to be taken offline to have memory replaced, an operating system upgraded, or other routine maintenance done. In order to ensure that running instances are not adversely affected, we use the openstack compute service set
command.
In order to place a host into maintenance mode, you will need the following information:
openstack
command-line utilitynova
command-line utilityopenrc
file with admin credentialsThe host we will put into maintenance mode is as follows:
compute-03
To remove a hypervisor for maintenance, carry out the following steps:
source ~/openrc openstack compute service list -c Binary -c Host -c Status -f table
This will bring back an output like the following:
nova-compute
for the compute host, so we will specify:openstack compute service set --disable compute-03 nova-compute
openstack compute service list -c Binary -c Host -c Status -f table
This produces an output like the following:
nova host-evacuate-live --block-migrate compute-03
This produces an output like the following:
In order to take a host offline for maintenance, Nova must first be told to no longer place new instances onto the host. This is done by disabling the nova-compute
service on the compute host with the openstack service set --disable [host] [service]
command. Once the host is marked disabled, and before powering it down for maintenance, the running instances need to be migrated off the host. The nova host-evacuate-live [host]
command attempts to live-migrate all running instances on the specified host. It does this by asking Nova to reschedule the instances onto hosts with availability.
3.145.93.68