Running vcsim on Windows

vcsim is an new feature that has been added to govmomi. You can capture an entire vCenter, then load that vCenter configuration and write code against it. All of your original vCenter objects are available in this simulated vCenter.

I started following William Lam’s tutorial and ran into issues running vcsim. I was able to export my VMC vCenter, but couldn’t load it into vcsim. vcsim seems to want to create a temp directory with colons in the path.

William suggested that I tried to run on WSL. I opened WSL and did an apt-get install for golang (don’t do this). Then I ran the next command in William’s post:

go get github.com/vmware/govmomi/govc

This resulted in a Go error: undefined: os.UserHomeDir. Some Googling told me that this error was because os.UserHomeDir wasn’t introduced until Go 1.12, I had 1.10.

More Googling revealed that I had to add an additional repo to get a more current version of Go than 1.10

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get install golang-go

Much better, now I’m at 1.15.6

This time the vcsim command succeeded.

I connect with PowerCLI and I can list my hosts with Get-VMHost

I can even create objects, watch me create a folder.

Awesome stuff!

I filed an issue because you should be able to run vcsim without using WSL, but it is a workaround for now.

UPDATE: A patch has been merged for this issue. To ensure you get the latest version of the the binaries, you can use the -u switch. This will pull the latest code from the master branch, giving you the most current version. The -v is for verbose.

go get -v -u github.com/vmware/govmomi/govc
go get -v -u github.com/vmware/govmomi/vcsim

Leave a Reply

Your email address will not be published. Required fields are marked *