How to Migrate virtual machines from one host to another in the Red Hat Virtualization environment
Virtual machine migration
Live migration refers to the process of moving a virtual machine from one physical host to another while it is running. RHVM moves memory, storage, and network connectivity of the virtual machine from the original host machine to the destination. Live migration is useful to support maintenance tasks on hosts without disrupting your running virtual machines.
Live migration is transparent to the end-user. The virtual machine remains powered on, and user applications continue to run while the virtual machine is migrated to a new physical host runs. Clients communicating with the virtual machine should notice no more than a network pause of a few milliseconds as the transfer completes.
For live migration to work properly, the new host must have a CPU with the same architecture and features as the original host. Red Hat Virtualization helps you manage this by organizing hosts into clusters. A virtual machine may only migrate to hypervisor hosts that are members of its cluster. This helps you ensure that virtual machines do not migrate between machines that support a different set of processor features.
Administrators must ensure that their Red Hat Virtualization environment is correctly configured to support live migration in advance of using it. Live migration of virtual machines requires the following configuration prerequisites:
- The virtual machine must be migrated to a host in the same cluster as the host where the virtual machine is running. The status of both hosts must be Up.
- Both hosts must have access to the same virtual networks, VLANs, and data storage domains.
- The destination host must have enough CPU capacity and RAM to support the virtual machine’s requirements.
- The virtual machine must not have the cache!=none custom property set. The cache parameter configures the different cache modes for a virtual machine. Live migration requires a disabled virtual machine cache to ensure a coherent virtual machine migration.
Live migration is performed using the migration network. The default configuration uses the ovirtmgmt network as both the management network and the migration network. Although each live migration is limited to a maximum transfer speed, and there are a maximum number of migrations that may run concurrently, concurrent live migrations can saturate a network shared by management and migration traffic. For best performance, the storage, migration, and management networks should be split to avoid network saturation.
Manually migrating virtual machines
Red Hat Virtualization supports manual migration of a virtual machine between hosts associated with the same cluster. Migration can be triggered using the RHVM Administration Portal. A virtual machine can be migrated to a specific host, or to a host automatically selected by RHV.
To manually migrate a virtual machine using the Administration Portal, as the admin superuser:
1. In the System section, go to the Virtual Machines tab. Select the virtual machine to be migrated. In the Host field for the virtual machine, determine which host is running the virtual machine.
2. With the virtual machine to be migrated selected, click Migrate in the top bar. A window titled Migrate Virtual Machine(s) appears.
3. To control which host the virtual machine migrates to, check the Select Destination Host checkbox. In the menu, select the destination host. Click OK to migrate the virtual machine.
4. In the Virtual Machines tab, check the Status field for the virtual machine. When the migration finishes, this status transitions from Migrating From to Up.
5. Verify that the Host field for the virtual machine contains the expected destination host.
Automatic Migration and Migration Policies
Routine operation of a Red Hat Virtualization environment may require moving hosts offline for upgrades and maintenance, or the load on hosts to be more evenly distributed around a cluster. A migration policy for a cluster can automatically migrate the virtual machines running on a host to other hosts under certain circumstances.
For example, a migration policy might specify that virtual machines running on a host should automatically migrate to other hosts in the cluster if the original host moves into maintenance mode. Migration policies might also be used to configure scheduling policies to support the automatic migration of virtual machines when a certain threshold of resource use is reached on a host.
Configuring a Migration Policy
Virtual machine migration is a network-intensive operation. RHVM copies the memory state of the virtual machine over the network to the new host. In a situation where a host is running ten or more virtual machines, migrating all of them can be a long and resource-consuming process. Therefore, administrators must be sure to select the policy action that best suits their setup.
In some cases, a system that is very busy may take a long time to converge.Migration policies also determine how Red Hat Virtualization handles this situation.
Red Hat Virtualization Manager automatically initiates live migration of all virtual machines running on a host when the host moves into maintenance mode. The destination host for each virtual machine is determined as the virtual machine is migrated, to spread the load across the cluster.
RHVM also automatically initiates live migration of virtual machines to maintain load balancing or power-saving levels according to the current policy. RHVM allows administrators to disable automatic migration of virtual machines. It is possible to disable manual migration of virtual machines by setting the virtual machine to run only on a specific host. The configuration of a migration policy includes the configuration of a resilience policy, which determines the virtual machine migration policy when a host fails.
To configure the migration policy for a cluster using the Administration Portal:
1. In the System section, go to the Clusters tab. Select the cluster, and click Edit. A window titled Edit Cluster is displayed. Go to the Migration Policy section to determine the current migration configuration for the cluster.
2. In the Migration Policy section, select the migration policy to apply in the Migration Policy menu.
The default migration policy is the Minimal downtime policy. The Minimal downtime migration policy optimizes for the shortest pause of the virtual machine during migration, but may abort the migration if it is taking an excessive time to converge. Other available policies are Postcopy migration, Suspend workload if needed, and Legacy:
– The Post-copy migration policy also optimizes for the shortest pause if possible. In this policy, if the migration is not converging for a long time, it is switched to post-copy. Postcopy starts the virtual machine in the destination host as soon as possible. To achieve this, just a subset of the virtual machine memory moves to the destination hosts. If the virtual machine tries to access a memory page that is not in the destination host, it issues a page fault, and the source host transfers that page.
– The Suspend workload if needed migration policy supports migration under most load conditions, but a longer pause of the virtual machine may occur if it has a heavy load.
– Finally, the Legacy migration policy supports the migration policy used in Red Hat Enterprise Virtualization 3.6.
3. The bandwidth included in the Bandwidth section limits maximum bandwidth in Mbps per host for migrations, both outgoing and incoming. There are three options available: Auto, Hypervisor default, and Custom.
– The Auto mode uses the rate limit setting in the data center host network QoS. If there is no rate limit setting defined, it gets the minimum speed for the NICs of the source and destination hosts.
– The Hypervisor default mode uses the VDSM setting on the source host.
– The Custom mode uses the bandwidth defined by the user in Mbps.
4. The resilience policy sets the virtual machine migration policy in the event of host failure. RHVM migrates virtual machines running on a host that unexpectedly shuts down or moves into maintenance mode to other hosts in the cluster.
RHV supports the migration of all virtual machines using the Migrate Virtual Machines policy,only the highly available virtual machines using the Migrate only Highly Available Virtual Machines policy, or disabling the virtual machine migration using the Do Not Migrate Virtual Machines option.
NOTE: There are some additional settings available in the Additional Properties section. Those settings only can be configured when the Legacy migration policy is selected
Configuring a Scheduling Policy
RHV supports the configuration of scheduling policies to distribute virtual machines among hosts.Those policies use a mix of filters and weights to determine the host on which RHVM places a virtual machine.
RHV supports five scheduling policies by default: Evenly_Distributed, InClusterUpgrade, None, Power_Saving, and VM_Evenly_Distributed. Each policy has associated a set of properties to customize its behavior.
To configure a scheduling policy for a cluster:
1. In the System section, go to the Clusters tab. Select the cluster, and click Edit.
2. A window titled Edit Cluster is displayed. The Scheduling Policy section contains the current scheduling policy. RHVM configures the None scheduling policy by default. The default configuration does not allow deployment of a virtual machine on an overloaded host. A host is overloaded when its CPU load is higher than 80% for more than 2 minutes.
3. In the Select Policy section, select the policy for the cluster.
4. Each scheduling policy has a different set of configurable properties. For example, the vm_evenly_distributed policy has associated properties like:
- The HighVmCount property configures the maximum number of virtual machines per host. An overloaded host runs more than this maximum number. The default value is 10.
- The MigrationThreshold property configures a buffer before virtual machines migrate from the host. The default value is 5.
- The SpmVmGrace property defines how many virtual machines less run on the SPM host. The default value is 5.
When done, click OK to apply the policy.