You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/01/20 01:05:23 UTC

[2/2] ambari git commit: AMBARI-9102. Refactor rolling upgrades prerequisite checks to expose and repackage utility classes (rlevas)

AMBARI-9102. Refactor rolling upgrades prerequisite checks to expose and repackage utility classes (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7e691292
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7e691292
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7e691292

Branch: refs/heads/trunk
Commit: 7e691292ad2323341e77a5399db388ca0128387c
Parents: a902c53
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Jan 19 19:04:57 2015 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Jan 19 19:04:57 2015 -0500

----------------------------------------------------------------------
 .../server/checks/AbstractCheckDescriptor.java  |  86 ++++
 .../server/checks/HostsHeartbeatCheck.java      |  60 +++
 .../checks/HostsMasterMaintenanceCheck.java     |  73 +++
 .../checks/HostsRepositoryVersionCheck.java     |  72 +++
 .../checks/ServicesDecommissionCheck.java       |  62 +++
 .../ServicesJobsDistributedCacheCheck.java      |  72 +++
 .../checks/ServicesMaintenanceModeCheck.java    |  59 +++
 .../ServicesNamenodeHighAvailabilityCheck.java  |  63 +++
 .../ambari/server/checks/ServicesUpCheck.java   |  62 +++
 .../checks/ServicesYarnWorkPreservingCheck.java |  70 +++
 .../controller/PreUpgradeCheckRequest.java      |  43 --
 .../server/controller/PrereqCheckRequest.java   |  43 ++
 .../PreUpgradeCheckResourceProvider.java        |  68 ++-
 .../apache/ambari/server/state/CheckHelper.java |  72 +++
 .../ambari/server/state/UpgradeCheckHelper.java | 497 -------------------
 .../server/state/stack/PrereqCheckStatus.java   |  26 +
 .../server/state/stack/PrereqCheckType.java     |  27 +
 .../server/state/stack/PrerequisiteCheck.java   |  82 +++
 .../state/stack/upgrade/UpgradeCheck.java       |  82 ---
 .../state/stack/upgrade/UpgradeCheckStatus.java |  26 -
 .../state/stack/upgrade/UpgradeCheckType.java   |  27 -
 .../ambari/server/state/CheckHelperTest.java    | 134 +++++
 .../server/state/UpgradeCheckHelperTest.java    | 135 -----
 23 files changed, 1117 insertions(+), 824 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
new file mode 100644
index 0000000..f49e666
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.dao.HostVersionDAO;
+import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+/**
+ * Describes prerequisite check.
+ */
+public abstract class AbstractCheckDescriptor {
+
+  public final String id;
+  public final String description;
+  public final PrereqCheckType type;
+
+  @Inject
+  Provider<Clusters> clustersProvider;
+
+  @Inject
+  Provider<Configuration> configurationProvider;
+
+  @Inject
+  Provider<HostVersionDAO> hostVersionDaoProvider;
+
+  @Inject
+  Provider<RepositoryVersionDAO> repositoryVersionDaoProvider;
+
+  /**
+   * Constructor.
+   *
+   * @param id unique identifier
+   * @param type type
+   * @param description description
+   */
+  public AbstractCheckDescriptor(String id, PrereqCheckType type, String description) {
+    this.id = id;
+    this.type = type;
+    this.description = description;
+  }
+
+  /**
+   * Tests if the prerequisite check is applicable to given cluster. By default returns true.
+   *
+   * @param request prerequisite check request
+   * @return true if check should be performed
+   *
+   * @throws org.apache.ambari.server.AmbariException if server error happens
+   */
+  public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+    return true;
+  }
+
+  /**
+   * Executes check against given cluster.
+   *
+   * @param prerequisiteCheck dto for upgrade check results
+   * @param request pre upgrade check request
+   *
+   * @throws AmbariException if server error happens
+   */
+  public abstract void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsHeartbeatCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsHeartbeatCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsHeartbeatCheck.java
new file mode 100644
index 0000000..917cbac
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsHeartbeatCheck.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Host;
+import org.apache.ambari.server.state.HostHealthStatus;
+import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.Map;
+
+/**
+ * Checks that all hosts are either in maintenance mode or heartbeating with the server.
+ */
+public class HostsHeartbeatCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public HostsHeartbeatCheck() {
+    super("HOSTS_HEARTBEAT", PrereqCheckType.HOST, "All hosts must be heartbeating with the server unless they are in Maintenance Mode");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
+    for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
+      final Host host = hostEntry.getValue();
+      if (host.getHealthStatus().getHealthStatus() == HostHealthStatus.HealthStatus.UNKNOWN && host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.OFF) {
+        prerequisiteCheck.getFailedOn().add(host.getHostName());
+      }
+    }
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Some hosts are not heartbeating with the server");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
new file mode 100644
index 0000000..ba5e804
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.stack.HostsType;
+import org.apache.ambari.server.stack.MasterHostResolver;
+import org.apache.ambari.server.state.*;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Checks that all hosts in maintenance state do not have master components.
+ */
+public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public HostsMasterMaintenanceCheck() {
+    super("HOSTS_MASTER_MAINTENANCE", PrereqCheckType.HOST, "Hosts in Maintenance Mode must not have any master components");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final MasterHostResolver masterHostResolver = new MasterHostResolver(cluster);
+    final Set<String> hostsWithMasterComponent = new HashSet<String>();
+    for (Map.Entry<String, Service> serviceEntry: cluster.getServices().entrySet()) {
+      final Service service = serviceEntry.getValue();
+      for (Map.Entry<String, ServiceComponent> serviceComponentEntry: service.getServiceComponents().entrySet()) {
+        final ServiceComponent serviceComponent = serviceComponentEntry.getValue();
+        final HostsType hostsType = masterHostResolver.getMasterAndHosts(service.getName(), serviceComponent.getName());
+        if (hostsType != null && hostsType.master != null) {
+          hostsWithMasterComponent.add(hostsType.master);
+        }
+      }
+    }
+    final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
+    for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
+      final Host host = hostEntry.getValue();
+      if (host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.ON && hostsWithMasterComponent.contains(host.getHostName())) {
+        prerequisiteCheck.getFailedOn().add(host.getHostName());
+      }
+    }
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Some hosts with master components are in Maintenance Mode");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
new file mode 100644
index 0000000..267c625
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Host;
+import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.Map;
+
+/**
+ * Checks that all hosts have particular repository version.
+ */
+public class HostsRepositoryVersionCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public HostsRepositoryVersionCheck() {
+    super("HOSTS_REPOSITORY_VERSION", PrereqCheckType.HOST, "Hosts should have the new repository version installed");
+  }
+
+  @Override
+  public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+    return request.getRepositoryVersion() != null;
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
+    for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
+      final Host host = hostEntry.getValue();
+      if (host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.OFF) {
+        final RepositoryVersionEntity repositoryVersion = repositoryVersionDaoProvider.get().findByDisplayName(request.getRepositoryVersion());
+        final HostVersionEntity hostVersion = hostVersionDaoProvider.get().findByClusterStackVersionAndHost(clusterName, repositoryVersion.getStack(), repositoryVersion.getVersion(), host.getHostName());
+        if (hostVersion == null || hostVersion.getState() != RepositoryVersionState.INSTALLED) {
+          prerequisiteCheck.getFailedOn().add(host.getHostName());
+        }
+      }
+    }
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Some hosts do not have repository version " + request.getRepositoryVersion() + " installed");
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesDecommissionCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesDecommissionCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesDecommissionCheck.java
new file mode 100644
index 0000000..1bea93c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesDecommissionCheck.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.*;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+
+import java.util.Map;
+
+/**
+ * Checks that there are no services in decommission state.
+ */
+public class ServicesDecommissionCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public ServicesDecommissionCheck() {
+    super("SERVICES_DECOMMISSION", PrereqCheckType.SERVICE, "Services should not be in Decommission state");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    for (Map.Entry<String, Service> serviceEntry: cluster.getServices().entrySet()) {
+      final Service service = serviceEntry.getValue();
+      for (Map.Entry<String, ServiceComponent> serviceComponentEntry: service.getServiceComponents().entrySet()) {
+        final ServiceComponent serviceComponent = serviceComponentEntry.getValue();
+        for (String hostName : serviceComponent.getServiceComponentHosts().keySet()) {
+          final ServiceComponentHost scHost = serviceComponent.getServiceComponentHost(hostName);
+          if (scHost.getComponentAdminState() == HostComponentAdminState.DECOMMISSIONED || scHost.getComponentAdminState() == HostComponentAdminState.DECOMMISSIONING) {
+            prerequisiteCheck.getFailedOn().add(serviceComponent.getName());
+          }
+        }
+      }
+    }
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("There are services in decommission or decommissioning state");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesJobsDistributedCacheCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesJobsDistributedCacheCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesJobsDistributedCacheCheck.java
new file mode 100644
index 0000000..d7dec99
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesJobsDistributedCacheCheck.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.Map;
+
+/**
+ * Checks that MR, Oozie and Tez jobs reference hadoop libraries from the distributed cache.
+ */
+public class ServicesJobsDistributedCacheCheck extends AbstractCheckDescriptor {
+
+  @Override
+  public boolean isApplicable(PrereqCheckRequest request)
+    throws AmbariException {
+    final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+    try {
+      cluster.getService("YARN");
+    } catch (ServiceNotFoundException ex) {
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Constructor.
+   */
+  public ServicesJobsDistributedCacheCheck() {
+    super("SERVICES_JOBS_DISTRIBUTED_CACHE", PrereqCheckType.SERVICE, "Jobs should reference hadoop libraries from the distributed cache");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final String configType = "mapred-site";
+    final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    final DesiredConfig desiredConfig = desiredConfigs.get(configType);
+    final Config config = cluster.getConfig(configType, desiredConfig.getTag());
+    if (!config.getProperties().containsKey("mapreduce.application.framework.path") || !config.getProperties().containsKey("mapreduce.application.classpath")) {
+      // TODO actually it is needed to validate that these properties contain proper values but the tickets for these changes are still open, so it will cause
+      // prerequisite checks to fail
+      prerequisiteCheck.getFailedOn().add("MR");
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("mapreduce.application.framework.path and mapreduce.application.classpath should reference distributed cache");
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
new file mode 100644
index 0000000..c448ec3
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.Map;
+
+/**
+ * Checks that services are in the maintenance mode.
+ */
+public class ServicesMaintenanceModeCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public ServicesMaintenanceModeCheck() {
+    super("SERVICES_MAINTENANCE_MODE", PrereqCheckType.SERVICE, "No service can be in maintenance mode");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
+      final Service service = serviceEntry.getValue();
+      if (service.getDesiredState() != State.STARTED || service.getMaintenanceState() == MaintenanceState.ON) {
+        prerequisiteCheck.getFailedOn().add(service.getName());
+      }
+    }
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Some services are in Maintenance Mode");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
new file mode 100644
index 0000000..ceb61ad
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+
+import java.util.Map;
+
+/**
+ * Checks that namenode high availability is enabled.
+ */
+public class ServicesNamenodeHighAvailabilityCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public ServicesNamenodeHighAvailabilityCheck() {
+    super("SERVICES_NAMENODE_HA", PrereqCheckType.SERVICE, "Namenode high availability should be enabled");
+  }
+
+  @Override
+  public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+    final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+    return cluster.getService("HDFS") != null;
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final String configType = "hdfs-site";
+    final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    final DesiredConfig desiredConfig = desiredConfigs.get(configType);
+    final Config config = cluster.getConfig(configType, desiredConfig.getTag());
+    if (!config.getProperties().containsKey("dfs.nameservices")) {
+      prerequisiteCheck.getFailedOn().add("HDFS");
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Namenode high availability is disabled");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
new file mode 100644
index 0000000..a4a18e6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+
+import java.util.Map;
+
+/**
+ * Checks that services are up.
+ */
+public class ServicesUpCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public ServicesUpCheck() {
+    super("SERVICES_UP", PrereqCheckType.SERVICE, "All services must be up");
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
+
+      final Service service = serviceEntry.getValue();
+
+      if (!service.isClientOnlyService() && service.getDesiredState() != State.STARTED) {
+        prerequisiteCheck.getFailedOn().add(service.getName());
+      }
+    }
+
+    if (!prerequisiteCheck.getFailedOn().isEmpty()) {
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("Some services are down");
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
new file mode 100644
index 0000000..7ab6e01
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrereqCheckType;
+
+import java.util.Map;
+
+/**
+ * Checks that YARN has work-preserving restart enabled.
+ */
+public class ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public ServicesYarnWorkPreservingCheck() {
+    super("SERVICES_YARN_WP", PrereqCheckType.SERVICE, "YARN work preserving restart should be enabled");
+  }
+
+  @Override
+  public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+    final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+    try {
+      cluster.getService("YARN");
+    } catch (ServiceNotFoundException ex) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+    final String configType = "yarn-site";
+    final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    final DesiredConfig desiredConfig = desiredConfigs.get(configType);
+    final Config config = cluster.getConfig(configType, desiredConfig.getTag());
+    if (!config.getProperties().containsKey("yarn.resourcemanager.work-preserving-recovery.enabled") ||
+      !Boolean.getBoolean(config.getProperties().get("yarn.resourcemanager.work-preserving-recovery.enabled"))) {
+      prerequisiteCheck.getFailedOn().add("YARN");
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason("YARN doesn't have work preserving restart, yarn.resourcemanager.work-preserving-recovery.enabled property is missing");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
deleted file mode 100644
index bc7e7f3..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.controller;
-
-/**
- * Represents a pre upgrade request.
- */
-public class PreUpgradeCheckRequest {
-  private final String clusterName;
-  private String repositoryVersion;
-
-  //TODO make repositoryVersionName also final as soon as UI will be changed to always provide it to API
-  public PreUpgradeCheckRequest(String clusterName) {
-    this.clusterName = clusterName;
-  }
-
-  public String getClusterName() {
-    return clusterName;
-  }
-
-  public String getRepositoryVersion() {
-    return repositoryVersion;
-  }
-
-  public void setRepositoryVersion(String repositoryVersion) {
-    this.repositoryVersion = repositoryVersion;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
new file mode 100644
index 0000000..5f33914
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+/**
+ * Represents a prerequisite check request.
+ */
+public class PrereqCheckRequest {
+  private final String clusterName;
+  private String repositoryVersion;
+
+  //TODO make repositoryVersionName also final as soon as UI will be changed to always provide it to API
+  public PrereqCheckRequest(String clusterName) {
+    this.clusterName = clusterName;
+  }
+
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  public String getRepositoryVersion() {
+    return repositoryVersion;
+  }
+
+  public void setRepositoryVersion(String repositoryVersion) {
+    this.repositoryVersion = repositoryVersion;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
index d4ec2de..38cb8c2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
@@ -21,10 +21,14 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.checks.*;
+import org.apache.ambari.server.state.CheckHelper;
 import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.controller.PreUpgradeCheckRequest;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -34,8 +38,7 @@ import org.apache.ambari.server.controller.spi.Resource.Type;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.state.UpgradeCheckHelper;
-import org.apache.ambari.server.state.stack.upgrade.UpgradeCheck;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
 
 import com.google.inject.Inject;
 
@@ -56,6 +59,44 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
   public static final String UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID       = PropertyHelper.getPropertyId("UpgradeChecks", "cluster_name");
   public static final String UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("UpgradeChecks", "repository_version");
 
+  @Inject
+  private static ServicesMaintenanceModeCheck servicesMaintenanceModeCheck;
+  @Inject
+  private static HostsMasterMaintenanceCheck hostsMasterMaintenanceCheck;
+  @Inject
+  private static HostsRepositoryVersionCheck hostsRepositoryVersionCheck;
+  @Inject
+  private static ServicesNamenodeHighAvailabilityCheck servicesNamenodeHighAvailabilityCheck;
+  @Inject
+  private static ServicesYarnWorkPreservingCheck servicesYarnWorkPreservingCheck;
+  @Inject
+  private static ServicesDecommissionCheck servicesDecommissionCheck;
+  @Inject
+  private static ServicesJobsDistributedCacheCheck servicesJobsDistributedCacheCheck;
+  @Inject
+  private static HostsHeartbeatCheck heartbeatCheck;
+  @Inject
+  private static ServicesUpCheck servicesUpCheck;
+
+
+  /**
+   * List of the registered upgrade checks
+   */
+  @SuppressWarnings("serial")
+  private final List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>() {
+    {
+      add(hostsMasterMaintenanceCheck);
+      add(hostsRepositoryVersionCheck);
+      add(servicesMaintenanceModeCheck);
+      add(servicesNamenodeHighAvailabilityCheck);
+      add(servicesYarnWorkPreservingCheck);
+      add(servicesDecommissionCheck);
+      add(servicesJobsDistributedCacheCheck);
+      add(heartbeatCheck);
+      add(servicesUpCheck);
+    }
+  };
+
   @SuppressWarnings("serial")
   private static Set<String> pkPropertyIds = new HashSet<String>() {
     {
@@ -86,7 +127,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
   };
 
   @Inject
-  private static UpgradeCheckHelper upgradeChecks;
+  private static CheckHelper checkHelper;
 
   /**
    * Constructor.
@@ -107,26 +148,25 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
 
     for (Map<String, Object> propertyMap: propertyMaps) {
       final String clusterName = propertyMap.get(UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID).toString();
-      final PreUpgradeCheckRequest upgradeCheckRequest = new PreUpgradeCheckRequest(clusterName);
+      final PrereqCheckRequest upgradeCheckRequest = new PrereqCheckRequest(clusterName);
       if (propertyMap.containsKey(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID)) {
         upgradeCheckRequest.setRepositoryVersion(propertyMap.get(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID).toString());
       }
-      for (UpgradeCheck upgradeCheck: upgradeChecks.performPreUpgradeChecks(upgradeCheckRequest)) {
+      for (PrerequisiteCheck prerequisiteCheck : checkHelper.performChecks(upgradeCheckRequest, updateChecksRegistry)) {
         final Resource resource = new ResourceImpl(Resource.Type.PreUpgradeCheck);
-        setResourceProperty(resource, UPGRADE_CHECK_ID_PROPERTY_ID, upgradeCheck.getId(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_CHECK_PROPERTY_ID, upgradeCheck.getDescription(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_STATUS_PROPERTY_ID, upgradeCheck.getStatus(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_REASON_PROPERTY_ID, upgradeCheck.getFailReason(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_FAILED_ON_PROPERTY_ID, upgradeCheck.getFailedOn(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID, upgradeCheck.getType(), requestedIds);
-        setResourceProperty(resource, UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID, upgradeCheck.getClusterName(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_ID_PROPERTY_ID, prerequisiteCheck.getId(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_CHECK_PROPERTY_ID, prerequisiteCheck.getDescription(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_STATUS_PROPERTY_ID, prerequisiteCheck.getStatus(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_REASON_PROPERTY_ID, prerequisiteCheck.getFailReason(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_FAILED_ON_PROPERTY_ID, prerequisiteCheck.getFailedOn(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID, prerequisiteCheck.getType(), requestedIds);
+        setResourceProperty(resource, UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID, prerequisiteCheck.getClusterName(), requestedIds);
         if (upgradeCheckRequest.getRepositoryVersion() != null) {
           setResourceProperty(resource, UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID, upgradeCheckRequest.getRepositoryVersion(), requestedIds);
         }
         resources.add(resource);
       }
     }
-
     return resources;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
new file mode 100644
index 0000000..f4b0b52
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.state;
+
+import com.google.inject.Singleton;
+import org.apache.ambari.server.ClusterNotFoundException;
+import org.apache.ambari.server.checks.AbstractCheckDescriptor;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Singleton
+public class CheckHelper {
+  /**
+   * Log.
+   */
+  private static Logger LOG = LoggerFactory.getLogger(CheckHelper.class);
+
+
+  /**
+   * Executes all registered pre-requisite checks.
+   *
+   * @param request pre-requisite check request
+   * @return list of pre-requisite check results
+   */
+  public List<PrerequisiteCheck> performChecks(PrereqCheckRequest request, List<AbstractCheckDescriptor> checksRegistry) {
+
+    final String clusterName = request.getClusterName();
+    final List<PrerequisiteCheck> prerequisiteCheckResults = new ArrayList<PrerequisiteCheck>();
+    for (AbstractCheckDescriptor checkDescriptor : checksRegistry) {
+      final PrerequisiteCheck prerequisiteCheck = new PrerequisiteCheck(
+        checkDescriptor.id, checkDescriptor.description,
+        checkDescriptor.type, clusterName);
+      try {
+        if (checkDescriptor.isApplicable(request)) {
+          checkDescriptor.perform(prerequisiteCheck, request);
+          prerequisiteCheckResults.add(prerequisiteCheck);
+        }
+      } catch (ClusterNotFoundException ex) {
+        prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+        prerequisiteCheck.setFailReason("Cluster with name " + clusterName + " doesn't exists");
+        prerequisiteCheckResults.add(prerequisiteCheck);
+      } catch (Exception ex) {
+        LOG.error("Check " + checkDescriptor.id + " failed", ex);
+        prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+        prerequisiteCheck.setFailReason("Unexpected server error happened");
+        prerequisiteCheckResults.add(prerequisiteCheck);
+      }
+    }
+    return prerequisiteCheckResults;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
deleted file mode 100644
index d3b2df2..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.state;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ClusterNotFoundException;
-import org.apache.ambari.server.ServiceNotFoundException;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.controller.PreUpgradeCheckRequest;
-import org.apache.ambari.server.orm.dao.HostVersionDAO;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
-import org.apache.ambari.server.orm.entities.HostVersionEntity;
-import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.stack.HostsType;
-import org.apache.ambari.server.stack.MasterHostResolver;
-import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
-import org.apache.ambari.server.state.stack.upgrade.UpgradeCheck;
-import org.apache.ambari.server.state.stack.upgrade.UpgradeCheckStatus;
-import org.apache.ambari.server.state.stack.upgrade.UpgradeCheckType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-
-/**
- * Manages pre-upgrade checks.
- */
-@Singleton
-public class UpgradeCheckHelper {
-
-  /**
-   * Log.
-   */
-  private static Logger LOG = LoggerFactory.getLogger(UpgradeCheckHelper.class);
-
-  /**
-   * List of all possible upgrade checks.
-   */
-  final List<UpgradeCheckDescriptor> registry = new ArrayList<UpgradeCheckDescriptor>();
-
-  @Inject
-  Provider<Clusters> clustersProvider;
-
-  @Inject
-  Provider<Configuration> configurationProvider;
-
-  @Inject
-  Provider<HostVersionDAO> hostVersionDaoProvider;
-
-  @Inject
-  Provider<RepositoryVersionDAO> repositoryVersionDaoProvider;
-
-  /**
-   * Constructor. Fills upgrade check registry upon creation.
-   */
-  public UpgradeCheckHelper() {
-    registry.add(new HostsHeartbeatCheck());
-    registry.add(new HostsMasterMaintenanceCheck());
-    registry.add(new HostsRepositoryVersionCheck());
-    registry.add(new ServicesUpCheck());
-    registry.add(new ServicesMaintenanceModeCheck());
-    registry.add(new ServicesNamenodeHighAvailabilityCheck());
-    registry.add(new ServicesYarnWorkPreservingCheck());
-    registry.add(new ServicesDecommissionCheck());
-    registry.add(new ServicesJobsDistributedCacheCheck());
-  }
-
-  /**
-   * Executes all registered pre upgrade checks.
-   *
-   * @param request pre upgrade check request
-   * @return list of upgrade check results
-   */
-  public List<UpgradeCheck> performPreUpgradeChecks(PreUpgradeCheckRequest request) {
-    final String clusterName = request.getClusterName();
-    final List<UpgradeCheck> upgradeCheckResults = new ArrayList<UpgradeCheck>();
-    for (UpgradeCheckDescriptor upgradeCheckDescriptor: registry) {
-      final UpgradeCheck upgradeCheck = new UpgradeCheck(
-          upgradeCheckDescriptor.id, upgradeCheckDescriptor.description,
-          upgradeCheckDescriptor.type, clusterName);
-      try {
-        if (upgradeCheckDescriptor.isApplicable(request)) {
-          upgradeCheckDescriptor.perform(upgradeCheck, request);
-          upgradeCheckResults.add(upgradeCheck);
-        }
-      } catch (ClusterNotFoundException ex) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Cluster with name " + clusterName + " doesn't exists");
-        upgradeCheckResults.add(upgradeCheck);
-      } catch (Exception ex) {
-        LOG.error("Pre-upgrade check " + upgradeCheckDescriptor.id + " failed", ex);
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Unexpected server error happened");
-        upgradeCheckResults.add(upgradeCheck);
-      }
-    }
-    return upgradeCheckResults;
-  }
-
-  /**
-   * Describes upgrade check.
-   */
-  protected abstract class UpgradeCheckDescriptor {
-
-    private final String id;
-    private final String description;
-    private final UpgradeCheckType type;
-
-    /**
-     * Constructor.
-     *
-     * @param id unique identifier
-     * @param type type
-     * @param description description
-     */
-    public UpgradeCheckDescriptor(String id, UpgradeCheckType type, String description) {
-      this.id = id;
-      this.type = type;
-      this.description = description;
-    }
-
-    /**
-     * Tests if the upgrade check is applicable to given cluster. By default returns true.
-     *
-     * @param request pre upgrade check request
-     * @return true if check should be performed
-     *
-     * @throws AmbariException if server error happens
-     */
-    public boolean isApplicable(PreUpgradeCheckRequest request) throws AmbariException {
-      return true;
-    }
-
-    /**
-     * Executes check against given cluster.
-     *
-     * @param upgradeCheck dto for upgrade check results
-     * @param request pre upgrade check request
-     *
-     * @throws AmbariException if server error happens
-     */
-    public abstract void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException;
-  }
-
-  /**
-   * Checks that services are up.
-   */
-  protected class ServicesUpCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public ServicesUpCheck() {
-      super("SERVICES_UP", UpgradeCheckType.SERVICE, "All services must be up");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
-        final Service service = serviceEntry.getValue();
-        if (!service.isClientOnlyService() && service.getDesiredState() != State.STARTED) {
-          upgradeCheck.getFailedOn().add(service.getName());
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some services are down");
-      }
-    }
-  }
-
-  /**
-   * Checks that services are in the maintenance mode.
-   */
-  protected class ServicesMaintenanceModeCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public ServicesMaintenanceModeCheck() {
-      super("SERVICES_MAINTENANCE_MODE", UpgradeCheckType.SERVICE, "No service can be in maintenance mode");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
-        final Service service = serviceEntry.getValue();
-        if (service.getMaintenanceState() == MaintenanceState.ON) {
-          upgradeCheck.getFailedOn().add(service.getName());
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some services are in Maintenance Mode");
-      }
-    }
-  }
-
-  /**
-   * Checks that all hosts are either in maintenance mode or heartbeating with the server.
-   */
-  protected class HostsHeartbeatCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public HostsHeartbeatCheck() {
-      super("HOSTS_HEARTBEAT", UpgradeCheckType.HOST, "All hosts must be heartbeating with the server unless they are in Maintenance Mode");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
-      for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
-        final Host host = hostEntry.getValue();
-        if (host.getHealthStatus().getHealthStatus() == HealthStatus.UNKNOWN && host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.OFF) {
-          upgradeCheck.getFailedOn().add(host.getHostName());
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some hosts are not heartbeating with the server");
-      }
-    }
-  }
-
-  /**
-   * Checks that all hosts in maintenance state do not have master components.
-   */
-  protected class HostsMasterMaintenanceCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public HostsMasterMaintenanceCheck() {
-      super("HOSTS_MASTER_MAINTENANCE", UpgradeCheckType.HOST, "Hosts in Maintenance Mode must not have any master components");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final MasterHostResolver masterHostResolver = new MasterHostResolver(cluster,
-          request.getRepositoryVersion());
-      final Set<String> hostsWithMasterComponent = new HashSet<String>();
-      for (Entry<String, Service> serviceEntry: cluster.getServices().entrySet()) {
-        final Service service = serviceEntry.getValue();
-        for (Entry<String, ServiceComponent> serviceComponentEntry: service.getServiceComponents().entrySet()) {
-          final ServiceComponent serviceComponent = serviceComponentEntry.getValue();
-          final HostsType hostsType = masterHostResolver.getMasterAndHosts(
-              service.getName(), serviceComponent.getName());
-          if (hostsType != null && hostsType.master != null) {
-            hostsWithMasterComponent.add(hostsType.master);
-          }
-        }
-      }
-      final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
-      for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
-        final Host host = hostEntry.getValue();
-        if (host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.ON && hostsWithMasterComponent.contains(host.getHostName())) {
-          upgradeCheck.getFailedOn().add(host.getHostName());
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some hosts with master components are in Maintenance Mode");
-      }
-    }
-  }
-
-  /**
-   * Checks that all hosts have particular repository version.
-   */
-  protected class HostsRepositoryVersionCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public HostsRepositoryVersionCheck() {
-      super("HOSTS_REPOSITORY_VERSION", UpgradeCheckType.HOST, "Hosts should have the new repository version installed");
-    }
-
-    @Override
-    public boolean isApplicable(PreUpgradeCheckRequest request) throws AmbariException {
-      return request.getRepositoryVersion() != null;
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
-      final StackId stackId = cluster.getDesiredStackVersion();
-      final RepositoryVersionEntity repositoryVersion = repositoryVersionDaoProvider.get().findByStackAndVersion(stackId.getStackId(), request.getRepositoryVersion());
-      if (repositoryVersion == null) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Repository version " + request.getRepositoryVersion() + " doesn't exist");
-        upgradeCheck.getFailedOn().addAll(clusterHosts.keySet());
-        return;
-      }
-      for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
-        final Host host = hostEntry.getValue();
-        if (host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.OFF) {
-          final HostVersionEntity hostVersion = hostVersionDaoProvider.get().findByClusterStackVersionAndHost(clusterName, repositoryVersion.getStack(), repositoryVersion.getVersion(), host.getHostName());
-          if (hostVersion == null || hostVersion.getState() != RepositoryVersionState.INSTALLED) {
-            upgradeCheck.getFailedOn().add(host.getHostName());
-          }
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some hosts do not have repository version " + request.getRepositoryVersion() + " installed");
-      }
-    }
-  }
-
-  /**
-   * Checks that namenode high availability is enabled.
-   */
-  protected class ServicesNamenodeHighAvailabilityCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public ServicesNamenodeHighAvailabilityCheck() {
-      super("SERVICES_NAMENODE_HA", UpgradeCheckType.SERVICE, "Namenode high availability should be enabled");
-    }
-
-    @Override
-    public boolean isApplicable(PreUpgradeCheckRequest request) throws AmbariException {
-      final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
-      return cluster.getService("HDFS") != null;
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final String configType = "hdfs-site";
-      final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
-      final DesiredConfig desiredConfig = desiredConfigs.get(configType);
-      final Config config = cluster.getConfig(configType, desiredConfig.getTag());
-      if (!config.getProperties().containsKey("dfs.nameservices")) {
-        upgradeCheck.getFailedOn().add("HDFS");
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Namenode high availability is disabled");
-      }
-    }
-  }
-
-  /**
-   * Checks that YARN has work-preserving restart enabled.
-   */
-  protected class ServicesYarnWorkPreservingCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public ServicesYarnWorkPreservingCheck() {
-      super("SERVICES_YARN_WP", UpgradeCheckType.SERVICE, "YARN work preserving restart should be enabled");
-    }
-
-    @Override
-    public boolean isApplicable(PreUpgradeCheckRequest request) throws AmbariException {
-      final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
-      try {
-        cluster.getService("YARN");
-      } catch (ServiceNotFoundException ex) {
-        return false;
-      }
-      return true;
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final String configType = "yarn-site";
-      final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
-      final DesiredConfig desiredConfig = desiredConfigs.get(configType);
-      final Config config = cluster.getConfig(configType, desiredConfig.getTag());
-      if (!config.getProperties().containsKey("yarn.resourcemanager.work-preserving-recovery.enabled") ||
-          !Boolean.getBoolean(config.getProperties().get("yarn.resourcemanager.work-preserving-recovery.enabled"))) {
-        upgradeCheck.getFailedOn().add("YARN");
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("YARN doesn't have work preserving restart, yarn.resourcemanager.work-preserving-recovery.enabled property is missing");
-      }
-    }
-  }
-
-  /**
-   * Checks that there are no services in decommission state.
-   */
-  protected class ServicesDecommissionCheck extends UpgradeCheckDescriptor {
-
-    /**
-     * Constructor.
-     */
-    public ServicesDecommissionCheck() {
-      super("SERVICES_DECOMMISSION", UpgradeCheckType.SERVICE, "Services should not be in Decommission state");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      for (Entry<String, Service> serviceEntry: cluster.getServices().entrySet()) {
-        final Service service = serviceEntry.getValue();
-        for (Entry<String, ServiceComponent> serviceComponentEntry: service.getServiceComponents().entrySet()) {
-          final ServiceComponent serviceComponent = serviceComponentEntry.getValue();
-          for (String hostName : serviceComponent.getServiceComponentHosts().keySet()) {
-            final ServiceComponentHost scHost = serviceComponent.getServiceComponentHost(hostName);
-            if (scHost.getComponentAdminState() == HostComponentAdminState.DECOMMISSIONED || scHost.getComponentAdminState() == HostComponentAdminState.DECOMMISSIONING) {
-              upgradeCheck.getFailedOn().add(serviceComponent.getName());
-            }
-          }
-        }
-      }
-      if (!upgradeCheck.getFailedOn().isEmpty()) {
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("There are services in decommission or decommissioning state");
-      }
-    }
-  }
-
-  /**
-   * Checks that MR, Oozie and Tez jobs reference hadoop libraries from the distributed cache.
-   */
-  protected class ServicesJobsDistributedCacheCheck extends UpgradeCheckDescriptor {
-
-    @Override
-    public boolean isApplicable(PreUpgradeCheckRequest request)
-        throws AmbariException {
-      final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
-      try {
-        cluster.getService("YARN");
-      } catch (ServiceNotFoundException ex) {
-        return false;
-      }
-      return true;
-    }
-
-    /**
-     * Constructor.
-     */
-    public ServicesJobsDistributedCacheCheck() {
-      super("SERVICES_JOBS_DISTRIBUTED_CACHE", UpgradeCheckType.SERVICE, "Jobs should reference hadoop libraries from the distributed cache");
-    }
-
-    @Override
-    public void perform(UpgradeCheck upgradeCheck, PreUpgradeCheckRequest request) throws AmbariException {
-      final String clusterName = request.getClusterName();
-      final Cluster cluster = clustersProvider.get().getCluster(clusterName);
-      final String configType = "mapred-site";
-      final Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
-      final DesiredConfig desiredConfig = desiredConfigs.get(configType);
-      final Config config = cluster.getConfig(configType, desiredConfig.getTag());
-      if (!config.getProperties().containsKey("mapreduce.application.framework.path") || !config.getProperties().containsKey("mapreduce.application.classpath")) {
-        // TODO actually it is needed to validate that these properties contain proper values but the tickets for these changes are still open, so it will cause
-        // preupgrade checks to fail
-        upgradeCheck.getFailedOn().add("MR");
-        upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("mapreduce.application.framework.path and mapreduce.application.classpath should reference distributed cache");
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckStatus.java
new file mode 100644
index 0000000..3384b85
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckStatus.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.state.stack;
+
+/**
+ * Indicates status of prerequisite check.
+ */
+public enum PrereqCheckStatus {
+  PASS,
+  FAIL
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckType.java
new file mode 100644
index 0000000..e70cbdc
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrereqCheckType.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.state.stack;
+
+/**
+ * Type of prerequisite check.
+ */
+public enum PrereqCheckType {
+  SERVICE,
+  HOST,
+  CLUSTER
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrerequisiteCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrerequisiteCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrerequisiteCheck.java
new file mode 100644
index 0000000..4ed2fb3
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/PrerequisiteCheck.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.state.stack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Contains information about performed prerequisite check.
+ *
+ */
+public class PrerequisiteCheck {
+  private final String id;
+  private final String description;
+  private final PrereqCheckType type;
+  private final String clusterName;
+  private PrereqCheckStatus status = PrereqCheckStatus.PASS;
+  private String failReason = "";
+  private List<String> failedOn = new ArrayList<String>();
+
+  public PrerequisiteCheck(String id, String description, PrereqCheckType type, String clusterName) {
+    this.id = id;
+    this.description = description;
+    this.type = type;
+    this.clusterName = clusterName;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public PrereqCheckStatus getStatus() {
+    return status;
+  }
+
+  public void setStatus(PrereqCheckStatus status) {
+    this.status = status;
+  }
+
+  public String getFailReason() {
+    return failReason;
+  }
+
+  public void setFailReason(String failReason) {
+    this.failReason = failReason;
+  }
+
+  public List<String> getFailedOn() {
+    return failedOn;
+  }
+
+  public void setFailedOn(List<String> failedOn) {
+    this.failedOn = failedOn;
+  }
+
+  public PrereqCheckType getType() {
+    return type;
+  }
+
+  public String getClusterName() {
+    return clusterName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheck.java
deleted file mode 100644
index 80c4bbf..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheck.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.state.stack.upgrade;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Contains information about performed upgrade check.
- *
- */
-public class UpgradeCheck {
-  private final String id;
-  private final String description;
-  private final UpgradeCheckType type;
-  private final String clusterName;
-  private UpgradeCheckStatus status = UpgradeCheckStatus.PASS;
-  private String failReason = "";
-  private List<String> failedOn = new ArrayList<String>();
-
-  public UpgradeCheck(String id, String description, UpgradeCheckType type, String clusterName) {
-    this.id = id;
-    this.description = description;
-    this.type = type;
-    this.clusterName = clusterName;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public UpgradeCheckStatus getStatus() {
-    return status;
-  }
-
-  public void setStatus(UpgradeCheckStatus status) {
-    this.status = status;
-  }
-
-  public String getFailReason() {
-    return failReason;
-  }
-
-  public void setFailReason(String failReason) {
-    this.failReason = failReason;
-  }
-
-  public List<String> getFailedOn() {
-    return failedOn;
-  }
-
-  public void setFailedOn(List<String> failedOn) {
-    this.failedOn = failedOn;
-  }
-
-  public UpgradeCheckType getType() {
-    return type;
-  }
-
-  public String getClusterName() {
-    return clusterName;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckStatus.java
deleted file mode 100644
index ee70525..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckStatus.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.state.stack.upgrade;
-
-/**
- * Indicates status of upgrade check.
- */
-public enum UpgradeCheckStatus {
-  PASS,
-  FAIL
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e691292/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckType.java
deleted file mode 100644
index dfef47e..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/UpgradeCheckType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.state.stack.upgrade;
-
-/**
- * Type of upgrade check.
- */
-public enum UpgradeCheckType {
-  SERVICE,
-  HOST,
-  CLUSTER
-}