private Map<URI,List<URI>> internalAssignStoragePorts(StorageSystem system,URI varray,List<Initiator> newInitiators,Collection<URI> volumeURIs,ExportPathParams pathParams,StringSetMap existingZoningMap){
  checkPathParams(pathParams,system);
  _log.info(String.format("Assigning Ports for Array %s params %s Varray %s",system.getNativeGuid(),pathParams.toString(),varray));
  Map<Initiator,List<StoragePort>> existingAssignments=generateInitiatorsToStoragePortsMap(existingZoningMap,varray);
  Map<NetworkLite,List<Initiator>> initiatorsByNetwork=getInitiatorsByNetwork(newInitiators,existingZoningMap,_dbClient);
  Map<Initiator,NetworkLite> initiatorsToNetworkLiteMap=getInitiatorToNetworkLiteMap(initiatorsByNetwork);
  Map<NetworkLite,List<StoragePort>> portsByNetwork=selectStoragePortsInNetworks(system.getId(),initiatorsByNetwork.keySet(),varray,pathParams);
  Map<NetworkLite,List<StoragePort>> allocatedPorts=allocatePorts(system,varray,initiatorsByNetwork,portsByNetwork,volumeURIs,pathParams,existingZoningMap);
  StoragePortsAssigner assigner=StoragePortsAssignerFactory.getAssigner(system.getSystemType());
  Map<Initiator,List<StoragePort>> assignments=new HashMap<Initiator,List<StoragePort>>();
  Map<URI,Map<URI,List<Initiator>>> hostsToNetToInitiators=getHostInitiatorsMapFromNetworkLite(initiatorsByNetwork);
  Map<URI,List<StoragePort>> allocatedPortsMap=getAllocatedPortsMap(allocatedPorts);
  for (  URI hostURI : hostsToNetToInitiators.keySet()) {
    assigner.assignPortsToHost(assignments,hostsToNetToInitiators.get(hostURI),allocatedPortsMap,pathParams,existingAssignments,hostURI,initiatorsToNetworkLiteMap);
  }
  validateMinPaths(system,pathParams,existingAssignments,assignments,newInitiators);
  return convertAssignmentsToURIs(assignments);
}

private Map < URI , List < URI > > internalAssignStoragePorts ( StorageSystem system , URI varray , List < Initiator > newInitiators , Collection < URI > volumeURIs , ExportPathParams pathParams , StringSetMap existingZoningMap ) { checkPathParams ( pathParams , system ) ; _log . info ( String . format ( "Assigning Ports for Array %s params %s Varray %s" , system . getNativeGuid ( ) , pathParams . toString ( ) , varray ) ) ; Map < Initiator , List < StoragePort > > existingAssignments = generateInitiatorsToStoragePortsMap ( existingZoningMap , varray ) ; Map < NetworkLite , List < Initiator > > initiatorsByNetwork = getInitiatorsByNetwork ( newInitiators , existingZoningMap , _dbClient ) ; Map < Initiator , NetworkLite > initiatorsToNetworkLiteMap = getInitiatorToNetworkLiteMap ( initiatorsByNetwork ) ; Map < NetworkLite , List < StoragePort > > portsByNetwork = selectStoragePortsInNetworks ( system . getId ( ) , initiatorsByNetwork . keySet ( ) , varray , pathParams ) ; Map < NetworkLite , List < StoragePort > > allocatedPorts = allocatePorts ( system , varray , initiatorsByNetwork , portsByNetwork , volumeURIs , pathParams , existingZoningMap ) ; StoragePortsAssigner assigner = StoragePortsAssignerFactory . getAssigner ( system . getSystemType ( ) ) ; Map < Initiator , List < StoragePort > > assignments = new HashMap < Initiator , List < StoragePort > > ( ) ; Map < URI , Map < URI , List < Initiator > > > hostsToNetToInitiators = getHostInitiatorsMapFromNetworkLite ( initiatorsByNetwork ) ; Map < URI , List < StoragePort > > allocatedPortsMap = getAllocatedPortsMap ( allocatedPorts ) ; for ( URI hostURI : hostsToNetToInitiators . keySet ( ) ) { assigner . assignPortsToHost ( assignments , hostsToNetToInitiators . get ( hostURI ) , allocatedPortsMap , pathParams , existingAssignments , hostURI , initiatorsToNetworkLiteMap ) ; } validateMinPaths ( system , pathParams , existingAssignments , assignments , newInitiators ) ; return convertAssignmentsToURIs ( assignments ) ; }
allocates and assigns storageports .
