Using live migration

OpenStack Nova supports live migration of VM-based instances between compute hosts. This is useful during maintenance and cluster balancing operations. To use live migration, you must first add a node to your Nova cluster.

Getting ready

Let’s assume that you have more than one host running the Nova Compute services, as described in the Configuring OpenStack Compute section. If that is not the case, you will need to configure a second host before continuing. The destination host also needs to be remotely accessible and have resources available to run the instance(s) that will be migrated.

Checking network connectivity

To successfully complete live migration, both hosts must be able to communicate with each other by hostname. You can validate this by logging in to each host and pinging the other:

$ ping compute-02
PING compute-02.book (192.168.100.203) 56(84) bytes of data.
64 bytes from compute-02.book (192.168.100.203): icmp_seq=1 ttl=64 time=2.14 ms
64 bytes from compute-02.book (192.168.100.203): icmp_seq=2 ttl=64 time=0.599 ms
$ ping compute-01
PING compute-01.book (192.168.100.202) 56(84) bytes of data.
64 bytes from compute-01.book (192.168.100.202): icmp_seq=1 ttl=64 time=1.29 ms
64 bytes from compute-01.book (192.168.100.202): icmp_seq=2 ttl=64 time=0.389 ms

Ensuring resources

Live migration is also dependent on the remote host having available resources for the workload. This can be done by logging into a host with the nova command-line utilities and using the following nova commands:

$ nova host-describe compute-02
+------------+------------+-----+-----------+---------+
| HOST       | PROJECT    | cpu | memory_mb | disk_gb |
+------------+------------+-----+-----------+---------+
| compute-02 | (total)    | 2   | 3107      | 37      |
| compute-02 | (used_now) | 0   | 512       | 0       |
| compute-02 | (used_max) | 0   | 0         | 0       |
+------------+------------+-----+-----------+---------+

The first line shows the total resources available on the host. In this case, there are two vCPU, 3 GB memory, and 37 GB disk. To find out what is available on the host, subtract the values from the used_now row from the total row. In our case, the only change is that there are 512 MB of RAM in use, leaving 2.5 GB available for migrations.

How to do it...

If you are not already logged into a host with the Nova command-line utilities, you will need to be before proceeding. To migrate a VM-based instance between nodes, run the following commands:

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/

nova live-migration --block-migrate <UUID> compute-02

How it works...

Live migration is an essential feature that enables OpenStack operators and administrators to perform maintenance of the underlying cloud infrastructure without affecting the consumers of said cloud. Additionally, the OpenStack administrator can use telemetry data from Ceilometer and make live-migration decisions to balance workloads across the OpenStack cloud.

Live-migration in OpenStack is handled by the libvirt drivers. Specifically, when you issue the nova live-migration command, OpenStack compute creates a connection from libvirtd on one compute host to the same process on the remote host. Once this connection is established, depending on the parameters you specified, the memory state of the instance is synchronized and control is transferred. In our example, we specified the additional --block-migrate parameter, which handles the movement of the instance’s disk files in the absence of shared storage.

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

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