Thursday, July 1, 2010

Hyper-V Live Migration: A Step-by-Step Guide

Hyper-V Live Migration: A Step-by-Step Guide
The Create Cluster wizard automatically selects the storage for your quorum, but it doesn’t always choose the quorum drive that you want. You can check and change the quorum configuration by right-clicking the name of the cluster in the Failover Cluster Management console, then selecting More Actions, Configure Cluster Quorum Settings from the context menu. This displays the Select Quorum Configuration dialog box. A wizard automatically chooses the best quorum type, depending mainly on the number of nodes in the cluster. In my two-node cluster, it selected the Node and Disk Majority quorum type Microsoft MCTS Training.

Next, the Configure Storage Witness dialog box is displayed. Here I changed the original value to the Q drive that I wanted to use as the quorum by selecting a check box. Clicking Next saves the cluster quorum changes. If you would like to know more about configuring Windows Server 2008 R2 failover clustering, the Windows IT Pro website has articles and FAQs that can help; you can start with “4 Failover Clustering Hassles and How to Avoid Them,” InstantDoc ID 103534.
Enabling Cluster Shared Volumes

The next step in cluster configuration is to enable Cluster Shared Volumes. The Cluster Shared Volumes feature lets multiple cluster nodes simultaneously access the shared storage locations, but it’s not enabled by default. To do so, use the Failover Cluster Management console and right-click the name of the cluster at the top of the navigation pane, then select Enable Cluster Shared Volumes from the context menu. This displays the summary pane for Cluster Shared Volumes, which initially is blank.

To select a shared storage location to be used by Cluster Shared Volumes, click the Add Storage option in the Action pane. This displays the Add Storage dialog box. The storage for Cluster Shared Volumes has to be visible to the cluster and it can’t be used for other purposes. Select the box next to the storage location you want to use. I selected the V drive, which is actually a LUN on the LeftHand Networks SAN. Click OK to enable Cluster Shared Volumes for that drive. This also results in the creation of a mount point on all the cluster nodes. By default, the mount point is labeled C:\ClusterStorage\Volume1.
Creating VMs on Cluster Shared Volumes

At this point, failover clustering is configured on all the nodes in the cluster and the Cluster Shared Volumes feature has been enabled, allowing all of the nodes to simultaneously access the storage. The next step is to create VMs that can take advantage of this infrastructure. Hyper-V VMs can be created using either the Hyper-V Manager or System Center Virtual Machine Manager. To create a new VM using Hyper-V Manager, click the Administrative Tools, Hyper-V Manager option at the Start menu, then select New from the Action pane to start the New Virtual Machine wizard. Figure 5 shows the dialog box you will see, labeled Specify Name and Location Microsoft MCITP Certification.

In Figure 5, you can see that the VM will be named vWS08-SQL01. Also note that the value for the VM location has been set to the Cluster Shared Volumes mount point: C:\ClusterStorage\Volume1. This causes the VM configuration files to be created on the shared storage.

Click Next to assign RAM to the VM. Click Next again to select the network connection for the VM. Assigning a network for the VM is optional. However, if you do select an external network, be sure that the external network connection is named the same on all of your Hyper-V nodes. In my case, I used the external network name of External Virtual Network on all of my Hyper-V cluster nodes.

Click Next to display the Connect Virtual Hard Disk dialog box. Here, again, it’s important to create the VHD files on the Cluster Shared Volumes storage. Initially, the dialog displays the Hyper-V Manager default values for name and location. I used the value of vWS08-SQL01.vhd for the VHD file and changed the location to C:\ClusterStorage\Volume1. Click Next to specify the guest OS installation options. All guest OSs including Linux can take advantage of live migration. The rest of the process for creating a VM is exactly like creating a normal VM.

When you complete the New Virtual Machine wizard, the VM will be created on the Cluster Shared Volumes storage. The next step is to start the VM and install the guest OS and the application that you want to run on the VM.
Enabling VMs for Live Migration

Open the Failover Cluster Management console, then navigate to the Services and Applications node under the cluster name and right-click to display the context menu. Select Configure Service or Application to start the High Availability wizard. On the Select Service or Application dialog box, select Virtual Machine from the list of services displayed, then click Next. This displays the Select Virtual Machine dialog box.

Scroll though the list of VMs until you find the one you want to enable for live migration. I selected the VM vWS08-SQL01 created earlier. The VM can’t be running while you perform this operation—it must be in the Off or Saved state.

Select the check box in front of the VM name, then click Next until you complete the wizard. A confirmation screen is displayed and the summary dialog box reports the status. If you see “Success” in the description, then the VM has been successfully enabled for live migration. If not, you need to review the VM properties and make sure all of the VM assets can be accessed on all of the nodes in the cluster.
Ready, Set, Migrate!

That’s all there is to configuring the Hyper-V live migration environment. At this point, you can initiate a live migration using the Failover Cluster Manager. To start a live migration, expand the Services and Applications node, then select the VM node displayed beneath it. This displays the summary pane, which shows the VMs that have been enabled for clustering, along with their current status, which Figure 6 shows.

In Figure 6, you can see that VM vWS08-SQL01 is currently running and that the current owner is node WS08R2-S1. To initiate a live migration, go to the Action pane and select the Live migrate virtual machine option shown in the upper third portion of the Action pane. A menu flyout prompts you for the name of the target node. In this example, the menu flyout shows 1 – Live migrate to node WS08R2-S2. Clicking this option starts the live migration. The summary window is updated with the status of the running live migration.

The running status is displayed until the live migration finishes. The length of time it takes to complete depends on the size and activity of the VM, as well as the speed and activity of the network connection between the Hyper-V host systems. Typically, my network live migrations take between about 10 seconds and a minute. When the live migration has been completed, the summary pane is redisplayed and the Current Owner value is updated with the name of the target node.
The Virtual Promised Land

Live migration addresses the issues of planned host downtime and lays the foundation for the dynamic datacenter. Although there are quite a few steps in the process, if you carefully navigate the critical points in the process, you will reach the promised land of Hyper-V live migration.

No comments: