private void updateTargetsInExportMask(StorageSystem storage,Volume volume,Map<Volume,Map<String,List<String>>> volumeToInitiatorTargetMapFromAttachResponse,List<Initiator> fcInitiatorList,ExportMask exportMask) throws Exception {
  log.debug("START - updateTargetsInExportMask");
  Map<URI,List<URI>> mapFilteredInitiatorURIVsTargetURIList=new HashMap<URI,List<URI>>();
  Map<String,URI> initiatorsWWNVsURI=getWWNvsURIFCInitiatorsMap(fcInitiatorList);
  URI varrayURI=volume.getVirtualArray();
  Map<String,URI> mapVarrayTaggedPortWWNVsURI=getVarrayTaggedStoragePortWWNs(storage,varrayURI);
  Set<String> varrayTaggedPortWWNs=mapVarrayTaggedPortWWNVsURI.keySet();
  URI vpoolURI=volume.getVirtualPool();
  VirtualPool vpool=dbClient.queryObject(VirtualPool.class,vpoolURI);
  int pathsPerInitiator=vpool.getPathsPerInitiator();
  Set<Volume> volumeKeysSet=volumeToInitiatorTargetMapFromAttachResponse.keySet();
  for (  Volume volumeRes : volumeKeysSet) {
    log.info(String.format("Processing attach response for the volume with URI %s and name %s",volumeRes.getId(),volumeRes.getLabel()));
    Map<String,List<String>> initiatorTargetMap=volumeToInitiatorTargetMapFromAttachResponse.get(volumeRes);
    Set<String> initiatorKeysSet=initiatorTargetMap.keySet();
    for (    String initiatorKey : initiatorKeysSet) {
      List<String> filteredTargetList=filterTargetsFromResponse(varrayTaggedPortWWNs,initiatorTargetMap,initiatorKey);
      log.info(String.format("For initiator %s accessible storage ports are %s ",initiatorKey,filteredTargetList.toString()));
      List<String> tmpTargetList=null;
      if (!isVplex(volumeRes)) {
        tmpTargetList=checkPathsPerInitiator(pathsPerInitiator,filteredTargetList);
        if (null == tmpTargetList) {
          throw new Exception(String.format("Paths per initiator criteria is not met for the initiator : %s " + " Target counts is: %s Expected paths per initiator is: %s",initiatorKey,String.valueOf(filteredTargetList.size()),String.valueOf(pathsPerInitiator)));
        }
      }
 else {
        tmpTargetList=filteredTargetList;
      }
      populateInitiatorTargetURIMap(mapFilteredInitiatorURIVsTargetURIList,initiatorsWWNVsURI,mapVarrayTaggedPortWWNVsURI,initiatorKey,tmpTargetList);
    }
  }
  List<URI> storagePortListFromMask=StringSetUtil.stringSetToUriList(exportMask.getStoragePorts());
  for (  URI removeUri : storagePortListFromMask) {
    exportMask.removeTarget(removeUri);
  }
  exportMask.setStoragePorts(null);
  Set<URI> initiatorURIKeys=mapFilteredInitiatorURIVsTargetURIList.keySet();
  for (  URI initiatorURI : initiatorURIKeys) {
    List<URI> storagePortURIList=mapFilteredInitiatorURIVsTargetURIList.get(initiatorURI);
    for (    URI portURI : storagePortURIList) {
      exportMask.addTarget(portURI);
    }
  }
  log.debug("END - updateTargetsInExportMask");
}

private void updateTargetsInExportMask ( StorageSystem storage , Volume volume , Map < Volume , Map < String , List < String > > > volumeToInitiatorTargetMapFromAttachResponse , List < Initiator > fcInitiatorList , ExportMask exportMask ) throws Exception { log . debug ( "START - updateTargetsInExportMask" ) ; Map < URI , List < URI > > mapFilteredInitiatorURIVsTargetURIList = new HashMap < URI , List < URI > > ( ) ; Map < String , URI > initiatorsWWNVsURI = getWWNvsURIFCInitiatorsMap ( fcInitiatorList ) ; URI varrayURI = volume . getVirtualArray ( ) ; Map < String , URI > mapVarrayTaggedPortWWNVsURI = getVarrayTaggedStoragePortWWNs ( storage , varrayURI ) ; Set < String > varrayTaggedPortWWNs = mapVarrayTaggedPortWWNVsURI . keySet ( ) ; URI vpoolURI = volume . getVirtualPool ( ) ; VirtualPool vpool = dbClient . queryObject ( VirtualPool . class , vpoolURI ) ; int pathsPerInitiator = vpool . getPathsPerInitiator ( ) ; Set < Volume > volumeKeysSet = volumeToInitiatorTargetMapFromAttachResponse . keySet ( ) ; for ( Volume volumeRes : volumeKeysSet ) { log . info ( String . format ( "Processing attach response for the volume with URI %s and name %s" , volumeRes . getId ( ) , volumeRes . getLabel ( ) ) ) ; Map < String , List < String > > initiatorTargetMap = volumeToInitiatorTargetMapFromAttachResponse . get ( volumeRes ) ; Set < String > initiatorKeysSet = initiatorTargetMap . keySet ( ) ; for ( String initiatorKey : initiatorKeysSet ) { List < String > filteredTargetList = filterTargetsFromResponse ( varrayTaggedPortWWNs , initiatorTargetMap , initiatorKey ) ; log . info ( String . format ( "For initiator %s accessible storage ports are %s " , initiatorKey , filteredTargetList . toString ( ) ) ) ; List < String > tmpTargetList = null ; if ( ! isVplex ( volumeRes ) ) { tmpTargetList = checkPathsPerInitiator ( pathsPerInitiator , filteredTargetList ) ; if ( null == tmpTargetList ) { throw new Exception ( String . format ( "Paths per initiator criteria is not met for the initiator : %s " + " Target counts is: %s Expected paths per initiator is: %s" , initiatorKey , String . valueOf ( filteredTargetList . size ( ) ) , String . valueOf ( pathsPerInitiator ) ) ) ; } } else { tmpTargetList = filteredTargetList ; } populateInitiatorTargetURIMap ( mapFilteredInitiatorURIVsTargetURIList , initiatorsWWNVsURI , mapVarrayTaggedPortWWNVsURI , initiatorKey , tmpTargetList ) ; } } List < URI > storagePortListFromMask = StringSetUtil . stringSetToUriList ( exportMask . getStoragePorts ( ) ) ; for ( URI removeUri : storagePortListFromMask ) { exportMask . removeTarget ( removeUri ) ; } exportMask . setStoragePorts ( null ) ; Set < URI > initiatorURIKeys = mapFilteredInitiatorURIVsTargetURIList . keySet ( ) ; for ( URI initiatorURI : initiatorURIKeys ) { List < URI > storagePortURIList = mapFilteredInitiatorURIVsTargetURIList . get ( initiatorURI ) ; for ( URI portURI : storagePortURIList ) { exportMask . addTarget ( portURI ) ; } } log . debug ( "END - updateTargetsInExportMask" ) ; }
updates the initiator to target list map in the export mask
