public boolean isOperationAllowed(Host host, long clusterId,
      Resource.Type level) throws AmbariException {
    if (level == Resource.Type.Cluster) {
      return host.getMaintenanceState(clusterId) == MaintenanceState.OFF;
    } else {
      return true;
    }
  }
@param host
         the service
@param clusterId
         cluster the host belongs to
@param level
         operation level for request
@return true if operation may be performed on a given target (based on
        target's maintenance status).
ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java