Hi!
Is it possible to browse datastores via VIMservice? All I know so far is that it is possible to rename/move/delete known files, but is it possible to do a real "browse" on a datastore via the webservice too? F.e. list all files in a specific directory?
Thx, Tos2k
A VIperlToolkit way to get this info is shown in VMware\VMware VI Remote CLI\Perl\lib\VMware\VIext.pm
This is directly done by the good old HttpRequest (plus some argument/Url parsing).
Shall this really be the only way browse datastores by the webService, even in ESX 3.5(i)???
Tos2k
Hi,
in the vmperltoolkit there is a sample-app (C:\perl\apps\host\dsbrowse.pl) which shows how to access datastores and to show different settings (name, capacity, filetypes etc.).
Look for the funktion "find_datastores()" and modify it to your needs.
-Stefan
Hi, thx for Ur reply!
Cant you attach the file to a post here as I cannot find "find_datastore" function in the alpha and beta of vipertoolkit? I cannot find dsbrowse.pl either.
Anyway, I know how to check the different properties of a datastore, are you sure that your reply will make it possible to show files and folders in a specific location on a datastore?
By the way, I am currently developing under .NET and would like to know if this can be achieved by the VimApi of VMware, or if the webservice has to be accessed directly/manually by the HttpRequest object, as seen in the attached VIExt.pm (do_http_get_file called by do_http_get_file). This behaviuor I would merely call a hack than being supported by VMware VimApi...
thx, Tos2k
Thanks for the investigation!
This topic has been discussed here before:
http://communities.vmware.com/message/743131
Finally, the DatastoreBrowser does its work very good
The resulting files can be picked up like this then:
VimApi.HostDatastoreBrowserSearchResults hsr = (HostDatastoreBrowserSearchResults)result[2];
foreach (VimApi.FileInfo fi in hsr.file)
Console.WriteLine(fi.path);
Tos2k
p.s. Grüße nach Dland
You're welcome, I'm glad you solved you're problem.
Anyway I'm living in Denmark (though I lived in Germany some years ago)
Sidharth,
I've tried using this script in the past, but there appears to be a problem if run against Virtual Center. I haven't had time to investigate where things go wrong in the code, but the results end up with the hosts associated with a datastore being listed repeatedly:
>Hosts associated with this datastore.
> esx008.domain
> esx007.domain
> esx008.domain
> esx009.domain
> esx007.domain
> esx008.domain
> esx009.domain
> esx011.domain
> esx007.domain
> esx008.domain
> esx009.domain
> esx011.domain
> esx010.domain
> esx007.domain
> esx008.domain
> esx005.domain
> esx009.domain
> esx011.domain
> esx010.domain
> esx007.domain
> esx008.domain
> esx005.domain
> esx009.domain
> esx036.domain
> esx011.domain
> esx010.domain
> esx007.domain
> esx008.domain
Is this script only meant to be run directly against hosts? I don't see that as a specified limitation, and the online documentation states it is supported with ESX and VC.