One of the key tenets of cloud is being abstracted away from hardware. However, hardware does require maintenance from time to time, or a host will need a software upgrade. Whatever the reason, a host may need to be taken offline for maintenance, ideally with little to no downtime for the instances running on the host. To accommodate this, Nova provides two methods for live migrating instances: block migration, when shared storage is not available in the environment, and the live migration flag, when instances are booted from the shared storage (where every compute host can see the same storage used by each instance for its boot volume).
To live migrate an instance, you will need the following information:
openstack
command-line clientopenrc
file containing appropriate administrator credentialsIf your environment is configured so that instances boot from the shared storage, such as RBD provided by Ceph, then live migrations are almost instantaneous (depending on how busy the instance is). A feature called block migration is much slower. Block migration is used in environments where shared storage is not used for instances.
Migrations can only be performed by a user with admin role privileges.
openstack hypervisor list
This will bring back an output like the following:
openstack server show cookbook.test -c name -c OS-EXT-SRV-ATTR:hypervisor_hostname
This will bring back the fields (also known as column names, as denoted by the -c
flag) that we are interested in. Note, in this example, the instance called cookbook.test
is running from the hypervisor called compute-01.cook.book
:
openstack server migrate --block-migration cookbook.test
To live migrate the instance, with shared storage such as Ceph, issue the following:
openstack server migrate cookbook.test --live compute-02.cook.book
openstack server show -c name -c OS-EXT-STS:task_state cookbook.test
As block migrations generally take longer, you may see the state as resize_migrating
, indicating that the task of migrating is still in process:
openstack server show cookbook.test -c name -c OS-EXT-SRV-ATTR:hypervisor_hostname
This will bring back an output like the following:
Live migrations are 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 resource monitoring services (such as 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 openstack server migrate
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 the control is transferred. In the preceding example, we first specified the additional --block-migrate
parameter, which handles the movement of the instance's disk files in the absence of shared storage, and then we showed how the --live
flag can be used when instances are booted from shared storage.
18.191.176.0