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");
}
}