ElectricCommander is tightly integrated with VMware Lab Manager, which allows ElectricCommander to easily provision and destroy virtual machines during the build process. The current integration with VMware requires you to use Lab Manager. If you are not using Lab Manager, this article describes a similar solution that works directly with ESX (VI3) servers, including the tools you need and the techniques to directly manipulate the ESX server. The solution for provisioning ESX servers is similar to Lab Manager, but slightly less functional.
Using the VMware Infrastructure Perl Toolkit allows you manipulate the ESX server, storage, resource pools, and VMs. You can do just about anything you want to do to the ESX server. To download this toolkit, a link is provided at the end of this article.
Lab Manager provides functionality on top of ESX, so naturally, you will not have these functions if you communicate directly with the ESX server. In particular, Lab Manager allows:
- Libraries of configurations
- Very efficient storage of VMs
- Network fencing around the VMS (allows mulitple copies of the same VM to run at the same time without network naming collisions [IP address, MAC, etc...] )
VMware provides a Perl toolkit to communicate with ESX servers. This Perl toolkit also contains some pre-built utilities to simplify interaction with the ESX server.... essentially providing a command-line interface.
- Download the toolkit for the intended platform. The VMware download site is http://www.vmware.com/support/developer/viperltoolkit/ (requires login)
- Install the toolkit on the ElectricCommander agent that will run the commands (this could be the ElectricCommander server).
- Create ElectricCommander steps that call the utilities.
Here is an example script that runs in an ElectricCommander step. It logs on, queries the ESX server, starts a VM, and then shuts down the VM.
We found the VMWare utilities produced a strange error when running in ElectricCommander on Windows. It calls the Windows utility "chcp" to find the code page, but apparently returns empty results. Running the utility outside ElectricCommander works fine. For now, suppress the error by making a fake copy of "chcp" that gives back a value. This may have been a configuration problem on our test machine, but we included the workaround in case you have the same problem.