You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2015/08/21 21:27:28 UTC

ambari git commit: AMBARI-12850 - Downgrades That Are Retried With Unhealthy Hosts Can Produce Multiple Stages In Progress (jonathanhurley)

Repository: ambari
Updated Branches:
  refs/heads/trunk 2ba8d67a4 -> 4ab90629f


AMBARI-12850 - Downgrades That Are Retried With Unhealthy Hosts Can Produce Multiple Stages In Progress  (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: 4ab90629f37a1fe9f817f4a134584035018b879e
Parents: 2ba8d67
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Aug 21 09:42:42 2015 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Aug 21 15:20:46 2015 -0400

----------------------------------------------------------------------
 .../api/services/UpgradeGroupService.java       |   4 +-
 .../internal/StageResourceProvider.java         |  95 +---
 .../internal/UpgradeGroupResourceProvider.java  |   4 +-
 .../internal/UpgradeItemResourceProvider.java   |  48 +-
 .../server/orm/dao/HostRoleCommandDAO.java      |   2 +-
 .../apache/ambari/server/orm/dao/StageDAO.java  |  88 ++++
 .../server/state/cluster/ClusterImpl.java       |  35 +-
 .../svccomphost/ServiceComponentHostImpl.java   | 490 ++++++++++---------
 .../internal/StageResourceProviderTest.java     |  14 +-
 9 files changed, 425 insertions(+), 355 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
index ed97d66..a9aa500 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
@@ -65,14 +65,12 @@ public class UpgradeGroupService extends BaseService {
   }
 
   @Path("{upgradeGroupId}/upgrade_items")
-  public UpgradeItemService getUpgradeItems(
+  public UpgradeItemService getUpgradeItemService(
       @Context HttpHeaders headers,
       @PathParam("upgradeGroupId") Long groupId) {
     return new UpgradeItemService(m_clusterName, m_upgradeId, groupId.toString());
   }
 
-
-
   /**
    * @param groupId the specific group id
    * @return the resource instance

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 67379ee..d479bfe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.controller.internal;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -45,12 +44,9 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
-import org.apache.ambari.server.controller.utilities.PredicateBuilder;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
 import org.apache.ambari.server.orm.dao.StageDAO;
-import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
@@ -130,21 +126,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
     KEY_PROPERTY_IDS.put(Resource.Type.Request, STAGE_REQUEST_ID);
   }
 
-  /**
-   * Mapping of valid status transitions that that are driven by manual input.
-   */
-  private static Map<HostRoleStatus, EnumSet<HostRoleStatus>> manualTransitionMap = new HashMap<HostRoleStatus, EnumSet<HostRoleStatus>>();
-
-  static {
-    manualTransitionMap.put(HostRoleStatus.HOLDING, EnumSet.of(HostRoleStatus.COMPLETED, HostRoleStatus.ABORTED));
-    manualTransitionMap.put(HostRoleStatus.HOLDING_FAILED, EnumSet.of(HostRoleStatus.PENDING, HostRoleStatus.FAILED, HostRoleStatus.ABORTED));
-    manualTransitionMap.put(HostRoleStatus.HOLDING_TIMEDOUT, EnumSet.of(HostRoleStatus.PENDING, HostRoleStatus.TIMEDOUT, HostRoleStatus.ABORTED));
-    //todo: perhaps add a CANCELED status that just affects a stage and wont abort the request
-    //todo: so, if I scale 10 nodes and actually provision 5 and then later decide I don't want those
-    //todo: additional 5 nodes I can cancel them and the corresponding request will have a status of COMPLETED
-  }
-
-
   // ----- Constructors ------------------------------------------------------
 
   /**
@@ -189,7 +170,8 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
         String stageStatus = (String) updateProperties.get(STAGE_STATUS);
         if (stageStatus != null) {
           HostRoleStatus desiredStatus = HostRoleStatus.valueOf(stageStatus);
-          updateStageStatus(entity, desiredStatus, getManagementController());
+          dao.updateStageStatus(entity, desiredStatus,
+              getManagementController().getActionManager());
         }
       }
     }
@@ -249,67 +231,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
     return new QueryResponseImpl(results, request.getSortRequest() != null, false, results.size());
   }
 
-  // ----- StageResourceProvider ---------------------------------------------
-
-  /**
-   * Update the stage identified by the given stage id with the desired status.
-   *
-   * @param requestId      the request id
-   * @param stageId        the stage id
-   * @param desiredStatus  the desired stage status
-   * @param controller     the ambari management controller
-   */
-  public static void updateStageStatus(long requestId, long stageId, HostRoleStatus desiredStatus,
-                                       AmbariManagementController controller) {
-    Predicate predicate = new PredicateBuilder().property(STAGE_STAGE_ID).equals(stageId).and().
-        property(STAGE_REQUEST_ID).equals(requestId).toPredicate();
-
-    List<StageEntity> entityList = dao.findAll(PropertyHelper.getReadRequest(), predicate);
-    for (StageEntity stageEntity : entityList) {
-      updateStageStatus(stageEntity, desiredStatus, controller);
-    }
-  }
-
-
-  // ----- helper methods ----------------------------------------------------
-
-  /**
-   * Update the given stage entity with the desired status.
-   *
-   * @param stage          the stage entity to update
-   * @param desiredStatus  the desired stage status
-   * @param controller     the ambari management controller
-   *
-   * @throws java.lang.IllegalArgumentException if the transition to the desired status is not a
-   *         legal transition
-   */
-  private static void updateStageStatus(StageEntity stage, HostRoleStatus desiredStatus,
-                                        AmbariManagementController controller) {
-    Collection<HostRoleCommandEntity> tasks = stage.getHostRoleCommands();
-
-    HostRoleStatus currentStatus = CalculatedStatus.statusFromTaskEntities(tasks, stage.isSkippable()).getStatus();
-
-    if (!isValidManualTransition(currentStatus, desiredStatus)) {
-      throw new IllegalArgumentException("Can not transition a stage from " +
-          currentStatus + " to " + desiredStatus);
-    }
-    if (desiredStatus == HostRoleStatus.ABORTED) {
-      controller.getActionManager().cancelRequest(stage.getRequestId(), "User aborted.");
-    } else {
-      for (HostRoleCommandEntity hostRoleCommand : tasks) {
-        HostRoleStatus hostRoleStatus = hostRoleCommand.getStatus();
-        if (hostRoleStatus.equals(currentStatus)) {
-          hostRoleCommand.setStatus(desiredStatus);
-
-          if (desiredStatus == HostRoleStatus.PENDING) {
-            hostRoleCommand.setStartTime(-1L);
-          }
-          hostRoleCommandDAO.merge(hostRoleCommand);
-        }
-      }
-    }
-  }
-
   /**
    * Converts the {@link StageEntity} to a {@link Resource}.
    *
@@ -447,16 +368,4 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
 
     return resource;
   }
-
-  /**
-   * Determine whether or not it is valid to transition from this stage status to the given status.
-   *
-   * @param status  the stage status being transitioned to
-   *
-   * @return true if it is valid to transition to the given stage status
-   */
-  private static boolean isValidManualTransition(HostRoleStatus status, HostRoleStatus desiredStatus) {
-    EnumSet<HostRoleStatus> stageStatusSet = manualTransitionMap.get(status);
-    return stageStatusSet != null && stageStatusSet.contains(desiredStatus);
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
index 468315b..c4dcd27 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
@@ -159,14 +159,14 @@ public class UpgradeGroupResourceProvider extends AbstractControllerResourceProv
       throws SystemException, UnsupportedPropertyException,
       NoSuchResourceException, NoSuchParentResourceException {
 
-    throw new SystemException("Upgrade Items cannot be modified at this time");
+    throw new SystemException("Upgrade groups cannot be modified");
   }
 
   @Override
   public RequestStatus deleteResources(Predicate predicate)
       throws SystemException, UnsupportedPropertyException,
       NoSuchResourceException, NoSuchParentResourceException {
-    throw new SystemException("Cannot delete upgrade items");
+    throw new SystemException("Upgrade groups cannot be removed");
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index 351bbec..48b040e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -39,7 +39,10 @@ import org.apache.ambari.server.controller.spi.Resource;
 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.orm.dao.StageDAO;
 import org.apache.ambari.server.orm.dao.UpgradeDAO;
+import org.apache.ambari.server.orm.entities.StageEntity;
+import org.apache.ambari.server.orm.entities.StageEntityPK;
 import org.apache.ambari.server.orm.entities.UpgradeEntity;
 import org.apache.ambari.server.orm.entities.UpgradeGroupEntity;
 import org.apache.ambari.server.orm.entities.UpgradeItemEntity;
@@ -67,7 +70,10 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
   private static Map<String, String> STAGE_MAPPED_IDS = new HashMap<String, String>();
 
   @Inject
-  private static UpgradeDAO m_dao = null;
+  private static UpgradeDAO s_dao;
+
+  @Inject
+  private static StageDAO s_stageDao;
 
   /**
    * Used to generated the correct tasks and stages during an upgrade.
@@ -113,28 +119,42 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
     // the request should contain a single map of update properties...
     Iterator<Map<String,Object>> iterator = request.getProperties().iterator();
     if (iterator.hasNext()) {
-
       Map<String,Object> updateProperties = iterator.next();
 
       String statusPropertyId = STAGE_MAPPED_IDS.get(StageResourceProvider.STAGE_STATUS);
-      String stageStatus      = (String) updateProperties.get(statusPropertyId);
+      String stageStatus = (String) updateProperties.get(statusPropertyId);
+
+      if (null == stageStatus) {
+        throw new IllegalArgumentException("Upgrade items can only have their status changed.");
+      }
 
-      if (stageStatus != null) {
+      HostRoleStatus desiredStatus = HostRoleStatus.valueOf(stageStatus);
+      Set<Resource> resources = getResources(PropertyHelper.getReadRequest(), predicate);
 
-        HostRoleStatus desiredStatus = HostRoleStatus.valueOf(stageStatus);
-        Set<Resource>  resources     = getResources(PropertyHelper.getReadRequest(), predicate);
+      for (Resource resource : resources) {
+        // Set the desired status on the underlying stage.
+        Long requestId = (Long) resource.getPropertyValue(UPGRADE_REQUEST_ID);
+        Long stageId = (Long) resource.getPropertyValue(UPGRADE_ITEM_STAGE_ID);
 
-        for (Resource resource : resources) {
-          // Set the desired status on the underlying stage.
-          Long requestId = (Long) resource.getPropertyValue(UPGRADE_REQUEST_ID);
-          Long stageId   = (Long) resource.getPropertyValue(UPGRADE_ITEM_STAGE_ID);
+        StageEntityPK primaryKey = new StageEntityPK();
+        primaryKey.setRequestId(requestId);
+        primaryKey.setStageId(stageId);
 
-          StageResourceProvider.updateStageStatus(requestId, stageId, desiredStatus, getManagementController());
+        StageEntity stageEntity = s_stageDao.findByPK(primaryKey);
+        if (null == stageEntity) {
+          LOG.warn(
+              "Unable to change the status of request {} and stage {} to {} because it does not exist",
+              requestId, stageId, desiredStatus);
+
+          return getRequestStatus(null);
         }
+
+        s_stageDao.updateStageStatus(stageEntity, desiredStatus,
+            getManagementController().getActionManager());
       }
     }
-    notifyUpdate(Resource.Type.UpgradeItem, request, predicate);
 
+    notifyUpdate(Resource.Type.UpgradeItem, request, predicate);
     return getRequestStatus(null);
   }
 
@@ -169,7 +189,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
 
       List<UpgradeItemEntity> entities = new ArrayList<UpgradeItemEntity>();
       if (null == stageId) {
-        UpgradeGroupEntity group = m_dao.findUpgradeGroup(groupId);
+        UpgradeGroupEntity group = s_dao.findUpgradeGroup(groupId);
 
         if (null == group || null == group.getItems()) {
           throw new NoSuchResourceException(String.format("Cannot load upgrade for %s", requestIdStr));
@@ -178,7 +198,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
         entities = group.getItems();
 
       } else {
-        UpgradeItemEntity entity = m_dao.findUpgradeItemByRequestAndStage(requestId, stageId);
+        UpgradeItemEntity entity = s_dao.findUpgradeItemByRequestAndStage(requestId, stageId);
         if (null != entity) {
           entities.add(entity);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index 0f05140..9c91656 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -81,6 +81,7 @@ public class HostRoleCommandDAO {
 
   @Inject
   Provider<EntityManager> entityManagerProvider;
+
   @Inject
   DaoUtils daoUtils;
 
@@ -442,5 +443,4 @@ public class HostRoleCommandDAO {
 
     return map;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
index 83c2c44..541b2e9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.server.orm.dao;
 
 import java.util.Collection;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -31,13 +32,16 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Order;
 import javax.persistence.metamodel.SingularAttribute;
 
+import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.api.query.JpaPredicateVisitor;
 import org.apache.ambari.server.api.query.JpaSortBuilder;
+import org.apache.ambari.server.controller.internal.CalculatedStatus;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.utilities.PredicateHelper;
 import org.apache.ambari.server.orm.RequiresSession;
+import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
 import org.apache.ambari.server.orm.entities.StageEntityPK;
 import org.apache.ambari.server.orm.entities.StageEntity_;
@@ -53,11 +57,38 @@ import com.google.inject.persist.Transactional;
 @Singleton
 public class StageDAO {
 
+  /**
+   * Mapping of valid status transitions that that are driven by manual input.
+   */
+  private static Map<HostRoleStatus, EnumSet<HostRoleStatus>> manualTransitionMap = new HashMap<HostRoleStatus, EnumSet<HostRoleStatus>>();
+
+  static {
+    manualTransitionMap.put(HostRoleStatus.HOLDING,
+        EnumSet.of(HostRoleStatus.COMPLETED, HostRoleStatus.ABORTED));
+
+    manualTransitionMap.put(HostRoleStatus.HOLDING_FAILED,
+        EnumSet.of(HostRoleStatus.PENDING, HostRoleStatus.FAILED, HostRoleStatus.ABORTED));
+
+    manualTransitionMap.put(HostRoleStatus.HOLDING_TIMEDOUT,
+        EnumSet.of(HostRoleStatus.PENDING, HostRoleStatus.TIMEDOUT, HostRoleStatus.ABORTED));
+
+    // todo: perhaps add a CANCELED status that just affects a stage and wont
+    // abort the request
+    // todo: so, if I scale 10 nodes and actually provision 5 and then later
+    // decide I don't want those
+    // todo: additional 5 nodes I can cancel them and the corresponding request
+    // will have a status of COMPLETED
+  }
+
   @Inject
   Provider<EntityManager> entityManagerProvider;
+
   @Inject
   DaoUtils daoUtils;
 
+  @Inject
+  HostRoleCommandDAO hostRoleCommandDao;
+
   @RequiresSession
   public StageEntity findByPK(StageEntityPK stageEntityPK) {
     return entityManagerProvider.get().find(StageEntity.class, stageEntityPK);
@@ -218,6 +249,63 @@ public class StageDAO {
   }
 
   /**
+   * Update the given stage entity with the desired status.
+   *
+   * @param stage
+   *          the stage entity to update
+   * @param desiredStatus
+   *          the desired stage status
+   * @param controller
+   *          the ambari management controller
+   *
+   * @throws java.lang.IllegalArgumentException
+   *           if the transition to the desired status is not a legal transition
+   */
+  @Transactional
+  public void updateStageStatus(StageEntity stage, HostRoleStatus desiredStatus,
+      ActionManager actionManager) {
+    Collection<HostRoleCommandEntity> tasks = stage.getHostRoleCommands();
+
+    HostRoleStatus currentStatus = CalculatedStatus.statusFromTaskEntities(tasks,
+        stage.isSkippable()).getStatus();
+
+    if (!isValidManualTransition(currentStatus, desiredStatus)) {
+      throw new IllegalArgumentException(
+          "Can not transition a stage from " + currentStatus + " to " + desiredStatus);
+    }
+    if (desiredStatus == HostRoleStatus.ABORTED) {
+      actionManager.cancelRequest(stage.getRequestId(), "User aborted.");
+    } else {
+      for (HostRoleCommandEntity hostRoleCommand : tasks) {
+        HostRoleStatus hostRoleStatus = hostRoleCommand.getStatus();
+        if (hostRoleStatus.equals(currentStatus)) {
+          hostRoleCommand.setStatus(desiredStatus);
+
+          if (desiredStatus == HostRoleStatus.PENDING) {
+            hostRoleCommand.setStartTime(-1L);
+          }
+          hostRoleCommandDao.merge(hostRoleCommand);
+        }
+      }
+    }
+  }
+
+  /**
+   * Determine whether or not it is valid to transition from this stage status
+   * to the given status.
+   *
+   * @param status
+   *          the stage status being transitioned to
+   *
+   * @return true if it is valid to transition to the given stage status
+   */
+  private static boolean isValidManualTransition(HostRoleStatus status,
+      HostRoleStatus desiredStatus) {
+    EnumSet<HostRoleStatus> stageStatusSet = manualTransitionMap.get(status);
+    return stageStatusSet != null && stageStatusSet.contains(desiredStatus);
+  }
+
+  /**
    * The {@link org.apache.ambari.server.orm.dao.StageDAO.StagePredicateVisitor} is used to convert an Ambari
    * {@link org.apache.ambari.server.controller.spi.Predicate} into a JPA {@link javax.persistence.criteria.Predicate}.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 1f8bf8d..86f5f32 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -2577,14 +2577,35 @@ public class ClusterImpl implements Cluster {
         failedEvents.put(event, message);
       } catch (InvalidStateTransitionException e) {
         LOG.error("Invalid transition ", e);
-        if ((e.getEvent() == ServiceComponentHostEventType.HOST_SVCCOMP_START)
-            && (e.getCurrentState() == State.STARTED)) {
-          LOG.warn("Component request for component = " + serviceComponentName
-              + " to start is invalid, since component is already started. Ignoring this request.");
 
-          // skip adding this as a failed event, to work around stack ordering
-          // issues with Hive
-        } else {
+        boolean isFailure = true;
+
+        Enum<?> currentState = e.getCurrentState();
+        Enum<?> failedEvent = e.getEvent();
+
+        // skip adding this as a failed event, to work around stack ordering
+        // issues with Hive
+        if (currentState == State.STARTED &&
+            failedEvent == ServiceComponentHostEventType.HOST_SVCCOMP_START){
+          isFailure = false;
+          LOG.warn(
+              "The start request for {} is invalid since the component is already started. Ignoring the request.",
+              serviceComponentName);
+        }
+
+        // unknown hosts should be able to be put back in progress and let the
+        // action scheduler fail it; don't abort the entire stage just because
+        // this happens
+        if (currentState == State.UNKNOWN
+            && failedEvent == ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS) {
+          isFailure = false;
+          LOG.warn("The host {} is in an unknown state; attempting to put {} back in progress.",
+              event.getHostName(),
+              serviceComponentName);
+        }
+
+        // fail the event, causing it to automatically abort
+        if (isFailure) {
           failedEvents.put(event, String.format("Invalid transition. %s", e.getMessage()));
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 63f015b..71d0581 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -170,242 +170,276 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   // define the state machine of a HostServiceComponent for runnable
   // components
 
-     .addTransition(State.INIT,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
-         new ServiceComponentHostOpStartedTransition())
+  .addTransition(State.INIT, 
+      State.INSTALLING, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+      new ServiceComponentHostOpStartedTransition())
 
-     .addTransition(State.INSTALLING,
-         State.INSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
-         new ServiceComponentHostOpCompletedTransition())
+  .addTransition(State.INSTALLING,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+      new ServiceComponentHostOpCompletedTransition())
 
-  .addTransition(State.INSTALLING, State.INSTALLED,
+  .addTransition(State.INSTALLING,
+      State.INSTALLED,
       ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
       new AlertDefinitionCommandTransition())
 
-     .addTransition(State.INSTALLED,
-         State.INSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.INSTALLING,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.INSTALLING,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.INSTALLING,
-         State.INSTALL_FAILED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.INSTALL_FAILED,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALL_FAILED,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
-         new ServiceComponentHostOpStartedTransition())
-
-       // Allow transition on abort
-     .addTransition(State.INSTALL_FAILED, State.INSTALL_FAILED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.INSTALLED,
-         State.STARTING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_START,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALLED,
-         State.UNINSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALLED,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALLED,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALLED,
-         State.UPGRADING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.INSTALLED,
-          State.INSTALLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-          new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.INSTALLED,
-          State.STARTED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
-          new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.INSTALLED,
-          State.INSTALLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
-          new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.STARTING,
-         State.STARTING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-
-     .addTransition(State.STARTING,
-         State.STARTING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_START,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.STARTING,
-         State.STARTED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.STARTING,
-         State.INSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.INSTALLED,
-         State.STARTING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.STARTED,
-          State.STARTED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
-          new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.STARTED,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.STARTED,
-          State.STARTED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-          new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.STARTED,
-          State.INSTALLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
-          new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.STOPPING,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.STOPPING,
-         State.INSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
-         new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.STOPPING,
-         State.STARTED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.STARTED,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.UNINSTALLING,
-         State.UNINSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.UNINSTALLING,
-         State.UNINSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
-         new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.UNINSTALLING,
-         State.UNINSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-
-     .addTransition(State.UPGRADING,
-         State.UPGRADING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.UPGRADING,
-         State.INSTALLED,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
-         new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.UPGRADING,
-         State.UPGRADING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.UPGRADING,
-         State.UPGRADING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.UPGRADING,
-         State.UPGRADING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
-         new ServiceComponentHostOpInProgressTransition())
-
-     .addTransition(State.UNINSTALLING,
-         State.UNINSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.UNINSTALLING,
-         State.UNINSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.UNINSTALLED,
-         State.INSTALLING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.UNINSTALLED,
-         State.WIPING_OUT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
-         new ServiceComponentHostOpStartedTransition())
-
-     .addTransition(State.WIPING_OUT,
-         State.WIPING_OUT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
-         new ServiceComponentHostOpInProgressTransition())
-     .addTransition(State.WIPING_OUT,
-         State.INIT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
-         new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.WIPING_OUT,
-         State.WIPING_OUT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
-         new ServiceComponentHostOpCompletedTransition())
+  .addTransition(State.INSTALLED,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALLING,
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.INSTALLING, 
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLING, 
+      State.INSTALL_FAILED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALL_FAILED,
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALL_FAILED, 
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  // Allow transition on abort
+  .addTransition(State.INSTALL_FAILED, 
+      State.INSTALL_FAILED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.STARTING, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_START,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.UNINSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.STOPPING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.UPGRADING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED, 
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.INSTALLED,
+      State.STARTED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALLED,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STARTING,
+      State.STARTING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.STARTING,
+      State.STARTING, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_START,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.STARTING,
+      State.STARTED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STARTING,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALLED,
+      State.STARTING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.STARTED,
+      State.STARTED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_STARTED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STARTED,
+      State.STOPPING, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.STARTED,
+      State.STARTED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.STARTED,
+      State.INSTALLED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STOPPING,
+      State.STOPPING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.STOPPING,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STOPPING,
+      State.STARTED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.STARTED,
+      State.STOPPING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.UNINSTALLING,
+      State.UNINSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.UNINSTALLING,
+      State.UNINSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+      new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.WIPING_OUT,
-         State.WIPING_OUT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.WIPING_OUT,
-         State.WIPING_OUT,
-         ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
-         new ServiceComponentHostOpStartedTransition())
+  .addTransition(State.UNINSTALLING,
+      State.UNINSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
 
-      .addTransition(State.INSTALLED,
-          State.DISABLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
-          new ServiceComponentHostOpCompletedTransition())
-      .addTransition(State.DISABLED,
-          State.DISABLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
-          new ServiceComponentHostOpCompletedTransition())
-      .addTransition(State.UNKNOWN,
-                  State.DISABLED,
-                  ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
-                  new ServiceComponentHostOpCompletedTransition())
-      .addTransition(State.INSTALL_FAILED,
-                  State.DISABLED,
-                  ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
-                  new ServiceComponentHostOpCompletedTransition())
-
-      .addTransition(State.DISABLED,
-          State.INSTALLED,
-          ServiceComponentHostEventType.HOST_SVCCOMP_RESTORE,
-          new ServiceComponentHostOpCompletedTransition())
+  .addTransition(State.UPGRADING,
+      State.UPGRADING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
 
+  .addTransition(State.UPGRADING, 
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.UPGRADING,
+      State.UPGRADING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.UPGRADING,
+      State.UPGRADING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.UPGRADING,
+      State.UPGRADING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.UNINSTALLING,
+      State.UNINSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.UNINSTALLING,
+      State.UNINSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.UNINSTALLED,
+      State.INSTALLING,
+      ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.UNINSTALLED,
+      State.WIPING_OUT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.WIPING_OUT,
+      State.WIPING_OUT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpInProgressTransition())
+
+  .addTransition(State.WIPING_OUT,
+      State.INIT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.WIPING_OUT,
+      State.WIPING_OUT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.WIPING_OUT,
+      State.WIPING_OUT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.WIPING_OUT,
+      State.WIPING_OUT,
+      ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
+      new ServiceComponentHostOpStartedTransition())
+
+  .addTransition(State.INSTALLED,
+      State.DISABLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.DISABLED,
+      State.DISABLED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.UNKNOWN,
+      State.DISABLED, 
+      ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.UNKNOWN,
+      State.UNKNOWN,
+      ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.INSTALL_FAILED, 
+      State.DISABLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
+      new ServiceComponentHostOpCompletedTransition())
+
+  .addTransition(State.DISABLED,
+      State.INSTALLED,
+      ServiceComponentHostEventType.HOST_SVCCOMP_RESTORE,
+      new ServiceComponentHostOpCompletedTransition())
 
      .installTopology();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ab90629/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java
index 4516b34..0342bf2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java
@@ -18,10 +18,8 @@
 package org.apache.ambari.server.controller.internal;
 
 import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
@@ -207,25 +205,27 @@ public class StageResourceProviderTest {
 
   @Test
   public void testUpdateStageStatus_aborted() throws Exception {
-
+    StageResourceProvider provider = new StageResourceProvider(managementController);
     ActionManager actionManager = createNiceMock(ActionManager.class);
 
     Predicate predicate = new PredicateBuilder().property(StageResourceProvider.STAGE_STAGE_ID).equals(2L).and().
         property(StageResourceProvider.STAGE_REQUEST_ID).equals(1L).toPredicate();
 
-    Request request = PropertyHelper.getReadRequest();
+    Map<String, Object> requestProps = new HashMap<String, Object>();
+    requestProps.put(StageResourceProvider.STAGE_STATUS, HostRoleStatus.ABORTED.name());
+    Request request = PropertyHelper.getUpdateRequest(requestProps, null);
 
     List<StageEntity> entities = getStageEntities(HostRoleStatus.HOLDING);
 
     expect(dao.findAll(request, predicate)).andReturn(entities);
-
     expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
 
-    actionManager.cancelRequest(eq(1L), anyObject(String.class));
+    dao.updateStageStatus(entities.get(0), HostRoleStatus.ABORTED, actionManager);
+    EasyMock.expectLastCall().atLeastOnce();
 
     replay(dao, clusters, cluster, actionManager, managementController);
 
-    StageResourceProvider.updateStageStatus(1L, 2L, HostRoleStatus.ABORTED, managementController);
+    provider.updateResources(request, predicate);
 
     verify(dao, clusters, cluster, actionManager, managementController);
   }