Moving Environments between TPCs when using TFS Lab Management
One area I think can be found confusing in TFS Lab Management is that all environments are associated with specific Team Projects (TP) within Team Project Collections (TPC). This is not what you might first expect if you think of Lab Management as just a big Hyper-V server. When configured you end up with a number of TPC/TP related silos as shown in the diagram below.
This becomes a major issue for us as each TP stores its own environment definitions in its own silo; they cannot be shared between TPs and hence TPCs. So it is hard to re-use environments without recreating them.
This problem effects companies like ourselves as we have many TPCs because we tend to have one per client, an arrangement not that uncommon for consultancies.
It is not just in Lab Management this is an issue for us. The isolated nature of TPCs, a great advantage for client security, has caused us to have an ever growing number of Build Controllers and Test Controllers which were are regularly reassigning to whichever are our active TPCs. Luckily multiple the Build Controller can be run on the same VM (I discussed this unsupported hack here), but unfortunate there is no similar workaround for Test Controllers.
MTM is not your friend when storing environments for use beyond the current TP
What I want to discuss in this post is how, when you have a working environment in one TP you can get it into another TP with as little fuss as possible.
Naively you would think that you use the Store in Library option within MTM that is available for a stopped environment.
This does store the environment on the SCVMM Library, but it is only available for the TP that is was stored from. It is stored in the A1 silo in the SCVMM Library. Now you might ask why, the SCVMM Library is just a share, so anything in it should be available to all? But it turns out it is not just a share. It is true the files are on a UNC share, you can see the stored environments as a number of Lab_[guid] folders, but there is also a DB that stores meta data, this is the problem. This meta data associates the stored environment with a given TP.
The same is true if you choose to just store a single VM from within MTM whether you choose to store it as a VM or a template.
Why is this important you might ask? Well it is all well and good you can build your environment from VMs and templates in the SCVMM Library, but these will not be fully configured for your needs. You will build the environment, making sure TFS agents are in place, maybe putting extra applications, tools or test data on system. It is all work you don’t want to have to repeat for what is in effect the same environment in another TP or TPC. This is a problem we see all the time. We do SharePoint development so want a standard environment (couple of load balanced servers and a client) we can use for many client projects in different TPCs (Ok VM factory can help, but this is not my point here).
A workaround of sorts
The only way I have found to ease this problem is when I have a fully configured environment to clone the key VMs (the servers) into the SCVMM Library using SCVMM NOT MTM
- Using MTM stop the environment you wish to work with.
- Identify the VM you wish to store, you need its Lab name. This can be found in MTM if you connect to the lab and check the system info for the VM
- Load SCVMM admin console, select Virtual Machines tab and find the correct VM
- Right click on the VM and select Clone
- Give the VM as new meaningful name e.g. ‘Fully configured SP2010 Server’
- Accept the hardware configuration (unless you wish to change it for some reason)
- IMPORTANT On the destination tab select the to ‘store the virtual machine in the library’. This appears to be the only means to get a VM into the library such that it can be imported into any TPC/TP.
- Next select the library share to use
- And let the wizard complete.
- You should not have a VM in the SCVMM Library that can be imported into new environments.
You do have to at this point recreate the environment in your new TP, but at least the servers you import into this environment are configured OK. If for example you have a pair of SP2010 servers, a DC and a NLB, as long as you drop them into a new isolated environment they should just leap into life as they did before. You should not have to do any extra re-configuration.
The same technique could be used for workstation VMs, but it might be as quick to just use template (sysprep’d) clients. You just need to take a view on this for your environment requirements
Read the complete post at http://blogs.blackmarble.co.uk/blogs/rfennell/post/2011/12/23/Moving-Environments-between-TPCs-when-using-TFS-Lab-Management.aspx