views:

331

answers:

2

For testing our product's installer, I maintain a tree of virtual machine snapshots with different previous versions installed. It is a tedious task to do Windows Update, re-snapshot, delete parent snapshot on each VM.

Is there an automated solution for keeping a group of VMs up-to-date? I use VirtualBox but have access to VMware Workstation and would switch if maintenance would improve.

+3  A: 

We keep a baseline of VMs in a library of sorts. They're are about 20-odd (with mixtures of different versions of Java, DB2, WAS and so on) that the development and test teams can copy out for their own use.

The librarian (developer, doing this part-time) is responsible for keeping them up to date. What they'll do is copy one of the VMs every week or so, boot it and install all updates, then copy the updated VM back over the original. This means it's available for checking out except when the copy operation is being done. Additionally, the number of VMs that need to be updated is minimized by virtue of the fact that they're shared.

That's how we do our snapshots, by copying the directories partially because it's easier to manage but mostly because we're too tight to buy the workstation version :-) We use the player instead.

It's mostly automated since all the VMs grab their updates from our SUS server and we know when they have updates ready to go. The librarian is notified by a script which VMs need to be updated and just has to run another script which copies the VM and starts the copy.

Once the librarian is satisfied the copy is up to date, they shut it down and yet another script copies that VM back into the library and updates its status.

paxdiablo
I like this idea, for the team-oriented aspect as well as its simplicity and light weight. Downside to this is that while it allows you to supply a library of up-to-date baselines, it doesn't provide a solution for keeping VMs up to date that are in use.
Aidan Ryan
Use is pretty short-term in our environment, Aidan. Typically, the VMs are copied out for a set of test runs that only lasts until the tests all succeed. This is usually well under a week, then the copied out VMs are deleted until they're needed again.
paxdiablo
+1  A: 

I don't know of an automated solution for all of your VMs, but I would recommend using Windows Server Update Services to keep track of the update status of every VM and provide a local Windows Update repository to speed up the updating process.

I suppose you could use a combination of WSUS and Group Policy to do these updates, setting up automatic update installation, and just turning on all of your VMs for a given period to make sure they all get the updates.

That doesn't solve the problem with managing snapshots etc though. I wonder if VMWare has an API...

tomfanning
Interesting idea. VMware and VirtualBox do have APIs so you could automate the snapshotting. In fact, you could automate the power-on, allow updates to install, power-off as well. This would be a sizable task to implement. With a large farm of VMs I would consider it.
Aidan Ryan
If you were to go down this route, you can force the Windows Update service to check for updates "now" by executing "wuauclt /detectnow". It won't appear to do anything, but you'll find it will go away to WSUS (or Windows Update if you're not in a WSUS environment) and the yellow shield will appear bottom-right if anything's pending.
tomfanning