Set<DiskId> maybeRestoreDiskAvailability() {
    List<DiskId> allDiskIds = currentNode.getDiskIds();
    Set<DiskId> failedDiskIds = allDiskIds.stream()
        .filter(diskId -> diskId.getState() == HardwareState.UNAVAILABLE)
        .collect(Collectors.toSet());
    if (!storeConfig.storeRestoreUnavailableDiskInFullAuto || !clusterMap.isDataNodeInFullAutoMode(currentNode)) {
      return failedDiskIds;
    }
    // We should try to restore the availability of failed disks
    if (!failedDiskIds.isEmpty()) {
      List<DiskId> disksToRecover = new ArrayList<>();
      for (DiskId diskId : failedDiskIds) {
        // If the mount path exist and is a directory, it's likely disk is already recovered
        File mount = new File(diskId.getMountPath());
        if (mount.exists() && mount.isDirectory()) {
          disksToRecover.add(diskId);
        }
      }
      if (!disksToRecover.isEmpty()) {
        // We can set the disk available again
        if (!primaryClusterParticipant.setDisksState(disksToRecover, HardwareState.AVAILABLE)) {
          logger.error("Fail to restore availability for disk " + disksToRecover + ", ignore the error and move on");
          return failedDiskIds;
        } else {
          logger.info("Successfully restore availability for disk " + disksToRecover);
        }
        disksToRecover.forEach(diskId -> diskId.setState(HardwareState.AVAILABLE));
        failedDiskIds.removeAll(disksToRecover);
      }
    }

    int actualCapacityInGB = getCapacityOfHealthyDisks(allDiskIds, failedDiskIds);
    if (!primaryClusterParticipant.updateDiskCapacity(actualCapacityInGB)) {
      throw new IllegalStateException("Failed to update disk capacity to " + actualCapacityInGB);
    }
    logger.info("Successfully update disk capacity to {} when restoring disk availability", actualCapacityInGB);
    return failedDiskIds;
  }
Maybe restore disk's availability and update instance capacity.
@return A set of {@link DiskId}s that are still unavailable.
ambry-store/src/main/java/com/github/ambry/store/StorageManager.java