Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

Navigating from VcDatastore to VcHostSystem

$
0
0

I'm developing a workflow that takes a VC:Datastore object as input and needs to locate one of the VcHostSystem's that has the datastore mounted, yet I am seeing some inconsistent results.

 

Taking the VcDatastore object, I can get the 'host' attribute which should return an array of VcDatastoreHostMount objects. I should then be able to take one of the VcDatastoreHostMount objects and pull the 'key' attribute from it to get a VcHostSystem. Whe I do this, the 'key' attribute comes back as null or undefined more often then not.

 

Has anyone seen this, or have suggestions for me?

 

Here's some pseudocode:

 

var allMounts = datastore.host;

if (allMounts.length > 0) {

 

   // get the first mount

   var hostMount=allMounts[0];


   if (hostMount.key==null) {

      throw("The hostMount key is null, cannot determine a host with this datastore mounted");

   }

}

 



Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>