I recently spent some time experimenting with a really cool tool found only in the VCSA (vCenter Server Appliance) called vcsim, short for vCenter Simulator. I initially noticed vcsim during some of my early beta testing of vSphere 5.1 and during this period it is not uncommon to find various utilities and debugging tools used by developers and QE for testing. At the time, I was more focused on usability issues and reporting bugs with the product and I did not think much of this vcsim. It was only until recently, after talking to Mr. Not Supported aka Randy Keener, did I look into vcsim again as it appears to have been included in the GA (generally available) build of the VCSA 5.1 which I had not expected.
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
As you can see, once you start to think about the potential of a such tool, the possibilities can be endless. Having said all of this, no amount of simulation can ever replace actual testing of a real system and any development made using vcsim should be validated against an actual vSphere environment.
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.template
To 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>
<simulator> <enabled>true</enabled> <cleardb>false</cleardb> <initinventory>vcsim/model/initInventory.cfg</initInventory> </simulator>
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 restart
Note: 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:
You might notice that your inventory may not be as large as mines ... oh about 10,000 VM large 🙂 Another cool thing about vcsim is that it has a configurable inventory that you can customize to fit whatever design you wish to have and this can be modified in /etc/vmware-vpx/vcsim/model/initInventory.cfg file. You can tweak the following in the configuration files:
- Datacenter
- 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
Once you have saved your changes, to reload the new configurations into vcsim, you will need stop the vCenter service and run vpxd -b command to recreate the database and then start the vCenter service. To do so, run the following 3 commands (this is required each time for any changes):
service vmware-vpxd stop
vpxd -b
service vmware-vpxd start
When 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:
- 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)
Note: You should only be modifying the *.cfg files and not the XML configuration files else you could potentially run into issues.
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.
Jake Robinson says
Can this also simulate agents on ESXi hosts like vslad for simulating vCloud Director?
William says
Jake,
No it can not.
Jake Robinson says
Feature Request!
Matthew Graci says
So the VCSIM can generate perf data by modifying the: vcsim/model/metricMetadata.cfg file?
If so, can vCops report on this data?
-Matt
William says
I've not tried it, I encourage you to give it a try 🙂
Brandon Williams says
This comment has been removed by the author.
Anonymous says
hi, i tried this. Even though I can see the performance metrics like CPU usage and memory usage for a Virtual machine in the VI client i am not able to get these metrics when i query through Perl API. I get data for 3 metrics disk.unshared.kilobytes, disk.used.kilobytes and disk.provisioned.kilobytes. For Clusters its giving even more. But strangely none of these metrics are configured in the metricMetadata.cfg file.Metric collection setting for cluster is altogether absent. This leads me to think if vcenter services is actually reading this file.
Anonymous says
Does this allow for simulation of any network connectivity or shared storage allocations?
Things like joining the simulated VMs to different vSwitches (standard or distributed)
Using vMotion & svMotion with the simulated VMs
In general is this for playing with the day-to-day management of a large VM environment or for feeding fake performance data to external tools?
William says
As the article mentions, there is a limited amount of inventory based operations: create/destroy VMs and Hosts and power ops for VMs. There is no simulation of any networks or storage (there is a single "simulated" datastore volume). I've mentioned a few use cases in the article already and would encourage you to give it a try.
Reuben Stump says
Awesome post.
Michael Ryom says
This is simply put awesome!!! Great article William... Looking forward to be able to test vSphere's limits and not just hitting them in production. This is going to be implemented in your test environment...
is it possible use vcops, vin, vcloud, n1k etc with this ?
Mamont says
Hello,
I have clean Mware vCenter Server Appliance 5.1.0.5300 Build 947940
My /etc/vmware-vpx/vcsim/model/initInventory.cfg:
http://tny.cz/3c33047e
Some errors appears when I run service vmware-vpxd restart command.
Console errors: http://tny.cz/2019c6bb
What's wrong with my vCenter Server Simulator configuration?
Thanks.
William says
If you take a look at the error logs, you can see that it points you to a miss-match in "initInventory" tag. It looks like you used a lower case "i" for starting inventory and upper case for the ending. The tag should be "initInventory"
Gaston Perez says
Thank you for this doc. Notice the “initInventory” tag is incorrect in your instructions, so I also run into this issue. Probably fixing it here will save others some time.
Great blog, thank you
Gaston.
Mamont says
Thank you, William! works fine!
za says
This comment has been removed by the author.
za says
William, is vcsim configuration operates (works) only until applience restart? Should we recreate the database every time after reboot?
William says
That's correct
Mia Griffiths says
I think this is something useful with our business, I could do my research regarding this one to see if it will work with rfid inventory solutions app.
Peter Ciolfi says
Hello... Can this be used to simulate vMotions? Thanks... P.C.
Anonymous says
Hey, great post! I started playing with this and think its going to help me out tremendously with some testing activities I am on the hook for. Any idea on the metric metadata file. There is not a whole lot there to work with and curious if anyone has made any headway here?
Anonymous says
Hello William,
I have followed your post word-by-word. But, I could not simulate the vCenter. All that I see in the web client and c# client is only the vCenter Hostname. No simulated object. I am using evaluation version of VCSA 5.1. Should that matter?
Thanks
Anonymous says
I have the same issue (Evaluation Mode): no matter what changes I do in initInventory.cfg there are no simulated objects in vSphere Client.
Cheers, J
provashi jack says
It's really an information full post. Thanks to share . This post has been removed my same mistaken thing . I think if you bring on your activities you will achieve much popularity.. At last.. thanks.
Information visualization Low
Anonymous says
Hello
I've installed a Windows 2008 R2 + Vcenter, but can't manage to setup this simulation mode. is it not possible or is it me? I'm not very skilled.
Thx
Shawn Anders says
As the post indicates, this only works with the VC appliance which is Linux based. Therefore, this utility does not work with a Windows based vCenter.
Raamesh Keerthi says
Please let me know whether it possible to perform SRM related stuffs using this?
Regards
Raamesh Keerthi N J
Frank Wegner says
This sounds to be a very useful tool to test vCO workflows interacting with VMs and other objects.
Mohan says
Where do I download the vc Simulator and the vcloud simulator
Sylvia says
Is vcsim available for download? If not, when will vcsim be available for download
William Lam says
As mentioned in the article, it is part of the VCSA (vCenter Server Appliance). You can get VCSIM by downloading and installing that.
Nitin says
Hi William,
After getting the VCSIM up and running, I notice that all hosts in vcsim have same UUID. Though VMs have different UUIDs. Is there a way, even hosts can get different UUIDs?
hgrules says
This is indeed awesome.
What I was looking at is customizing the host hardware configuration (inventory) information.
Is there a possibility in 2.0 to achieve this?
vColossus says
Hi William,
Great Post!
It looks as if the entries to add into the /etc/vmware-vpx/vpxd.cfg file are missing however.
Perhaps a blog re-edit is needed?
William Lam says
Fixed. It looks like the migration did eat up the code
vColossus says
Thanks William. All cool now!
Deepakrb says
This post helped me a lot when i was checking my API calls' performance.
Thanks a lot William
Puneet Shukla says
HI,
I want to assign a static IP to the virtual machine. Is it possible to modify IP address of the VMs in simulator?
Puneet Shukla says
a quick reply from any one will be very helpful; thanks for a wonderful article. It has already helped me a lot
Kundan says
Do you have any simulator that works for Windows vCenter server as well. I understand that this is applicable for vCSA only!!
Thanks,
Kundan
Hitesh says
A very informative article.
IS there any documented process to access ESXi 5.5.0 behind a natted firewall to access from a vCenter server behind a natted firewall.
Thank you,
Hitesh
Douglas Hensel says
Hello,
Is there a way to install VMWare tools on the simulated VMs ? It does not seem possible, but I am just learning about this tool.
Ram says
If i want to cpu ready then where i need to change on Vcenter silmultor ? do i need to change metricMetadata.cfg?
and what changes i need add in metricMetadata.cfg to see CPU ready ..? Presently it shows 0 CPU Ready data/traffic in Vphere Client Web UI.
shaik afroze says
HI William Lam ,
Is it available for vcenter 6.7
sadhu says
Is there any limit on no of VMs can be created per host/vcenter.. is real(physical) limitations applicable to simulator environment. like can i create 1 million VMS?
Viral says
is vcsim having only 6.5 version of vcenter?