Source:
public int getScsiDiskControllerKey(String diskController) throws Exception { List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient(). getDynamicProperty(_mor, "config.hardware.device"); String deviceList = ""; if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if (device != null) { deviceList += String.format(" Device %s: info:%s controller key:%s;", device.getKey(), device.getDeviceInfo(), device.getControllerKey()); } if ((DiskControllerType.getType(diskController) == DiskControllerType.lsilogic || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualLsiLogicController) { return ((VirtualLsiLogicController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.lsisas1068 || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualLsiLogicSASController) { return ((VirtualLsiLogicSASController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.pvscsi || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof ParaVirtualSCSIController) { return ((ParaVirtualSCSIController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.buslogic || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualBusLogicController) { return ((VirtualBusLogicController)device).getKey(); } } } assert (false); throw new Exception("Scsi disk controller of type " + diskController + " not found among configured devices:" + deviceList + ". Unable to find and return scsi disk controller key."); }

Target:
public int getScsiDiskControllerKey(String diskController) throws Exception { List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient(). getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if ((DiskControllerType.getType(diskController) == DiskControllerType.lsilogic || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualLsiLogicController) { return ((VirtualLsiLogicController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.lsisas1068 || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualLsiLogicSASController) { return ((VirtualLsiLogicSASController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.pvscsi || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof ParaVirtualSCSIController) { return ((ParaVirtualSCSIController)device).getKey(); } else if ((DiskControllerType.getType(diskController) == DiskControllerType.buslogic || DiskControllerType.getType(diskController) == DiskControllerType.scsi) && device instanceof VirtualBusLogicController) { return ((VirtualBusLogicController)device).getKey(); } } } assert (false); throw new IllegalStateException("Scsi disk controller of type " + diskController + " not found among configured devices."); }