private List<StoragePort> allocatePorts(StoragePortsAllocator allocator,List<StoragePort> candidatePorts,int portsRequested,NetworkLite net,URI varrayURI){
  Collections.shuffle(candidatePorts);
  if (simulation) {
    StoragePortsAllocator.PortAllocationContext context=StoragePortsAllocator.getPortAllocationContext(net,"arrayX",allocator.getContext());
    for (    StoragePort port : candidatePorts) {
      context.addPort(port,null,null,null,null);
    }
    List<StoragePort> portsAllocated=allocator.allocatePortsForNetwork(portsRequested,context,false,null,false);
    allocator.setContext(context);
    return portsAllocated;
  }
 else {
    Map<StoragePort,Long> sportMap=_blockScheduler.computeStoragePortUsage(candidatePorts);
    List<StoragePort> portsAllocated=allocator.selectStoragePorts(_dbClient,sportMap,net,varrayURI,portsRequested,null,false);
    return portsAllocated;
  }
}

private List < StoragePort > allocatePorts ( StoragePortsAllocator allocator , List < StoragePort > candidatePorts , int portsRequested , NetworkLite net , URI varrayURI ) { Collections . shuffle ( candidatePorts ) ; if ( simulation ) { StoragePortsAllocator . PortAllocationContext context = StoragePortsAllocator . getPortAllocationContext ( net , "arrayX" , allocator . getContext ( ) ) ; for ( StoragePort port : candidatePorts ) { context . addPort ( port , null , null , null , null ) ; } List < StoragePort > portsAllocated = allocator . allocatePortsForNetwork ( portsRequested , context , false , null , false ) ; allocator . setContext ( context ) ; return portsAllocated ; } else { Map < StoragePort , Long > sportMap = _blockScheduler . computeStoragePortUsage ( candidatePorts ) ; List < StoragePort > portsAllocated = allocator . selectStoragePorts ( _dbClient , sportMap , net , varrayURI , portsRequested , null , false ) ; return portsAllocated ; } }
allocates storageports ( in either the simulated or production modes ) .
