public HostScsiDisk findLunDisk(int hlu,Collection<String> sourceNames,Collection<String> targetNames){
  Map<String,HostHostBusAdapter> hbas=getHostBusAdapters();
  String diskKey=null;
  for (  HostScsiTopologyInterface adapter : listScsiTopologyInterfaces()) {
    HostHostBusAdapter hba=hbas.get(adapter.getAdapter());
    String sourceName=getSourceName(hba);
    if (!sourceNames.contains(sourceName) || (adapter.getTarget() == null)) {
      continue;
    }
    for (    HostScsiTopologyTarget target : adapter.getTarget()) {
      String targetName=getTargetName(target);
      if (!targetNames.contains(targetName)) {
        continue;
      }
      HostScsiTopologyLun lun=findLun(target,hlu);
      if (lun != null) {
        String key=lun.getScsiLun();
        if (diskKey == null) {
          diskKey=key;
        }
 else         if (!StringUtils.equals(diskKey,key)) {
          throw new IllegalArgumentException("LUN " + hlu + " maps to different disks for "+ targetNames);
        }
      }
    }
  }
  if (diskKey == null) {
    return null;
  }
  HostScsiDisk disk=getScsiDiskByKey(diskKey);
  return disk;
}

public HostScsiDisk findLunDisk ( int hlu , Collection < String > sourceNames , Collection < String > targetNames ) { Map < String , HostHostBusAdapter > hbas = getHostBusAdapters ( ) ; String diskKey = null ; for ( HostScsiTopologyInterface adapter : listScsiTopologyInterfaces ( ) ) { HostHostBusAdapter hba = hbas . get ( adapter . getAdapter ( ) ) ; String sourceName = getSourceName ( hba ) ; if ( ! sourceNames . contains ( sourceName ) || ( adapter . getTarget ( ) == null ) ) { continue ; } for ( HostScsiTopologyTarget target : adapter . getTarget ( ) ) { String targetName = getTargetName ( target ) ; if ( ! targetNames . contains ( targetName ) ) { continue ; } HostScsiTopologyLun lun = findLun ( target , hlu ) ; if ( lun != null ) { String key = lun . getScsiLun ( ) ; if ( diskKey == null ) { diskKey = key ; } else if ( ! StringUtils . equals ( diskKey , key ) ) { throw new IllegalArgumentException ( "LUN " + hlu + " maps to different disks for " + targetNames ) ; } } } } if ( diskKey == null ) { return null ; } HostScsiDisk disk = getScsiDiskByKey ( diskKey ) ; return disk ; }
finds the scsi disk for the lun that is associated with one or more targets , from the specified sources . the sources and targets should be either port wwns or iscsi iqns .
