Microsoft Hyper-V Server 2008 R2: Using Live Migration

Applies To: Microsoft Hyper-V Server 2008 R2

Microsoft® Hyper-V™ Server 2008 R2 is the next generation of Microsoft Hyper-V Server 2008. It includes support for failover clustering, including live migration, to accommodate both planned and unplanned downtime. This guide details the steps required to perform a live migration of Hyper-V™ virtual machines from one node in a failover cluster to another node.

Live migration overview

Hyper-V and failover clustering can be used together to make a virtual machine that is highly available, thereby minimizing disruptions and interruptions to clients. Live migration requires the failover clustering feature to be added and configured on the servers running Hyper-V and allows you to transparently move running virtual machines from one node of the failover cluster to another node in the same cluster without a dropped network connection or perceived downtime. To perform the steps in this guide, the nodes in the cluster can consist of a mix of servers running Microsoft Hyper-V Server 2008 R2 and servers running the Server Core installation option of Windows® Server 2008 R2. It is possible to perform a live migration of virtual machines between those nodes.

Failover clustering requires shared storage for the cluster nodes. This can include an iSCSI or Fiber-Channel Storage Area Network (SAN). All virtual machines are stored on the shared storage, and the running virtual machine state is managed by one of the nodes.

Network recommendations for using live migration

The following recommendations will help you configure your networking environment for using live migration:

  • Network adapters. For each node of the failover cluster, we recommend the following dedicated network adapters:

    • One network adapter for remote management access to the Hyper-V Server.

    • One network adapter with Gigabit speed for live migration traffic.

    • One network adapter for with Gigabit speed for storage traffic, such as access to Cluster Shared Volumes (CSV), and to monitor the heartbeat of the node.

    • One or more network adapters to provide virtual machines with network connectivity

    Note

    It is recommended that you do not use the same network adapter for virtual machine access and management. If you are limited by the number of network adapters, you should configure a virtual local area network (VLAN) to isolate traffic. VLAN recommendations include 802.1q and 802.p.

  • Hardware and system settings. It is recommended that you make the hardware and system settings of the nodes in the failover cluster as similar as possible to minimize potential problems.

  • Security policies. If possible, do not apply IPSec policies on a private network for live migration because this can significantly impact the performance of live migration.

  • IP subnet configuration. Ensure that the source and destination nodes (for the live migration) in the failover cluster are connected through the same IP subnet. This is so the virtual machine can retain the same IP address after live migration.

  • Storage recommendations. For storage network recommendations, you should review the guidelines provided by your storage vendor.

Processor compatibility

Hyper-V provides processor compatibility settings to make it easier to perform a live migration of a virtual machine to another physical computer with a different processor version. The Migrate to a physical computer with a different processor version setting in Hyper-V Manager allows you to move a running virtual machine to a physical computer with different processor features without restarting the virtual machine. If the nodes in the cluster use different versions of the same manufacturer’s processor, we recommended that you enable this setting in Hyper-V Manager on each virtual machine that you want to perform a live migration on (available under Processor Compatibility on the Processor page of the virtual machine settings). This setting ensures that the virtual machine uses only the features of the processor that are available on all versions of a virtualization-capable processor by the same processor manufacturer. It does not provide compatibility between different processor manufacturers. When this setting is not used, Hyper-V provides the virtual machine with all the features offered by the physical processor. The setting is also useful for high availability and backup and recovery scenarios because it makes it easier to move a highly available virtual machine to another node in a cluster or restore the virtual machine to different hardware.

Steps for implementing live migration

Use the following steps to implement live migration:

  • Install and configure Hyper-V Server 2008 R2 on all nodes in the failover cluster. Because Hyper-V Server 2008 R2 does not contain a graphical user interface, you must also select which remote management method you plan to use: Windows PowerShell, MMC Remote Management, Server Manager Remote Management, or Remote Server Administration Tools for Windows 7 (RSAT). These options are not exclusive, and you can enable any or all of them. For more information, see the Microsoft Hyper-V Server 2008 R2 Getting Started Guide.

    Note

    If you plan to use Windows PowerShell, the easiest way to run remote commands is to start an interactive session with a remote computer. For instructions, see about_Remote in the Windows PowerShell Technical Library. The procedures in this guide that include instructions for using Windows PowerShell assume that you have started an interactive session.

  • Install the Failover Clustering feature on all servers that you want to include in the cluster. You can use the new server configuration script tool to install the Failover Clustering. The tool starts automatically when you log on to the Hyper-V Server with an account that has administrator privileges. To start the server configuration utility, type sconfig.cmd, and then press ENTER. From the sconfig interface, type 11 to select Failover Clustering Feature. Follow the text prompts to install the Failover Clustering feature.

  • Validate the cluster configuration

  • Configure as nodes in a failover cluster. For more information, see the Failover Cluster Deployment Guide.

  • Configure Cluster Shared Volumes

  • Set up a virtual machine for live migration

  • Configure cluster networks for live migration

  • Initiate a live migration of a virtual machine

Validate the cluster configuration

Before you create a failover cluster, we strongly recommend that you run all validation tests on the cluster configuration. The cluster validation process tests the underlying hardware and software directly, and individually, to obtain an accurate assessment of how well failover clustering can be supported on a given configuration. You can use either the cluster validation wizard or Windows PowerShell. For more information on using the cluster validation wizard, see the Failover Cluster Step-by-Step Guide: Validating Hardware for a Failover Cluster. For instructions on validating the cluster configuration using Windows PowerShell, see the following procedure.

To validate the cluster configuration using Windows PowerShell

  1. Import the Failover Clustering module. Type:

    Import-Module FailoverClusters

    The Failover Clustering feature must be installed on the computer on which you are starting the Windows PowerShell session.

  2. To validate a cluster, type:

    Test-Cluster -Node server1,server2

    Where:

    <Server1> and <server2> are servers that you want to validate. If either <server1> or <server2> is already a member of a cluster, the tests will include all nodes in that cluster.

Configure Cluster Shared Volumes

Cluster Shared Volumes are volumes in a failover cluster that multiple nodes can read from and write to at the same time. The nodes coordinate the reading and writing activity so that the disk is not corrupted. In contrast, disks (LUNs) in cluster storage that are not Cluster Shared Volumes are always owned by a single node. Cluster Shared Volumes have the same requirements as non-Cluster Shared Volumes disk resources. The storage location in the Cluster Shared Volumes is under SystemDrive/ClusterStorage (for example, C:\ClusterStorage). When creating the virtual machine, we recommend that you use this storage location.

Important

For Hyper-V to function properly, the operating system (%SystemDrive%) of each server in your cluster must be set so that it boots from the same drive letter as all other servers in the cluster. In other words, if one server boots from drive letter C, all servers in the cluster should boot from drive letter C.

It is recommended that you first validate the cluster configuration before configuring Cluster Shared Volumes. For more information about how to validate a cluster configuration, see Failover Cluster Step-by-Step Guide: Validating Hardware for a Failover Cluster and The Microsoft Support Policy for Windows Server 2008 Failover Clusters.

Note

  • The network connection that is used by Cluster Shared Volumes is fault tolerant; therefore, if the network that is used by Cluster Shared Volumes experiences problems, network traffic will be moved to another network.

  • Cluster Shared Volumes can only be enabled once per cluster.

  • By enabling Cluster Shared Volumes for a failover cluster, all nodes in the cluster will be enabled to use shared volumes.

To enable Cluster Shared Volumes using Windows PowerShell

  1. If you are using the same Windows PowerShell you opened to validate the cluster, skip to step 2. If you are starting a new session, import the Failover Clustering module. Type:

    Import-Module FailoverClusters

  2. To enable Cluster Shared Volumes, type:

    Get-Cluster | %{$_.EnableSharedVolumes="Enabled"}

To enable Cluster Shared Volumes using Failover Cluster Manager

  1. In the Failover Cluster Manager snap-in, if the cluster that you want to configure is not displayed, in the console tree, right-click Failover Cluster Manager, click Manage a Cluster, and then select or specify the cluster that you want. (To open the failover cluster snap-in, click Start, click Administrative Tools, and then click Failover Cluster Management.)

  2. Right-click the failover cluster, and then click Enable Cluster Shared Volumes. Or, under Configure (center pane), click Enable Cluster Shared Volumes. The Enable Cluster Shared Volumes dialog box opens. Read and accept the terms and restrictions, and click OK.

To add a disk to the Cluster Shared Volumes

  1. In the Failover Cluster Manager snap-in, if the cluster that you want to configure is not displayed, in the console tree, right-click Failover Cluster Manager, click Manage a Cluster, and then select or specify the cluster that you want.

  2. If the console tree is collapsed, expand the tree under the cluster that you want to add a disk to the Cluster Shared Volumes.

  3. Click Cluster Shared Volumes.

  4. Under Actions (on the right), click Add storage.

  5. In Add Storage, select from the list of available disks, and click OK. The disk or disks you selected appear in the Results pane for Cluster Shared Volumes.

The storage location appears as SystemDrive\ClusterStorage (which you can rename) on all nodes of the failover cluster. Under SystemDrive\ClusterStorage, a specific folder appears for each volume on the disk (or disks) that was added to the Cluster Shared Volumes. You can view the list of volumes in Failover Cluster Manager.

Set up a virtual machine for live migration

To set up a virtual machine for live migration, you need to do the following:

  1. Create the virtual machine.

  2. Configure the virtual machine to use the shared storage provided by Cluster Shared Volumes.

    Note

    When creating the virtual machine, we recommend that you configure the storage location under SystemDrive/ClusterStorage in the Cluster Shared Volumes (for example, C:\ClusterStorage).

  3. Make the virtual machine highly available.

For information about how to perform these procedures, see Steps 6 and 7 in Hyper-V Step-by-Step Guide: Hyper-V and Failover Clustering.

Configure cluster networks for live migration

Cluster networks are automatically configured for live migration. You can use Failover Cluster Manager to perform this procedure.

To configure a cluster network for live migration

  1. In the Failover Cluster Manager snap-in, if the cluster that you want to configure is not displayed, in the console tree, right-click Failover Cluster Manager, click Manage a Cluster, and then select or specify the cluster that you want.

  2. Expand Services and applications.

  3. In the console tree (on the left), select the clustered virtual machine for which you want to configure the network for live migration.

  4. Right-click the virtual machine resource displayed in the center pane (not on the left), and then click Properties.

  5. Click the Network for live migration tab, and select one or more cluster networks to use for live migration. Use the buttons on the right to move the cluster networks up or down to ensure that a private cluster network is the most preferred. The default preference order is as follows: networks that have no default gateway should be located first; networks that are used by cluster shared volumes and cluster traffic should be located last.

    Live migration will be attempted in the order of the networks specified in the list of cluster networks. If the connection to the destination node using the first network is not successful, the next network in the list is used until the complete list is exhausted, or there is a successful connection to the destination node using one of the networks.

    Note

    • When you configure a network for live migration for a specific virtual machine, the setting is global and therefore applies to all virtual machines.

    • If you have more than one cluster network listed in Network for live migration, you should change the priority order to avoid having live migration and Cluster Shared Volumes use the same network.

Initiate a live migration of a virtual machine

You can use either Failover Cluster Manager or Windows PowerShell to initiate live migration to move a virtual machine from one node to another node in a failover cluster.

Note

  • Depending on the number of nodes in the failover cluster, you may be able to use live migration to move more than one virtual machine at a time. However, a cluster node can participate as the source or destination node in only one live migration at a time. For example, if there are 4 nodes in the failover cluster, then two live migrations can occur at the same time.

  • When you use Windows PowerShell to initiate a live migration of a virtual machine, then more than one live migration can occur at a time.

  • If live migration fails, the virtual machine continues to operate on the source node with no disruption.

The amount of time it takes to move a virtual machine using live migration is dependent on the following items:

  • The network connection speed and bandwidth that is available between the source cluster node and the destination cluster node.

  • The load on the source cluster node and the destination cluster node.

  • The amount of RAM in use by the virtual machine.

To initiate a live migration using Windows PowerShell

  1. If you are using the same Windows PowerShell session you opened to enable Cluster Shared Volumes using PowerShell, skip to step 2. If you are starting a new session, import the Failover Clustering module. Type:

    Import-Module FailoverClusters

  2. Type:

    Get-Cluster “<Cluster Name>” | Move-ClusterVirtualMachineRole -Name “<VM group name>” -Node “<Destination node name>”

    Where:

    • <Cluster Name> is the name of the cluster that the virtual machine is included in.

    • <VM group name> is the virtual machine resource group.

    • <Destination node name> is the name of the destination node to which you would like to move the virtual machine using live migration.

To initiate live migration using Failover Cluster Manager

  1. In the Failover Cluster Manager snap-in, if the cluster that you want to configure is not displayed, in the console tree, right-click Failover Cluster Manager, click Manage a Cluster, and then select or specify the cluster that you want.

  2. Expand Nodes.

  3. In the console tree (on the left), select the node under which you want to move a clustered virtual machine using live migration.

  4. Right-click the virtual machine resource displayed in the center pane (not on the left), and then click Live migrate virtual machine to another node.

  5. Select the node that you want to move the virtual machine to. When migration is complete, the virtual machine is running on the new node.

  6. To verify that the virtual machine successfully migrated, you will see the virtual machine listed under the new node (in Current Owner).