Note: A full hands on lab covers the usage of the Hyper-V activity in the ALM Rangers Build Customisation documentation. These notes are a subset of the HOL

The Hyper-V activity enables builds to manage Hyper-V VMs via the WMI interface. The WMI provider is used to send commands to a Hyper-V host to manage a Virtual Machine. This Hyper-V host can be local, on the build host, or on a remote Hyper-V host, assuming that the build user account the build is running under has suitable rights to administer the Hyper-V server.

In this example we aim to show the the basic steps that are required to get the activity integrated into a build.

Before you can make use of any of the TFS 2010 community build activities you have to make sure they are available for the build system and on your development PC. Instructions for this process can be found in the ALM Rangers build guide or in the StyleCop page of this wiki. This page assumes the Hyper-V activity is available in the developers build process workflow toolbox.

Adding arguments to the workflow

To make your build process template useful across a number of projects it is worth passing in the parameters for the Hyper-V host and VM as workflow arguments. Default values can be provided.

image

  • HyperVHost – “[name of your HyperV host]”
  • VMName – “[name of the HyperV VM]”

Add the activity to the workflow

Drop the Hyper-V activity onto your build workflow, this will usually be towards the end of the process after you have built your assemblies.

image

On any instance of the Hyper-V activity you will need to set

  • Set task action you wish to perform on the VM e.g. Start
  • Set the Display name to Start HyperV VM (makes the logging easier if a seensilbe name is provided)
  • Set the ServerName property to HyperVHost argument created previously
  • Set the VMname property to VMName argument created previously

The default values for these workflow arguments could have been defaulted in the process template. However, they can be overridden as build parameters as required, thus enabling better potential reuse of build workflow.

image

Running the Build

When the build runs you should now see the Hyper-V run task in the log, and you can monitor the VM status via the Hyper-V management console

image

Last edited Sep 24, 2011 at 10:13 AM by rfennell, version 3

Comments

No comments yet.