class HostMaintenanceModeCheck extends AbstractCheckDescriptor {

  @Override
  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
      throws AmbariException {
    final String clusterName = request.getClusterName();
    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
    Collection<Host> hosts = cluster.getHosts();

    // see if any hosts in the cluster are in MM
    for (Host host : hosts) {
      MaintenanceState maintenanceState = host.getMaintenanceState(cluster.getClusterId());
      if (maintenanceState != MaintenanceState.OFF) {
        prerequisiteCheck.getFailedOn().add(host.getHostName());

        prerequisiteCheck.getFailedDetail().add(
            new HostDetail(host.getHostId(), host.getHostName()));
      }
    }

    // for any host in MM, produce a warning
    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
      PrereqCheckStatus status = request.getUpgradeType() == UpgradeType.HOST_ORDERED ?
          PrereqCheckStatus.FAIL : PrereqCheckStatus.WARNING;
      prerequisiteCheck.setStatus(status);

      String failReason = request.getUpgradeType() == UpgradeType.HOST_ORDERED ?
          getFailReason(KEY_CANNOT_START_HOST_ORDERED, prerequisiteCheck, request) :
          getFailReason(prerequisiteCheck, request);

      prerequisiteCheck.setFailReason(failReason);
    }
  }

  public  HostMaintenanceModeCheck();

}