Hi All,
I need to get VC:VirtualMachine instance from a catalog resource. I need VM to unmount ISO. This is discussed here "get vCenter VM from vCAC VM"
I was not able to get the VM with the following code. Any help appreciated.
var catalogResource = vCACCAFEEntitiesFinder.getCatalogResource(vcacCafeHost,"4be75047-f5fd-4b0e-bdb6-27c775d8a923");//satish121
var providerBinding = catalogResource.getProviderBinding();
var bindingId = providerBinding.getBindingId();
var vm = Server.findForType("vCAC:VirtualMachine",bindingId);
if( vm != null ){
System.log("Found VM!!!!");
System.log("vmUniqueID:"+vm.vmUniqueID);
}
var vCenterVm;
var sdkConnections = VcPlugin.allSdkConnections;
System.log(sdkConnections.length + " sdk Connections found...");
for each (var sdkConnection in sdkConnections) {
try {
vCenterVm = sdkConnection.searchIndex.findByUuid(null, vm.vmUniqueID, true, false);
} catch(e) {System.log("Error for SDK connection " + sdkConnection.name + " : " + e);}
if (vCenterVm != null) {
System.log("Resolved vCenter VM " + vCenterVm.name);
break;
}
}