Disclaimer: This is not officially supported by VMware, use at your own risk.
vCenter Simulator is an internal tool developed by two VMware engineers: Zhelong Pan and Kinshuk Govil which allows you to quickly simulate thousands of virtual machines all running in memory while requiring only a minimal amount resources within the VCSA (2vcpu & 8GB memory - default configuration). Building such a tool is definitely not a trivia task, but it is also not the first time we have seen something like this. Awhile back there was project called simDK created by Andrew Kutz that did something similar but only supported reading information from vCenter Server, it did not support any actual operations. vcsim is much more advanced and the really cool thing about vcsim is that even though the inventory is simulated, it actually supports some basic vSphere inventory operations such as create/destroy and power operations. It also supports a hybrid configuration where you can mix both simulated and actual ESXi hosts and virtual machines since it is an actual vCenter Server.
Before we dive into using vcsim, I wanted to go through a few use cases where a tool such as this would be useful:
- Exploring and learning about the vSphere API and the basic inventory hierarchy of vSphere objects
- Environment to develop and create various inventory reporting scripts (vCLI, PowerCLI, etc)
- Developing performance metric gathering tools
- Developing vSphere Web Client plugins and being able visualize large inventory of objects
To enable vcsim, you will need to add some configuration entries into the vpxd.cfg (vCenter Server configuration file) an example template of the configuration is provided in:
/etc/vmware-vpx/vcsim/model/vcsim.cfg.templateTo setup a basic vCenter Simulator, you should deploy a brand new VCSA (you can use an existing VCSA, but the VCDB could potentially get wiped) and go through the basic setup as you would normally. Next, you need to add the following lines at the end of /etc/vmware-vpx/vpxd.cfg between </vpxd> and </config>
Note: Notice the cleardb parameter is false in my example where as the template is set to true. This is very important because if you use the default of "true", you will not be able to view your vSphere inventory using the vSphere Web Client but only the vSphere C# Client as the Inventory Service DB is wiped.
Once you have added the configurations and saved the vpxd.cfg, you will need to restart the vCenter service by running the following command:
service vmware-vpxd restartNote: A restart of the vmware-vpxd service ONLY works the very FIRST time you add in the vcsim configurations. For any additional changes to the vcsim configuration files, a different method is required to reload the changes, else the vCenter service will fail to start. This is shown in detail further in the article.
Once the vCenter service has restarted, you should now be able to login using either the vSphere Web Client or the vSphere C# Client and you should see a default vSphere inventory that contains a Datacenter, Cluster, several ESXi hosts with Resource Pools along with some powered on and off virtual machines.
Here is a screenshot of logging into the vSphere Web Client:
Here is a screenshot logging into the vSphere C# Client:
- Hosts per Datacenter
- VM per Host
- Powered On VM per Host
- Cluster per Datacenter
- Host Per Cluster
- Resource Pool per Cluster
- VM per Resource Pool
- Powered On VM
- vCPU for a VM
- vMEM for a VM
service vmware-vpxd stopWhen you log back into your vCenter Server, you now should see the new inventory based on your configurations. In addition to inventory configuration, the vcsim template also points to three other configuration files which I encourage to explore further:
service vmware-vpxd start
- vcsim/model/metricMetadata.cfg (simulated Performance Metrics, none by default)
- vcsim/model/vcModules.cfg (simulated VC modules such as DRS)
- vcsim/model/OperationDelay.cfg (operations latencies)
At this point, you are probably ready to start playing with vcsim and even though this is an internal tool, if you think this is something that is useful to have or have other use cases for, please leave a comment. You never know, this could be a VMware Fling one day if there is enough interest from the community.