Suspending a host for maintenance

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.

Getting ready

In order to place a host into maintenance mode, you will need the following information:

  • The openstack command-line utility
  • The nova command-line utility
  • An openrc file with admin credentials
  • The name of the host

The host we will put into maintenance mode is as follows:

  • Compute host: compute-03

How to do it…

To remove a hypervisor for maintenance, carry out the following steps:

  1. First, we will list the available hosts:
    source ~/openrc
    openstack compute service list -c Binary -c Host -c Status -f table
    

    This will bring back an output like the following:

    How to do it…
  2. Next, we will disable the service called nova-compute for the compute host, so we will specify:
    openstack compute service set --disable compute-03 nova-compute
    

    Tip

    This command produces no output when successful.

  3. Verify that the host is disabled with the following command:
    openstack compute service list -c Binary -c Host -c Status -f table
    

    This produces an output like the following:

    How to do it…
  4. Once the compute host has been disabled (meaning that it will no longer accept requests to run new instances), we can then migrate the running instances off this disabled compute host, onto other running compute hosts in our environment:
    nova host-evacuate-live --block-migrate compute-03
    

    This produces an output like the following:

    How to do it…

How it works…

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.

Tip

In cases where instances are not using shared storage, the --block-migrate flag can be used to attempt to migrate the storage as well.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.93.68