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.
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!
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.
Using Failover Cluster Manager, right click theย Roles container and selectย Configure Role…
This launches theย High Availability Wizard.
Since we want to enable high availability on the newly created virtual machine, select theย Virtual Machine option.
You will see the new virtual machine listed as a potential virtual machine available for enabling high availability.
High Availability wizard asks for confirmation to enable HA on the selected virtual machine.
The virtual machine is now added to theย clustered role.
Now, you see the virtual machine listed in theย Roles in the Failover Cluster Manager.
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.
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.
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.