Automating patching of operating system servers in a Microsoft Hyper-V cluster

You can use Server Automation to automate patching of operating system servers in a Microsoft Hyper-V cluster, without affecting the data availability groups operations. Server Automation enables you to automate the patching process using a number of Tasks which manage the cluster as it is being patched. The Tasks prepare nodes for patching by pausing them and moving all virtual machines, groups, and resources off the nodes. The required patches are then applied to the operating system as part of the automation flow. After the operating system is patched, the automation flow restores the nodes to their original pre-patching state.

Before you begin

About this task

There are two phases in the automated patching flow. In the first phase, one node or group of nodes is patched. In the second phase, the second node of group of nodes is patched. By managing the patching in this way, the cluster remains operational at all times. In phase one, you run a sequence of Tasks to manage the patching of the first node or group of nodes in the cluster. Then you repeat these same steps on the second node or nodes in the cluster. The following operating systems are supported:
  • Windows 2012
  • Windows 2012 Release 2
  • Windows 2008 Release 2 and later

To automate the patching process, you run an automation plan. The automation plan contains a number of steps, each of which represents a stage in patching process. You can create a new automation plan or modify an existing plan, such as an out-of-the-box sample plan by changing some of the steps.

Procedure

  1. Add Task ID 117 Pre-patching Task for clustered Microsoft HyperVisor Servers to the plan as step 1 in the plan. When you are running the plan, target the first node or group of nodes in the cluster.
    This Task performs the following functions:
    1. Creates a file detailing all groups and virtual machines in the cluster, including what nodes they are on and the states of each resource in the cluster. If there are empty groups (groups with no resources) in the cluster, a second file is created detailing these groups.
    2. Pauses the node.
    3. Checks to see if there are other nodes available to which to move the virtual machines. If other nodes are available, virtual machines are moved using the method you select (either live migrated or quick migrated). If the virtual machines are set up to be online only on the current node (no other possible owners set) the virtual machine is taken offline. If the virtual machine has other possible owners but these owners are not available, the Task fails because it is not possible to move the virtual machine off the node.
    4. Moves groups that have other available owners. If no other owners are available to take groups, the Task fails. Any groups set up to be online only on the current node (only target set as possible owner of the group or at least one resource in the group) are the taken offline.
    5. Takes any empty groups offline.
    6. Checks to ensure the node is paused and has no active groups remaining and is a state suitable for patching the server operating system.
    Note: This Task does not move any groups that were offline before the Task was run.
  2. Add the required operating system patching Fixlet, Task, or Baseline as the second step in the plan. When you are running the plan, target the first node or group of nodes in the cluster.
  3. Add Server Automation Task 126 Restart Endpoint and Wait for Restart to Complete to restart the first node or group of nodes in the cluster. When you are running the plan, target the first node or group of nodes in the cluster.
  4. Add the post patching Task 129 Post Patching task for Microsoft Server Clusters (Server 2008 R2 onwards including Hyper-V Clusters) to restore the node or nodes to their original state. After this Task has run successfully, the first node or nodes in the cluster are patched and back up and running. When you are running the plan, target the first node or group of nodes in the cluster.
    This Task performs the following functions:
    1. Resumes the node.
    2. If the cluster detail file is found on the targeted endpoints, the Task checks this file and moves any virtual machines and groups back on to the node if they were moved off the node during patching. The Task then brings back online any empty groups or groups which had the target node as the only possible owner of the group before patching.
  5. Add four more steps to the plan, to repeat steps 1 to 4 for the second node or group of nodes. For each of these steps, you need to target the second node or nodes in the cluster.