Hello I am making a custom choice in a point in a workflow to makea choice to find out if the disk on a vm is either a RDM or just a virthual vmdk. So i can find out what type of disk the vm has and based upon that choice I want to retrun the uuid of either the lun or the vmdk. So in my custom decision I want to parse the disk type and then put them in an array to then get the lun uuid or the vmdk uuid but it only gets the first disk on the vm and not the others
var devices = vm.config.hardware.device;
var diskCount = 0;
var diskArray = new Array();
if ( devices != null ) {
//System.debug("all devices: " + devices);
//loop through devices ...
for ( device in devices ) {
if ( devices[device] instanceof VcVirtualDisk ) {
System.debug("Found disk: " + devices[device].deviceInfo.label);
diskCount++;
diskArray[diskCount] = devices[device];
if (devices[device].backing instanceof VcVirtualDiskRawDiskMappingVer1BackingInfo)
{
//System.log(devices[device].deviceInfo.label + "Disk is Raw Device");
var rdmArray = new Array ();
rdmArray.push(diskArray[diskCount]);
System.log(devices[device]);
return true;
} else{
//System.log(devices[device].deviceInfo.label + "Is a VMDK");
for each ( var i in diskArray){
var vmdkArray = new Array ();
vmdkArray.push(diskArray[diskCount]);
System.log(devices[device]);
}
return false;
}
}
}
}
here is my output for a VM that has 17 disk
[2014-10-08 15:47:50.971] [D] Found disk: Hard disk 1
[2014-10-08 15:47:50.973] [I] DynamicWrapper (Instance) : [VcVirtualDisk]-[class com.vmware.vim.vi4.VirtualDisk] -- VALUE : com.vmware.vim.vi4.VirtualDisk@3ee6bca2
[2014-10-08 15:47:51.017] [I] Get VMDK //(I just have the workflow set to this until I get the output that I want)