vcsim : Remove the single VM limitation for PlaceVmsXCluster API#3836
Merged
akutz merged 1 commit intovmware:mainfrom Aug 13, 2025
Merged
Conversation
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>
|
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
approved these changes
Aug 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CONTRIBUTIONguidelines of this project.