public Partition addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) {
    if (disks == null || disks.size() == 0) {
      throw new IllegalArgumentException("Disks either null or of zero length.");
    }

    Partition partition =
        new Partition(getNewPartitionId(), partitionClass, PartitionState.READ_WRITE, replicaCapacityInBytes);
    for (Disk disk : disks) {
      partition.addReplica(new Replica(partition, disk, hardwareLayout.getClusterMapConfig()));
    }
    addPartition(partition);
    validate();
    partitionSelectionHelper.updatePartitions(partitionMap.values(), localDatacenterName);

    return partition;
  }
Adds Partition to and validates Partition is unique. A duplicate Partition results in an exception.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/PartitionLayout.java