Microsoft Windows Server Hyper-V is a rock-solid virtualization platform for today’s enterprise environments. Like any enterprise ready solution, Windows Server Hyper-V boasts many built in mechanisms that allow Hyper-V hosts to provide high availability to the production virtual machine workloads they are serving out.

Table of Contents

  1. Causes of Hyper-V Failover Events
  2. Windows Server Hyper-V Failover Responses
  3. Response to Resource Failure Policies
  4. Automatic Start and Stop Actions
  5. Hyper-V Failover Limits and Failback
  6. Hyper-V Protected Network
  7. Concluding Thoughts

Like any virtualization platform however, at some point, you will most likely experience a hardware failure that results in a Hyper-V host going down.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!
  • What exactly may lead to a Hyper-V failover scenario?
  • How does a Windows Server Hyper-V cluster handle host failures?
  • What mechanisms are in place at the cluster level to allow the Hyper-V cluster to respond to
  • various events that may affect running virtual machines?
  • How are Hyper-V virtual machines affected by the various responses to failure in the Hyper-V cluster either planned or unplanned?

In this post we will examine the various Hyper-V cluster responses to failovers and see how each of these mechanisms are implemented from a virtual machine perspective.

Causes of Hyper-V Failover Events

When thinking about Windows Server Hyper-V cluster failover scenarios, what exactly leads to a failover of cluster resources?

There are a few situations that may readily come to mind when thinking about events leading to failover. These may include but not be limited to the following:

Download Banner
  • Host crash
  • Power failure
  • Network Isolation
  • Monitored service failure

Host crash

The first scenario that may come to mind is a crash of a Hyper-V host. This could be the classic blue screen or other crash of the Windows Server operating system on a particular host that leads to the host becoming unresponsive.

Power Failure

A power failure can take a host offline. This could be due to a faulty UPS and an improperly “X-ed” out power cabling scheme.

Network Isolation

Network isolation is a bit different in that the host may still be up and responsive, but for whatever reason is not accessible to the other hosts in the cluster. Network connectivity could be the culprit on the host in question.

Monitored service failure

Starting with Windows Server 2012 the cluster service can monitor services inside a virtual machine configured for high availability. Through Failover Manager, you can select services that you want to monitor inside the virtual machine with the cluster service. A monitored service failure can constitute a failover condition.

Windows Server Hyper-V Failover Responses

Windows Server Failover Clustering provides an extremely robust mechanism to responding to various failures that may happen in the Hyper-V cluster. By default, when the Windows Failover cluster service can’t reach a node in the cluster within a five second window of time, a failover of cluster resources is triggered. This condition can be caused by any number of events that can consist of the above listed causes of Hyper-V failover events.

Hyper-V is highly tweakable in how it implements failover responses in regards to virtual machines. Failover responses can vary based on how protected virtual machine resources are configured. Let’s take a look at the following:

  • Response to Resource Failure Policies
  • Automatic Start and Stop Actions
  • Failover Limits and Failback
  • Protected Network

Response to Resource Failure Policies

Under the properties of the virtual machine cluster resource, you can set the response to resource failures policy tab configuration. To get to the configuration, simply right-click the virtual machine cluster resource and choose the properties.

Looking at the below virtual machine, we right-click the virtual machine resource and select properties.

Hyper-V-Response-to-Failover

Looking at the properties of the virtual machine resource

Under the virtual machine cluster resource properties, you will see a Policies tab where the response to resource failure configuration is found. Note the following response to resource failure configuration:

  • If resource fails, do not restart
  • If resource fails, attempt restart on current node
    • Period for restarts (mm: ss)
    • Maximum restarts in the specified period
    • Delay between restarts (ss. f)
  • If restart is unsuccessful, failover all resources in this Role
  • If all the restart attempts fail, begin restarting again after the specified period (hh:mm)
  • Pending timeout – Specify the length of time the resource can take to change states between online and offline before the cluster service puts the resource in the Failed state
    • Pending timeout (mm: ss)

    Hyper-V-Response-to-Failover

    Hyper-V virtual machine response to resource failure configuration

Automatic Start and Stop Actions

Windows Server Hyper-V failover clusters provide automatic start and stop actions that control how a Hyper-V virtual machine responds in order to start and stop when a physical host is brought back online or is shut down. These settings are triggered when a host is either brought up or down in a “planned” failover. In other words, the host is gracefully shutdown or failed over.

When are the start and stop actions invoked?

When virtual machines that are not configured for high-availability or are restricted to a particular host are started or stopped or if most of the Hyper-V hosts are offline in the cluster that there are no enough cluster resources to power up the virtual machine on a different host.

In the automatic start action configuration, you can configure the virtual machine to do the following when the physical Hyper-V host starts:

  • Nothing
  • Automatically start if it was running when the service stopped
  • Always start this virtual machine automatically

Hyper-V-Response-to-Failover

Hyper-V Cluster virtual machine automatic start actions

Conversely, you can configure what you want the virtual machine to do when the physical Hyper-V host shuts down:

  • Save the virtual machine state
    • Hyper-V will reserve disk space equal to the amount of memory used by the virtual machine when it is running so that memory can be written to disk when the physical computer shuts down
  • Turn off the virtual machine
  • Shut down the guest operating system
    • The integration service that controls shutting down the guest operating system must be installed and enabled on the virtual machine
  • Hyper-V-Response-to-Failover

    Hyper-V cluster virtual machine automatic stop action configuration

Hyper-V Failover Limits and Failback

When viewing the properties of a virtual machine in Failover Manager, you will note the Failover tab. In the failover tab you can specify the number of times the cluster service will attempt to restart or failover the clustered role in the specified period. If the clustered role fails more than the maximum in the specified period, it will be left in the failed state. The failback setting allows specifying whether the clustered role will automatically fail back to the most preferred owner (which is set on the General tab) of the virtual machine properties.

Hyper-V-Response-to-Failover

Configuring preferred owners for a virtual machine clustered role

Hyper-V-Response-to-Failover

Configuring Failover limits and Failback settings for a virtual machine

Hyper-V Protected Network

Under the advanced features for the virtual machine network adapter, there is a feature called Protected Network. With protected network, the cluster service will move the virtual machine to another cluster node if a network disconnection is detected. This is a great feature that helps to protect a virtual machine that may not being having any compute, memory, or stability issues on a particular host, but is simply in a disconnected state from a network perspective.

Hyper-V-Response-to-Failover

Hyper-V virtual machine protected network configuration

Concluding Thoughts

Windows Server Hyper-V provides a robust virtualization platform that allows Hyper-V administrators a tremendous amount of control over how the virtual machines running on Hyper-V respond during failover events affecting a Hyper-V host. The various mechanisms covered in this post allow administrators to tweak the behavior of how virtual machines respond and react such as how they are failed over in the first place, limits to failover actions, failback behavior, start and stop actions, as well as protected network options. Knowing how to utilize the various levels of configuration can allow Hyper-V administrators to control most of the important aspects of virtual machine behavior during failover events.

Read More:
Troubleshooting Hyper-V with Event Logs
Windows Server Hyper-V Cluster Networks

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post