private void abortOperationsForStage(Stage stage) {
    long now = System.currentTimeMillis();

    for (String hostName : stage.getHosts()) {
      List<ExecutionCommandWrapper> commandWrappers =
        stage.getExecutionCommands(hostName);

      for(ExecutionCommandWrapper wrapper : commandWrappers) {
        ExecutionCommand c = wrapper.getExecutionCommand();
        transitionToFailedState(stage.getClusterName(), c.getServiceName(),
                c.getRole(), hostName, now, true);
      }
    }
    Collection<HostRoleCommandEntity> abortedOperations = db.abortOperation(stage.getRequestId());

    for (HostRoleCommandEntity command: abortedOperations) {
      if (command.getRoleCommand().equals(RoleCommand.ACTIONEXECUTE)) {
        String clusterName = stage.getClusterName();
        processActionDeath(clusterName, command.getHostName(), command.getRole().name());
      }
    }
  }
Generate a OPFailed event before aborting all operations in the stage
@param stage
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java