List<PartitionId> allocatePartitions(int numPartitions, String partitionClass, int replicaCountPerDatacenter,
      long replicaCapacityInBytes, boolean attemptNonRackAwareOnFailure) {
    ArrayList<PartitionId> partitions = new ArrayList<PartitionId>(numPartitions);
    int partitionsAllocated = 0;
    while (checkEnoughUnallocatedRawCapacity(replicaCountPerDatacenter, replicaCapacityInBytes)
        && partitionsAllocated < numPartitions) {
      List<Disk> disksToAllocate = new ArrayList<>();
      for (Datacenter datacenter : hardwareLayout.getDatacenters()) {
        List<Disk> disks = allocateDisksForPartition(replicaCountPerDatacenter, replicaCapacityInBytes, datacenter,
            attemptNonRackAwareOnFailure);
        disksToAllocate.addAll(disks);
      }
      partitions.add(partitionLayout.addNewPartition(disksToAllocate, replicaCapacityInBytes, partitionClass));
      partitionsAllocated++;
      System.out.println("Allocated " + partitionsAllocated + " new partitions so far.");
    }
    return partitions;
  }
Allocate partitions for {@code numPartitions} new partitions on all datacenters.

@param numPartitions How many partitions to allocate.
@param partitionClass the partition class that the created partitions must be tagged with
@param replicaCountPerDatacenter The number of replicas per partition on each datacenter
@param replicaCapacityInBytes How large each replica (of a partition) should be
@param attemptNonRackAwareOnFailure {@code true} if we should attempt a non rack-aware allocation if a rack-aware
                                    one is not possible.
@return A list of the new {@link PartitionId}s.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/StaticClusterManager.java