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 does not handle VSLM GlobalObjectManager methods #2542

Open
protochron opened this issue Aug 10, 2021 · 5 comments
Open

vcsim does not handle VSLM GlobalObjectManager methods #2542

protochron opened this issue Aug 10, 2021 · 5 comments

Comments

@protochron
Copy link
Contributor

Is your feature request related to a problem? Please describe.
vcsim does not currently handle calls from the VSLM GlobalObjectManager, which means it's currently impossible to use vcsim to test those code that uses them.

Describe the solution you'd like
It should be fairly straightforward to add a simulator implementation for VslmVStorageObjectManager and register it as a handler for the /vslm/sdk path. Most of the endpoints are largely the same as the existing VcenterVStorageObjectManager, although there are additional endpoints that the local version does not support.

The only problem I can think of offhand with that approach is that a struct that handles VslmVStorageObjectManager needs to share the same set of objects as the existing VcenterVStorageObjectManager. This makes it difficult to use the simulator's RegisterSDK method to add the handler. There is also an ordering dependency which means that the setup might have to happen as part of initially configuring the VStorageObjectManager.

@protochron
Copy link
Contributor Author

protochron commented Aug 10, 2021

Actually, now that I'm reading this the code some more, I wonder if it's even easier:

  • implement the various Vslm* methods defined in vslm/global_object_manager.go in simulator/vstorage_object_manager.go
  • configure it to handle the /vslm/sdk path

However, I don't know if there's an easy way to clue the simulator in to needing to handle the /vslm/sdk path without refactoring the existing code to maintain its own registry

@dougm
Copy link
Member

dougm commented Aug 31, 2021

Sorry for the delay @protochron . I've only glanced at the vslm/GlobalObjectManager API, but we should be able to share code between the two managers. Methods in the vslm/simulator package can call into simulator.VcenterVStorageObjectManager, similar to how we use simulator.VirtualDiskManager internally. And we can refactor as needed to share between the two managers. Here is some skeleton code, do you think something like this would work?

@protochron
Copy link
Contributor Author

@dougm No worries, this kind of fell off my radar since I've had other things to work on.

I started getting everything set up to add some of the endpoints myself a few weeks ago: protochron/govmomi@master...protochron:vcsim_vslm_global_object

Your skeleton is a lot more complete than mine when it comes to defining the ServiceContent, so I'll probably refactor what I have to pull that in. You're right in that a lot of the logic can be shared between the two managers -- we'll just have to figure out a way to refactor things so that it makes sense.

@dougm
Copy link
Member

dougm commented Aug 31, 2021

Sounds good @protochron , let me know if I can help

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants