Single-Click Update Plus Reboot of All Virtual Machine Guests and the VM Host They Reside On

It seems that everyone always wants to automate everything these days. Sometimes it almost feels like sysadmins think that their credibility hinges on their ability to automate something. However, in reality I think there are times when more automation makes sense, but there are also times where automating something isn’t the best idea or isn’t worth the initial effort required to get something running smoothly via automation. It all depends on the particular situation, so I make no judgement today about whether or not you should be automating any particular processes in your environment. Instead let’s just talk about one very specific situation where I think automation can be nice, can save some time, and can be easy and quick to setup.

If you are responsible for applying Windows Updates to numerous virtual machine guests and hosts, you have probably dealt with the annoyance of trying to coordinate the updating of the guests with the hosts. The thing with updating VMs is that while there is nothing special or different that goes into applying updates to and rebooting VM guests, when it comes to updating and rebooting the VM host computers you have to be careful that you don’t initiate a reboot of the host while guest VMs are still working on their updates in one way or another.

Optimally you would first update all guest VMs, and then when they are all complete only then would you begin the process of updating and rebooting the host computer. However, if you are dealing with many hosts, each of which contains numerous guests, and if you’re dealing with a small maintenance window, it can be very difficult to stay on top of everything so that you can initiate a host update + reboot process as soon as possible after all guests running on that host have completed. However, with BatchPatch this process is actually pretty simple to automate so that you can launch it with a single click on numerous guests and hosts. Wouldn’t it be nice if you could, in a single click, launch the update and reboot process on numerous guest VMs AND their host operating systems too?

There is more than one way to do what I’m about to describe, but the way that I’ll demonstrate now is my favorite method for this particular situation. Obviously you don’t have to follow this exact method if you have a modified version that works better for you in your environment. In this case we’re going to configure a BatchPatch advanced multi-row queue sequence, which is basically an orchestration tool that enables us to execute actions on multiple inter-dependent computers. And we can trigger different computers in the group to perform various actions based on the completion of actions that run on other computers in the group. The goal here is going to be to create a single-click action that will launch the Windows Update process on all VM guests that reside on a single VM host, and then when the guests are done updating, the VM host will update and reboot. When the VM host reboots, guests are configured to automatically shutdown on physical host shutdown, and then startup again automatically on physical host startup.

  1. For this tutorial we will configure the VM guests in question to automatically shutdown when the physical VM host shuts down. Similarly we’ll configure the VM guests to automatically start when the physical VM host starts up. In your VM settings you can either do the same thing, or if you don’t want your VM guests to have these settings, then you would need to modify the tutorial steps accordingly to create your own single-click method for accomplishing the same end result. In Hyper-V you can modify an individual VM guest’s startup and shutdown settings in the settings titled “Automatic start action” and “Automatic stop action.” For this tutorial we want our VMs to be shut down when the physical computer shuts down, and we want the same VMs to start automatically when the physical computer starts. So we configure the two aforementioned settings accordingly.
  2. After you have configured your VM guest settings to automatically shut down and startup when the physical host OS shuts down and starts up, then you can create your BatchPatch advanced multi-row queue sequence. In BatchPatch select the guest VM rows and apply a regular job queue with just one step to ‘Download and install updates’. Then select the host VM row and apply a regular job queue with just one step to ‘Download and install updates + reboot always’. See screenshot below for reference. You can follow this tutorial for creating job queues. In this case you’ll just need to use the option in the Job Queue creation process to ‘Apply queue to row(s) without executing’.
  3. Next highlight the VM guest rows in the grid and select ‘Actions > Job Queue > Create/modify advanced multi-row queue sequence’. Give your sequence a name, and then set the sequence position number of all the VM guests on a particular VM host as position number 1.
  4. Next set the sequence position number of the VM host machine’s row in the grid to position number 2.
  5. Lastly add a new row to the grid to serve as the ‘Execution row’ for the sequence. This new row can be a “dummy” because it’s only purpose will be to act as a sequence execution row. The important part with all of these Advanced multi-row queue sequence settings is that each sequence has to have a unique name. It’s the name that makes different rows in the grid participate in the same sequence. And since we want this sequence to operate on the guest VMs and how computer, we set each row to have the same sequence name. And the same goes for the execution row that we create. In order for our execution row to operate on our sequence, it has to have the same sequence name as the rows that will be included in execution of this sequence. I have used the name ‘TutorialSequence1’.
  6. That’s actually all there is to the creation/configuration part. Now you can execute the sequence on-demand (or via scheduled task). To execute the task on-demand simply highlight the execution row and select ‘Actions > Job Queue > Execute advanced multi-row queue sequence’. Doing this will instruct BatchPatch to do the following:

    Download and install updates on all guest VMs, simultaneously. These three guest VMs were assigned sequence position number 1. All hosts in sequence position number 1 will execute their assigned job queue steps. Then only when *all* of the hosts in sequence position number 1 have completed their job queues will sequence position number 2 begin, which in this case is the update + reboot of the physical VM host computer. The host will apply Windows updates and then reboot. And since our guest VMs have been configured to shutdown when the host shutsdown and to startup when the host starts up, once the host has come back online, all of the guests will also come back online. All guests and hosts will have applied their Windows Updates and rebooted, and the entire action was triggered with just a single-click in BatchPatch. And of course the single click can even be scheduled via the Task Scheduler.
This entry was posted in Blog, General, Tutorials and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.