I am not sure if I am just being dense and missing something obvious but it does not seem like the vCAC:VirtualMachine object has any way of grabbing the managing vCAC:VCACHost. I created an action which I think should work for most objects. I had assumed in a similar fashion to vCD that most objects would have a .parent attribute or a function to get the host. At the moment I don't imagine us ever having more than one vCACHost in a vCO to be honest but you know how that goes. I wrote this action to return the vCAC:VCACHost but if there is an easier/better way please let me know.
if(vCACVm != null){
var vmParentId = vCACVm.getEntity().hostId;
var hosts = Server.findAllForType("vCAC:VCACHost");
System.log("Number of vCACHosts found: " + hosts.length);
if(hosts){
for each (var host in hosts) {
System.log("Comparing hostId: " + host.id + " to vm managed by id: " + vmParentId);
if (host.id == vmParentId) {
System.log("Looks like " + host.displayName + " is a match!");
return host;
}
}
}
}