When you need to create a highly available virtual machine running on Microsoft's Hyper-V you need to do so on a Failover Cluster. In this post I will show you how to create a highly available virtual machine on a two-node Windows Server 2008 cluster. The cluster is using simple desktop machines with storage on an MSA2012i SAN (iSCSI).

There are two ways to create the virtual machine:

  1. Use the Hyper-V Manager in conjunction with Failover Cluster Management.
  2. Use System Center Virtual Machine Manager 2008 (SCVMM).

The first method is a bit clumsy because it involves two different consoles. That method, however, has more flexibility as you will see later. Let's take a look at the first method and see how you could create a virtual machine in the cluster on a shared volume.

Creating the virtual machine without SCVMM
Without SCVMM you need Hyper-V Manager and Failover Cluster Manager. To start, you need to have a volume available to the cluster. In my case, I had a volume with drive letter S: as available storage to the cluster as shown in the screenshot below.

image

Even a volume that is not part of a service or application (a resource group in old terminology) is owned by a particular host. In the screenshot you see that hyperv2 owns the disk.

The next step is to use Hyper-V Manager to create a virtual machine. It is important that you store both the virtual machine configuration and hard disk(s) on shared storage. To create the virtual machine, open Hyper-V Manager on the host that owns the disk and create a new virtual machine as shown below. This is the same as on a standalone host as this tool is not aware of the cluster.

image 

A wizard will start to create the virtual machine. Just follow the wizard and make sure you use shared storage. We can now proceed to the next step and that is adding the machine to the cluster.

Now open Failover Cluster Management, right click Services and Applications and click Configure a Service or Application. A wizard will start. Follow the wizard until the screen below and select Virtual Machine (only available when Hyper-V is installed):

image

When you click Next, the wizard will enumerate the virtual machines on shared storage so that you can select them:

image

After the virtual machine has been selected, continue the wizard. The end result will be a new service called Virtual Machine with two resources (well, actually three): the virtual machine configuration, the virtual machine and the storage volume. The screenshot below illustrates what you see in the Failover Cluster Management console after running the wizard a few times to add other virtual machines on the same volume.

image

You can now start the virtual machine directly from Failover Cluster Management and install a guest operating system. If you need to attach an iso first, you will need to use Hyper-V Manager. The Failover Cluster Management tool provides an easy way to start Hyper-V Manager. Just right click the service (here called by default Virtual Machine).

From the moment the virtual machine is part of the cluster you will need to perform actions such as stopping, shutting down and saving state from Failover Cluster Management. If you use Hyper-V Manager to stop the virtual machine for example, the cluster will restart the virtual machine again (with the default resource settings).

Creating the virtual machine with SCVMM
SCVMM, being the 'single pane of glass' for virtualization management provides a way to create new virtual machines on both clusters and standalone Hyper-V hosts. Before you can create a virtual machine on a cluster you need to add the cluster to SCVMM. From the Actions pane, select Add Host as shown below:

image

In the Add Hosts wizard, type the cluster name in Host server name and press Enter. The cluster should be added to the list as shown below:

image

Now continue the wizard to deploy the SCVMM agent on each node in the cluster (=automatic). The cluster will be shown in SCVMM as shown below:

image

 

Adding a virtual machine is easy but the current beta of SCVMM has some limitations:

  • SCVMM only supports one virtual machine per cluster volume. This effectively means I need one LUN per virtual machine, something I need anyway if I want to 'Quick Migrate' individual virtual machines.
  • SCVMM only supports volumes with drive letters (no mount points).

Before you create the virtual machine, make sure there is available storage in the cluster that is not used by any other virtual machine. To create the virtual machine, just select New Virtual Machine from the Actions pane at the right to launch the wizard. The wizard is straightforward but you should not forget to configure the virtual machine as highly available. You do so from the Configure Hardware dialog in the wizard. Scroll to the bottom where there is an Availability section. When the wizard is finished, SCVMM will have created a new service in the cluster called SCVMM vmname Resources. You can now start the virtual machine from SCVMM and start installing a guest operating system.

Conclusion
Creating a highly available virtual machine is easy but as you have seen, there are several ways to do it. There are also some discrepancies between what you can do with and without SCVMM. The final version of SCVMM will have to solve this so that you can truly use it as your primary management tool for Hyper-V.

 

REMARK: I my setup I installed the following hotfix: http://support.microsoft.com/?id=951308. This hotfix provides more functionality and virtual machine control for Hyper-V in a failover cluster.