vmware / govmomi

Go library for the VMware vSphere API
Apache License 2.0
2.32k stars 913 forks source link

vcsim: add options for ESXi/vCenter version #3560

Open Syuparn opened 2 months ago

Syuparn commented 2 months ago

Is your feature request related to a problem? Please describe. While vcsim can change the API version through the option -api-version, ESXi/vCenter version cannot be changed.

# start vcsim
$ vcsim -api-version 8.0

# see vCenter info
$ govc about
FullName:     VMware vCenter Server 6.5.0 build-5973321 (govmomi simulator)
Name:         VMware vCenter Server
Vendor:       VMware, Inc.
Version:      6.5.0
Build:        5973321
OS type:      linux-amd64
API type:     VirtualCenter
API version:  8.0
Product ID:   vpx
UUID:         fb08b87b-b771-535a-8eb0-4a9ed5e45ee7

Describe the solution you'd like vcsim has options to set the ESXi/vCenter version similar to -api-version.

# start vcsim
$ vcsim -api-version 8.0 -vpx-version 8.0.3

# see vCenter info
$ govc about | grep -i version
Version:      8.0.3
API version:  8.0
# start vcsim
$ vcsim -esx -api-version 8.0 -esx-version 8.0.3

# see ESXi info
$ govc about | grep -i version
Version:      8.0.3
API version:  8.0

Additional context An option name -version should not be used as it may be confused with the version command vcsim version.

dougm commented 2 months ago

Hi @Syuparn , we could just set all 3 (api, vpx, esx) to the same value of -api-version. Would that work for you? We have record+playback to satisfy more complex use-cases.

Syuparn commented 2 months ago

@dougm

we could just set all 3 (api, vpx, esx) to the same value of -api-version. Would that work for you?

It will work and sounds simpler. In this case, should we set version as x.y.z format (instead of x.y) to -api-version?

# set 8.0.3 instead of 8.0
$ vcsim -api-version 8.0.3

$ govc about | grep -i version
Version:      8.0.3
API version:  8.0
dougm commented 2 months ago

ok great. Yes, I think value of -api-version should be x.y.z