Creating High Availability Hyper-V Virtual Machines

Windows Server Hyper-V provides a solid platform for organizations looking to virtualize production workloads on a Windows hypervisor platform.  It has certainly matured over the past few versions of the hypervisor and is getting more powerful from the standpoint of features and functionality that are available to Hyper-V administrators.  The primary workload that most organizations are running in virtual environments today are virtual machines.  While the trend is certainly leaning towards containers and other technologies, the staple for production workloads still centers around running VMs to host services and resources at least in the enterprise datacenter environment.  Hyper-V has a number of tools and mechanisms to provision virtual machines in a highly available fashion in a Windows Server Failover Cluster that is hosting the Hyper-V role.  Let’s take a look at creating high availability Hyper-V virtual machines.

Tools Used in Creating High Availability Hyper-V Virtual Machines

One of the strengths or downfalls of Hyper-V depending on your perspective with the product is the sheer number of tools available to interact with the Hyper-V hosts themselves as well as the Windows Failover Cluster running Hyper-V.  Sometimes this can be a point of confusion for those that are newer to the Hyper-V platform.  What tool or tools do you use to create virtual machines?  We will look at three tools in relation to how to create high availability Hyper-V virtual machines including:
  • Hyper-V Manager
  • Failover Cluster Manager
  • System Center Virtual Machine Manager
  • PowerShell
Each of the above tools can play a role in creating high availability Hyper-V virtual machines.  However, each behaves differently and potentially have caveats.

Hyper-V Manager

When you install the Hyper-V Role, you generally install the Hyper-V Manager along with the role.  This is generally the tool that most think of when managing Hyper-V environments, especially getting their feet wet with the product for the first time.  Below, we have Hyper-V manager open with a couple of Hyper-V nodes added to the Hyper-V manager interface.  What you don’t know from the Hyper-V Manager is both nodes are part of a Windows Failover Cluster.  However, with Hyper-V Manager, you don’t get the “cluster aware” options that you get from Failover Cluster Manager.
Hyper-V-manager-Creating-High-Availability-Hyper-V-Virtual-Machine Creating High Availability Hyper-V Virtual Machines
Hyper-V manager – Creating High Availability Hyper-V Virtual Machine
Below, using the Hyper-V Manager, we have right-clicked on a particular node and chosen New >> Virtual Machine.  After going through the wizard to create the virtual machine, you can see the new VM listed in Hyper-V Manager.  The question is this – is the virtual machine made highly available by default in Hyper-V simple because the nodes are part of a Hyper-V cluster?  Importantly – No!
Creating-a-new-virtual-machine-in-Hyper-V-Manager Creating High Availability Hyper-V Virtual Machines
Creating a new virtual machine in Hyper-V Manager
We need to utilize another tool to ensure the newly created Hyper-V virtual machine is highly available and is a cluster resource.

Failover Cluster Manager

As we mentioned earlier, you don’t get access to the cluster aware configuration from Hyper-V manager.  For the cluster options, we need to use another tool – Failover Cluster Manager.  With Failover Cluster Manager, you are able to configure the virtual machine created with Hyper-V manager to be highly available.  Let’s see how.
Below, I have opened Failover Cluster Manager, after creating the Hyper-V virtual machine in Hyper-V Manager.  We do not see the newly created virtual machine.  Why?  Failover Cluster Manager only shows those virtual machines that are part of the Hyper-V cluster role, or are highly available.  How do you make a Hyper-V virtual machine created with Hyper-V manager highly available?  You have to add it to the clustered Hyper-V role.
Failover-Cluster-Manager-showing-highly-available-Hyper-V-virtual-machines Creating High Availability Hyper-V Virtual Machines
Failover Cluster Manager showing highly available Hyper-V virtual machines
Using Failover Cluster Manager, right click the Roles container and select Configure Role…
Configuring-the-Hyper-V-Role-for-Highly-Available-Virtual-Machines Creating High Availability Hyper-V Virtual Machines
Configuring the Hyper-V Role for Highly Available Virtual Machines
This launches the High Availability Wizard.
High-Availability-Wizard-Launched-from-Failover-Cluster-Manager Creating High Availability Hyper-V Virtual Machines
High Availability Wizard Launched from Failover Cluster Manager
Since we want to enable high availability on the newly created virtual machine, select the Virtual Machine option.
Choose-the-Virtual-Machine-Role-to-enable-High-Availability Creating High Availability Hyper-V Virtual Machines
Choose the Virtual Machine Role to enable High Availability
You will see the new virtual machine listed as a potential virtual machine available for enabling high availability.
Enabling-High-Availability-on-a-particular-Hyper-V-Virtual-Machine Creating High Availability Hyper-V Virtual Machines
Enabling High Availability on a particular Hyper-V Virtual Machine
High Availability wizard asks for confirmation to enable HA on the selected virtual machine.
Confirming-the-high-availability-wizard-VM Creating High Availability Hyper-V Virtual Machines
Confirming the high availability wizard VM
The virtual machine is now added to the clustered role.
Hyper-V-Virtual-Machine-High-Availability-is-enabled Creating High Availability Hyper-V Virtual Machines
Hyper-V Virtual Machine High Availability is enabled
Now, you see the virtual machine listed in the Roles in the Failover Cluster Manager.
Hyper-V-Virtual-Machine-High-Availability-is-now-enabled-for-the-new-virtual-machine Creating High Availability Hyper-V Virtual Machines
Hyper-V Virtual Machine High Availability is now enabled for the new virtual machine
This simple exercise demonstrates the importance of the tool used in creating high availability Hyper-V virtual machines.  If you use Hyper-V Manager, you will have to also use the Failover Cluster Manager to add the high availability role to the VM.  However, it is important to note, if you use the Failover Cluster Manager to create the VM, the high availability wizard is part of the process, so it is much quicker and efficient to create the VMs from Failover Cluster Manager when you have a Hyper-V cluster.

Hyper-V Virtual Machine High Availability with System Center Virtual Machine Manager

System Center Virtual Machine Manager or SCVMM is much like a vCenter Server product in that it provides a centralized tool for managing cluster resources specific to virtual machine resources.  It is not a free product like Hyper-V Manager or Failover Cluster Manager that are built right into the Windows Server operating system.  SCVMM provides a powerful tool for Hyper-V Cluster environments that enables Hyper-V administrators to do things they are not able to do with other GUI tools.
Creating a high availability Hyper-V virtual machine with SCVMM is fairly straightforward, however, does have an option that is easy to miss when creating a new Hyper-V virtual machine.  On the Configure Hardware screen, the Make this virtual machine highly available is not checked by default.  Place a check in the box to enable the virtual machine to be created as a clustered role using SCVMM.
Enabling-Hyper-V-virtual-machine-high-availability-using-SCVMM Creating High Availability Hyper-V Virtual Machines
Enabling Hyper-V virtual machine high availability using SCVMM

Hyper-V Virtual Machine High Availability with PowerShell

The nice thing with Hyper-V is that it is extremely configurable using PowerShell.  With PowerShell you can quickly and easily create the clustered role for the virtual machine.  Using the AddClusterVirtualMachineRole commandlet, you can easily pass the virtual machine name and add the clustered resource.
Creating-High-Availability-Hyper-V-Virtual-Machine-using-PowerShell Creating High Availability Hyper-V Virtual Machines
Creating High Availability Hyper-V Virtual Machine using PowerShell

Takeaways

Creating High Availability Hyper-V Virtual Machines can easily be accomplished with a number of tools both GUI and command line.  As shown, it is important to realize that simply creating a virtual machine in a Hyper-V environment does not automatically make the virtual machine highly available.  This is especially evident when you use the Hyper-V Manager to create a virtual machine.  You must use the Failover Cluster Manager or other cluster aware tool such as System Center Virtual Machine Manager as well as PowerShell to make the virtual machine highly available.  By doing this you will ensure that Hyper-V production workloads are protected with Windows Failover Clustering mechanisms.

Post a Comment

0 Comments