Skip to content

vcsim : Remove the single VM limitation for PlaceVmsXCluster API#3836

Merged
akutz merged 1 commit intovmware:mainfrom
sprasad093:topic/sprasad093/placevmsxcluster_support_multivms
Aug 13, 2025
Merged

vcsim : Remove the single VM limitation for PlaceVmsXCluster API#3836
akutz merged 1 commit intovmware:mainfrom
sprasad093:topic/sprasad093/placevmsxcluster_support_multivms

Conversation

@sprasad093
Copy link
Copy Markdown

Description

Currently, PlaceVmsXCluster API supports placement of only one VM at a time. In VCF 9.1, the API will support placing multiple VMs in a single call.

In this PR, I am removing the check which validates if the length of VmPlacementSpecs is equal to 1.

Also, added a new test to verify that the placement passes with multiple VMs in input spec.

Closes: #CRM-3431

How Has This Been Tested?

[# govmomi]$ go test ./simulator
ok github.com/vmware/govmomi/simulator 65.270s

[# govmomi]$ go test -v ./simulator -run ^TestPlaceVmsXCluster
=== RUN TestPlaceVmsXClusterCreateAndPowerOn
--- PASS: TestPlaceVmsXClusterCreateAndPowerOn (0.81s)
=== RUN TestPlaceVmsXClusterCreateAndPowerOnWithCandidateNetworks
--- PASS: TestPlaceVmsXClusterCreateAndPowerOnWithCandidateNetworks (0.81s)
=== RUN TestPlaceVmsXClusterRelocate
--- PASS: TestPlaceVmsXClusterRelocate (1.00s)
=== RUN TestPlaceVmsXClusterReconfigure
--- PASS: TestPlaceVmsXClusterReconfigure (0.26s)
=== RUN TestPlaceVmsXClusterCreateAndPowerOnWithMultipleVms
--- PASS: TestPlaceVmsXClusterCreateAndPowerOnWithMultipleVms (0.81s)
PASS
ok github.com/vmware/govmomi/simulator 3.703s

Guidelines

Please read and follow the CONTRIBUTION guidelines of this project.

Currently, PlaceVmsXCluster API supports placement of only
one VM at a time. In VCF 9.1, the API will support placing
multiple VMs in a single call.

So, in this MR, I am removing the check which validates if
the length of VmPlacementSpecs is equal to 1.

Also, added a new test  to verify that the placement passes
with multiple VMs in input spec.

[# govmomi]$ go test ./simulator
ok      github.com/vmware/govmomi/simulator     65.270s

[# govmomi]$ go test -v ./simulator -run ^TestPlaceVmsXCluster
=== RUN   TestPlaceVmsXClusterCreateAndPowerOn
--- PASS: TestPlaceVmsXClusterCreateAndPowerOn (0.81s)
=== RUN   TestPlaceVmsXClusterCreateAndPowerOnWithCandidateNetworks
--- PASS: TestPlaceVmsXClusterCreateAndPowerOnWithCandidateNetworks (0.81s)
=== RUN   TestPlaceVmsXClusterRelocate
--- PASS: TestPlaceVmsXClusterRelocate (1.00s)
=== RUN   TestPlaceVmsXClusterReconfigure
--- PASS: TestPlaceVmsXClusterReconfigure (0.26s)
=== RUN   TestPlaceVmsXClusterCreateAndPowerOnWithMultipleVms
--- PASS: TestPlaceVmsXClusterCreateAndPowerOnWithMultipleVms (0.81s)
PASS
ok      github.com/vmware/govmomi/simulator     3.703s

Closes : # CRM-3431

Signed-off-by: Shivaprasada M A <shivaprasada.ma@broadcom.com>
@Pradeepbr
Copy link
Copy Markdown

Hi Shiva,

I see you have made changes to make it work for simulator. New test TestPlaceVmsXClusterCreateAndPowerOnWithMultipleVms looks good. But do you have plans to update 'go cli' place command to take multiple vms. For example In cli/folder/place.go, func (cmd *place) Run(ctx context.Context, f *flag.FlagSet) error can only take one VM parameter. It needs to be modified to take multiple vms and then these multiple vms need to be passed to vmPlacementSpecs.

@akutz akutz merged commit 894c8b8 into vmware:main Aug 13, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants