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

Documentation for implementing extra tasks/functionailty to vcsim #3593

Open
ithinkiborkedit opened this issue Oct 12, 2024 · 5 comments
Open

Comments

@ithinkiborkedit
Copy link

ithinkiborkedit commented Oct 12, 2024

Is your feature request related to a problem? Please describe.
I'm currently developing against a recording of one of our vcenters via vcsim. When it comes to searching for files on a datastore it returns this error: ServerFaultCode: Datastore:xxxx-yyyy does not implement: SearchDatastore_Task.

Describe the solution you'd like
It would be nice to have some documentation on how to implement missing functionality, as I'm quite sure this is not the only thing missing.

Describe alternatives you've considered
Going to a live dev environment, while it would remove the hurdle, having access to vcsim has given me a lot of flexibility which I want to keep.

Additional context
Being able to develop against an up-to date recording of our vcenters allows us to move along with developing core features that aren't necessarily dependent on having a live connection. Being able to run your code against vcsim is a useful feature to have to bolster your automated tests.

Copy link
Contributor

Howdy 🖐   ithinkiborkedit ! Thank you for your interest in this project. We value your feedback and will respond soon.

If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION guidelines.

@dougm
Copy link
Member

dougm commented Oct 12, 2024

It would be great to have such docs. For this specific issue, vcsim does implement SearchDatastore_Task

Looks like a client issue, Datastore:xxxx-yyyy, but This needs to be a HostDatastoreBrowser instance. Is your client in Go or another language? The Datastore.browser property is normally used as the HostDatastoreBrowser.

@ithinkiborkedit
Copy link
Author

ithinkiborkedit commented Oct 12, 2024

Hi Doug, the client is currently being written in Golang. Okay I think I may have seen where I have gone wrong... I'm not sure if it's just my newbiness to VCenter, but what is the fundamental difference between Datastore and Host Datastore. I've been using Datastore throughout my code base. Thanks!

@ithinkiborkedit
Copy link
Author

Hi Doug,

Is it possible to get some clarity on this? I instantiate an instance of the HostDatastoreBrowser, I pass the client and a managed object reference of my Datastore type as per the documentation here:

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/eba5419c-6272-4697-bd07-a328843c487e/f7bb0652-de93-4431-b874-82f11852e474/doc/vim.host.DatastoreBrowser.html

Which leads me to getting the error that the Datastore doesn't satisfy the requirements of the interface. Am I missing something?

@dougm
Copy link
Member

dougm commented Oct 15, 2024

govc datastore.ls command for example gets *object.HostDatastoreBrowser from *object.Datastore instance here:
https://github.com/vmware/govmomi/blob/main/govc/datastore/ls.go#L90

Later uses HostDatastoreBrowser SearchDatastore methods here:
https://github.com/vmware/govmomi/blob/main/govc/datastore/ls.go#L157-L160

Are you using the object package helpers or generated types/methods directly?
You can also use the -trace flag with govc to see how request is sent, add -verbose to that and see it as Go code:

% govc datastore.ls -ds sharedVmfs-0 -trace -verbose
...
types.SearchDatastore_Task{
    This:          types.ManagedObjectReference{Type:"HostDatastoreBrowser", Value:"datastoreBrowser-datastore-48", ServerGUID:""},
    DatastorePath: "[sharedVmfs-0]",
    SearchSpec:    &types.HostDatastoreBrowserSearchSpec{
        Query:                 nil,
        Details:               (*types.FileQueryFlags)(nil),
        SearchCaseInsensitive: (*bool)(nil),
        MatchPattern:          []string{"*"},
        SortFoldersFirst:      (*bool)(nil),
    },
}
...

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