VMware

This Question is Not Answered

1 "correct" answer available (10 pts) 1 "helpful" answer available (6 pts)
6 Replies Last post: Aug 26, 2009 1:14 AM by paul_xtravirt  

Desperate - trying to get information about datastores through web services posted: Aug 24, 2009 9:48 AM

Click to view paul_xtravirt's profile Expert 214 posts since
Feb 16, 2007

Hi all,

Can some one please help me :( I have spent hours today and am still stuck. I am trying to retrieve the datastores for a datacenter, with information about the datastores (for example, capacity and free space) and which hosts are connected to them. I am trying to do this in module1, in the datastores() sub. I have searched teh forums but have not found anything that really helps me out. Can someone please put me out of my misery? I have attached my code to this post.

Oh, this is in vb.net by the way using the latest vsphere SDK. I will award points :)


If you found this helpful, please consider awarding points

Attachments:
Click to view Seemankij's profile Expert VMware Employees 261 posts since
Sep 30, 2007
You must iterate through the inventory to find out the datastores in a datacenter. Datacenter has a property "datastore" which list all the datastores associated with that datacenter. Please follow the attached Java sample for quick reference on how to retrieve the information. The attached sample uses vSphere SDK libraries.
Attachments:
Click to view lamw's profile Champion vExpert 3,492 posts since
Nov 27, 2007
Here is another sample using Perl listAllDatastoresInCluster.pl (sorry can't provide .vb example)

As mentioned, if you're able to get a reference to the cluster you're interested in, you'll be able to get a reference to list of the datastores the cluster can see and from that, you'll loop through the array and be able to get information regarding each datastore http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.ComputeResource.html

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Click to view heyitspablo's profile Hot Shot VMware Employees 183 posts since
Feb 26, 2007
Folks - Let us know if there is interest for a Sample Code community dedicated to VB.NET ? Think it might be useful for folks using VB.NET but not sure level of interest from wider community.. ..

regards,

Pablo

Developer Social Media

Communities