Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcsim: Support PlaceVm with relocate placement type #3546

Conversation

yanleizhao-vmware
Copy link
Contributor

Description

This patch introduces basic support for ClusterComputeResource.PlaceVm with the relocate placement type in vcsim. Since relocate is a supported placement type in real vSphere environments, it is essential to ensure that our simulator environment reflects this capability for accurate and comprehensive testing.

Closes: #3540

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update
  • Build related change

How Has This Been Tested?

All of the added unit tests simulate behavior (i.e., expected Faults/Recommendations) when testing the same PlacementSpec against a real vSphere environment.

% go test -v -count 1 -run 'TestPlaceVm' -coverprofile cover.out ./simulator

=== RUN   TestPlaceVmReconfigure
2024/09/06 14:56:08 unsupported placement type: unsupported
--- PASS: TestPlaceVmReconfigure (1.76s)
=== RUN   TestPlaceVmRelocate
--- PASS: TestPlaceVmRelocate (0.39s)
=== RUN   TestPlaceVmsXCluster
--- PASS: TestPlaceVmsXCluster (0.87s)
PASS
coverage: 27.4% of statements
ok      github.com/vmware/govmomi/simulator     3.455s  coverage: 27.4% of statements
go tool cover -html=cover.out -o=coverage.html 

100% code coverage on new code:
Screenshot 2024-09-06 at 2 59 18 PM
Screenshot 2024-09-06 at 2 59 30 PM
Screenshot 2024-09-06 at 2 59 41 PM
Screenshot 2024-09-06 at 2 59 56 PM

Checklist:

  • My code follows the CONTRIBUTION guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

dougm
dougm previously approved these changes Sep 6, 2024
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yanleizhao-vmware , lgtm. Just a couple minor suggestions

simulator/cluster_compute_resource.go Outdated Show resolved Hide resolved
simulator/cluster_compute_resource.go Outdated Show resolved Hide resolved
simulator/cluster_compute_resource.go Outdated Show resolved Hide resolved
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yanleizhao-vmware ,
Can you please squash the review fixup commits first?

@yanleizhao-vmware
Copy link
Contributor Author

Thanks @yanleizhao-vmware , Can you please squash the review fixup commits first?

Of course, I wasn't sure if using squash and fixup is recommended, or tolerated 😅

This patch introduces basic support for `ClusterComputeResource.PlaceVm` with
the `relocate` placement type in vcsim. Since relocate is a supported placement
type in real vSphere environments, it is essential to ensure that our simulator
environment reflects this capability for accurate and comprehensive testing.
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yanleizhao-vmware yanleizhao-vmware merged commit 0a94649 into vmware:main Sep 7, 2024
10 checks passed
@yanleizhao-vmware yanleizhao-vmware deleted the feature/vcsim-support-placevm-relocate branch September 7, 2024 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vcsim: Support relocate and reconfigure opType for ClusterComputeResource.PlaceVm
4 participants