Last year I wrote about a very interesting tool called vCenter Server Simulator (VCSIM) which allows a user to quickly simulate a VMware environment that can be comprised of thousands of ESXi hosts and virtual machines. VCSIM can benefit a variety of use cases such as learning about the vSphere API, creating reports for vSphere or vCloud Director to building vSphere Web Client plugins to help visualize large inventories. There was an overwhelming interest in VCSIM from last year and I received some great feedback and feature requests which I fed back to the VMware engineers who developed this internal tool.
With the upcoming version of vSphere 5.5 to be released very soon, I was wondering if there were going to be any new features for VCSIM in VCSA 5.5? I reached out to one of the engineers, Haiping Yang, who works in the Performance Engineering team who is currently taking over some of the development of VCSIM. Some of you might be familiar with some of her work such as the recent visualEsxtop, esxtop and resxtop to just name a few. In talking to Haiping, I found that she has been quite busy adding cool new features to VCSIM and this is on top of her regular day job!
Disclaimer: This is not officially supported by VMware, please use at your own risk.
Here is a quick summary of the new features of VCSIM 2.0:
Distributed Virtual Switch (VDS) Support:
- Add / Remove ESXi hosts from VDS
- Create / Delete Distributed Virtual Portgroup
- Reconfigure Distributed Virtual Portgroup
- Add / Remove VM from Distributed Portgroup
vCloud Networking & Security (vCNS) Support:
- Create / Delete vCNS Gateway
- Create / Delete Isolated/Routed Org Networks
- Create / Delete vApp Networks
- Deploy / Undeploy vApp with DHCP service enabled
Persistent Inventory Configuration upon restart:
- Folder, Cluster, Resource Pool, Host, Datastore, Virtual Machine, Network and VDS
Custom Configuration Support:
- ESXi version template
- ESXi configuration template
- Datastore configuration
- Virtual Machine datastore
Easy startup commands:
- vmware-vcsim-stop [true|false] - Determines whether the inventory is cleared after stopping VCSIM
Note: Before you can use VCSIM, you will need to configure the VCSA as you normally would by going through the VAMI interface or running through the SSH commands noted in this article.
I will not go over every single feature mentioned above, but I did want to take a look at a few noteworthy features such as the new VCSIM start/stop command, datastore configuration and ESXi host configuration templates.
VCSIM Start/Stop Commands:
With the previous version of VCSIM, you had to manually edit the vCenter Server configuration file (vpxd.conf) and append the necessary VCSIM configurations. In this release, we now have an easy to use command-line utility to start and stop VCSIM. The vmware-vcsim-start command supports several startup options.
To view the list of supported options, just run the following command:
Option 1 - You can specify a VCSIM configuration file and you can find several examples located in /etc/vmware-vpx/vcsim/model
Option 2 - You can specify either the keyword "empty" for a blank vSphere inventory or "default" which will automatically use /etc/vmware-vpx/vcsim/model/vcsim-default.cfg inventory configuration
Option 3 - You can just specify the inventory layout on the command-line. An example would be "custom:dc=1,cluster=1,rp=1,host=1,vm=1,vm_on=1,latency=true"
To get a list of all the available VCSIM configurations, take a look at /etc/vmware-vpx/vcsim/model/vcsim.cfg.template
Here is an example of starting VCSIM using the "default" mode:
Custom datastore configuration was something that was much sought after with VCSIM 1.0 and unfortunately, there was only a single global datastore that was automatically "connected" to all simulated ESXi host. The new version of VCSIM now supports custom datastore configurations that can be defined globally, at the cluster level, local storage as well as string prefix which can help you separate out different VCSIM instances.
Here is an example of the configuration that would need to be added to the VCSIM configuration file:
<datastore> <global>1</global> <cluster>4</cluster> <local>5</local> <prefix>vghetto</prefix> </datastore>
Here is what one of the simulated ESXi hosts would show for its datastores:
ESXi Configuration Template:
Another useful feature that I personally have asked for is the ability to customize an individual simulated ESXi host. Though this is still currently a work in progress, what you can do with VCSIM 2.0 is to customize the ESXi host version as well as the datastores on a per host basis. If you take a look vcsim.cfg.template, you will find a configuration line that looks like:
This specifies a directory that would contain custom simulated ESXi host templates and their configurations. A sample host template is provided at /etc/vmware-vpx/vcsim/model/hostConfig.xml.template and currently, you need to specify the default simulated hostname (e.g. DC0_C0_H0.xml).
Here is an example of what that host template can look like:
<hostConfig> <datastores> <ds id="virtuallyGhetto-datastore-1"/> <ds id="virtuallyGhetto-datastore-2"/> <ds id="virtuallyGhetto-datastore-3"/> </datastores> </hostConfig>
Now if we go back to our DC0_C0_H0 ESXi host, you will see that the host template will override the global configuration:
For the two examples above, here is what I used in my custom VCSIM configuration file that I called vcsim-virtuallyghetto.cfg if you are interested in what I used:
<simulator> <enabled>true</enabled> <initInventory>vcsim/model/initInventory-default.cfg</initInventory> <hostConfigLocation>vcsim/model/hostConfig</hostConfigLocation> <datastore> <global>1</global> <cluster>4</cluster> <local>5</local> <prefix>vghetto</prefix> </datastore> </simulator>
I have already asked for the ability to fully customize the simulated ESXi host display name and have already been told that this is something they would consider for a future release. VCSIM 2.0 has also been improved to better operate with vCloud Networking & Security and vCloud Director. I was able to quickly test VCSIM 2.0 with the latest version of vCloud Director 5.5 and everything seems to be working fine. You can follow the existing instructions here for vCloud Director setup with VCSIM.
As you can see VCSIM 2.0 contains many new features and I highly encourage you to give it a spin when vSphere 5.5 is made generally available. There are definitely some additional fit and finish features that Haiping just could not get into this release. Hopefully we will get those updates in a future release of VCSIM and include additional ESXi template versions. If you have any feedback, comments or feature requests feel free to leave a comment and I will make sure it reaches Haiping and the development team. I do not want to spoil the surprise, but I just want to say one of the features coming in VCSIM 3.0 will be quite AWESOME! 😀 (sorry for the tease)