protected void reshuffleDisksAndMaybeExit(Map<DiskId, List<ReplicaId>> diskToReplicas,
      PartitionFinder partitionFinder, ReplicaPlacementValidator placementValidator) {
    Map<DiskId, Set<String>> disksToPartitions = new HashMap<>();
    for (DiskId currentDisk : diskToReplicas.keySet()) {
      disksToPartitions.put(currentDisk, partitionFinder.findPartitionsOnDisk(currentDisk));
    }

    Map<DiskId, DiskId> disksToReshuffle = placementValidator.reshuffleDisks(diskToReplicas, disksToPartitions);
    if (!disksToReshuffle.isEmpty()) {
      logger.info("Disks need to be reshuffled: {}", disksToReshuffle);
      if (primaryClusterParticipant.setDisksOrder(disksToReshuffle)) {
        logger.info("Successfully reshuffled disks. Now terminating"
            + " the process so we can restart with the new disk order.");
        System.exit(1);
      } else {
        logger.error("Failed to reshuffle disks - continuing with the current disk order.");
      }
    }
  }
Checks whether the replicas are placed on the correct disks. If not, reshuffle the disks, write
the new state to Helix and exit. We assume that this ambry-server instance will then be restarted with the
new disk order that we saved to Helix.
@param diskToReplicas A map of disks to the replicas on those disks.
ambry-store/src/main/java/com/github/ambry/store/StorageManager.java