How to read property of vCAC virtual machine
read
property of vCAC virtual machine
var vcVm=
var vcVmName = vcVm.name;
var vcacHost = Server.findAllForType("vCAC:VCACHost")[0];
var
vcVmProperty="bitbull.monitoring.sla";
var vcVmPropertyValue = null;
System.log ("vcVm.config.instanceUuid : " +
vcVm.config.instanceUuid);
var vcacVMEntity = System.getModule("com.vmware.library.vcac").getVirtualMachineByExternalRefId(vcacHost,
vcVm.config.instanceUuid);
var properties =
vcacVMEntity.getLink(vcacHost, "VirtualMachineProperties");
for(var
i = 0 ;i < properties.length; i++){
var PropertyName = properties[i].getProperty("PropertyName");
var
PropertyValue = properties[i].getProperty("PropertyValue");
if(PropertyName
== vcVmProperty){
vcVmPropertyValue = PropertyValue;
System.log("found
"+vcVmProperty+" : "+vcVmPropertyValue);
break;
}
}
Comments
Post a Comment