private JSONObject addPartitionAndUpdateJsonPartitionLayout(String partitionClass,
        List<DataNode> nodesToHostNewPartition) {
      version += 1;
      int nextPartitionIndex = jsonPartitions.length() + basePartitionId;
      List<Disk> disksToPlaceNewPartition = new ArrayList<>();
      Random random = new Random();
      nodesToHostNewPartition.forEach(
          node -> disksToPlaceNewPartition.add(node.getDisks().get(random.nextInt(node.getDisks().size()))));
      JSONArray jsonReplicas = TestUtils.getJsonArrayReplicas(disksToPlaceNewPartition);
      jsonPartitions.put(
          getJsonPartition(nextPartitionIndex, partitionClass, partitionState, replicaCapacityInBytes, jsonReplicas));
      return getJsonPartitionLayout(testHardwareLayout.getHardwareLayout().getClusterName(), version, partitionCount,
          jsonPartitions);
    }
Return the partition layout as a {@link JSONObject}
@param partitionClass the partition class that these partitions must belong to
@param partitionState the state of the newly created partitions
@return the partition layout as a {@link JSONObject}
@throws JSONException if there is an exception parsing or constructing JSON.
ambry-clustermap/src/test/java/com/github/ambry/clustermap/TestUtils.java