Hi,
Can some one of you help me with a C# code to get the reference to "StoragePod" ?
I'm using
VimService _service = new VimService();
_service.Url = url;
_service.CookieContainer = new CookieContainer();
_sic = _service.RetrieveServiceContent(_svcRef);
_service.LoginCompleted += new LoginCompletedEventHandler(_service_LoginCompleted);
_session = _service.Login(_sic.sessionManager, userId, pwd, null);
Use search index to do find DataCenter Ref, VM Ref and Folder Ref but don't know to get the StoragePod Reference
Ex : ManagedObjectReference vmCreateLocation = _service.FindByInventoryPath(searchIndex, vmSandboxPath);
/BR
Thisara
A "StoragePod" extends the "Folder" construct as shown in the vSphere API Refernce Guide http://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.StoragePod.ht... so you'll need to search through your Folders and then check for the StoragePod type.
Here's a sample script https://github.com/lamw/vghetto-scripts/blob/master/perl/datastoreClusterManagement.pl which uses the vSphere SDK for Perl that should help. More info at this blog article virtuallyGhetto: Automating Storage DRS & Datastore Cluster Management in vSphere 5
Hi Iamaw,
Thanks for the answer it was really helpful but could you know the way to search the storage pod MOR
because we use FindByInventoryPath in SearchIndex but not sure whether we can get storagePod from that way or not. I can get StoragePod by using FindByChild but the issue is if we change the location, that will fail.
Is there any way to search the StoragePod from root and do it recursively ?
Yes, you can recursively look for your Datastore Cluster (aka StoragePod). As mentioned, StoragePod extends a Folder object which can of course be nested. You'll want to start from serviceInstance->rootFolder and keep iterating as long as it has childEntities of type Folder.
Thanks. I fixed it :smileylaugh: