AMBARI-21643 - Annotate upgrade packs for scope (jonathanhurley)

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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: b487b450ac9ff00a3be3b61a1399b710aa21a5d6
Parents: 66410e5
Author: Jonathan Hurley <jhur...@hortonworks.com>
Authored: Thu Aug 3 08:26:57 2017 -0400
Committer: Jonathan Hurley <jhur...@hortonworks.com>
Committed: Thu Aug 3 13:37:53 2017 -0400

----------------------------------------------------------------------
 .../upgrades/upgrade_nonrolling_new_stack.xml   |   6 +-
 .../2.1.1/upgrades/upgrade_test_nonrolling.xml  |   4 +-
 .../api/services/WidgetLayoutService.java       |   1 -
 .../internal/UpgradeResourceProvider.java       |   4 +-
 .../upgrades/UpdateDesiredRepositoryAction.java | 189 +++++++++++++++++++
 .../upgrades/UpdateDesiredStackAction.java      | 189 -------------------
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |   6 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |   7 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |   7 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |   7 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |   1 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |   1 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |   1 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |   6 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |   6 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |   6 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |   1 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |   1 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml |   6 +-
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |   6 +-
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   6 +-
 .../1.0/upgrades/nonrolling-upgrade-2.0.xml     |   6 +-
 .../upgrades/UpgradeActionTest.java             |   6 +-
 .../server/state/stack/UpgradePackTest.java     |   4 +-
 .../upgrades/upgrade_nonrolling_new_stack.xml   |   6 +-
 .../2.1.1/upgrades/upgrade_test_nonrolling.xml  |   4 +-
 26 files changed, 247 insertions(+), 240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
----------------------------------------------------------------------
diff --git 
a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
 
b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
index d0f3e16..a44759e 100644
--- 
a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
+++ 
b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
@@ -237,9 +237,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack" service="" component="">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories" service="" 
component="">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
----------------------------------------------------------------------
diff --git 
a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
 
b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
index 9f57ca8..f7dd720 100644
--- 
a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
+++ 
b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
@@ -105,9 +105,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Desired Stack Id">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Desired Stack Id">
       <execute-stage title="Update Desired Stack Id" service="" component="">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
index 61167d6..0a3c720 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
@@ -69,7 +69,6 @@ public class WidgetLayoutService extends BaseService {
   @GET @ApiIgnore // until documented
   @Produces("text/plain")
   public Response getServices(String body, @Context HttpHeaders headers, 
@Context UriInfo ui) {
-    System.out.println("###########");
     return handleRequest(headers, body, ui, Request.Type.GET,
             createResource(null));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 6b1fe05..ea3cf65 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -647,7 +647,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
       throw new AmbariException("There are no groupings available");
     }
 
-    // Non Rolling Upgrades require a group with name 
"UPDATE_DESIRED_STACK_ID".
+    // Non Rolling Upgrades require a group with name 
"UPDATE_DESIRED_REPOSITORY_ID".
     // This is needed as a marker to indicate which version to use when an 
upgrade is paused.
     if (pack.getType() == UpgradeType.NON_ROLLING) {
       boolean foundUpdateDesiredRepositoryIdGrouping = false;
@@ -690,7 +690,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 
     During a {@link UpgradeType.NON_ROLLING} upgrade, the stack is applied 
during the middle of the upgrade (after
     stopping all services), and the configs are applied immediately before 
starting the services.
-    The Upgrade Pack is responsible for calling {@link 
org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction}
+    The Upgrade Pack is responsible for calling {@link 
org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction}
     at the appropriate moment during the orchestration.
     */
     if (pack.getType() == UpgradeType.ROLLING) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
new file mode 100644
index 0000000..10d6630
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
@@ -0,0 +1,189 @@
+/*
+ * 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.serveraction.upgrades;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.orm.dao.HostVersionDAO;
+import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.serveraction.ServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.UpgradeContext;
+import org.apache.ambari.server.state.stack.upgrade.Direction;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+import com.google.inject.persist.Transactional;
+
+/**
+ * Action that represents updating the Desired Stack Id during the middle of a 
stack upgrade (typically NonRolling).
+ * In a {@link 
org.apache.ambari.server.state.stack.upgrade.UpgradeType#NON_ROLLING}, the 
effective Stack Id is
+ * actually changed half-way through calculating the Actions, and this serves 
to update the database to make it
+ * evident to the user at which point it changed.
+ */
+public class UpdateDesiredRepositoryAction extends AbstractUpgradeServerAction 
{
+
+  /**
+   * Logger.
+   */
+  private static final Logger LOG = 
LoggerFactory.getLogger(UpdateDesiredRepositoryAction.class);
+
+
+  /**
+   * The Cluster that this ServerAction implementation is executing on.
+   */
+  @Inject
+  private Clusters clusters;
+
+  /**
+   * The Ambari configuration.
+   */
+  @Inject
+  private Configuration m_configuration;
+
+  /**
+   * Used for restting host version states on downgrade.
+   */
+  @Inject
+  private HostVersionDAO m_hostVersionDAO;
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public CommandReport execute(ConcurrentMap<String, Object> 
requestSharedDataContext)
+      throws AmbariException, InterruptedException {
+
+    String clusterName = getExecutionCommand().getClusterName();
+    Cluster cluster = clusters.getCluster(clusterName);
+    UpgradeContext upgradeContext = getUpgradeContext(cluster);
+
+    Map<String, String> roleParams = getExecutionCommand().getRoleParams();
+
+    // Make a best attempt at setting the username
+    String userName;
+    if (roleParams != null && 
roleParams.containsKey(ServerAction.ACTION_USER_NAME)) {
+      userName = roleParams.get(ServerAction.ACTION_USER_NAME);
+    } else {
+      userName = m_configuration.getAnonymousAuditName();
+      LOG.warn(String.format("Did not receive role parameter %s, will save 
configs using anonymous username %s", ServerAction.ACTION_USER_NAME, userName));
+    }
+
+    return updateDesiredRepositoryVersion(cluster, upgradeContext, userName);
+  }
+
+  /**
+   * Sets the desired repository version for services participating in the
+   * upgrade.
+   *
+   * @param cluster
+   *          the cluster
+   * @param upgradeContext
+   *          the upgrade context
+   * @param userName
+   *          username performing the action
+   * @return the command report to return
+   */
+  @Transactional
+  CommandReport updateDesiredRepositoryVersion(
+      Cluster cluster, UpgradeContext upgradeContext, String userName)
+      throws AmbariException, InterruptedException {
+
+    StringBuilder out = new StringBuilder();
+    StringBuilder err = new StringBuilder();
+
+    try {
+      // the desired repository message to put in the command report - this 
will
+      // change based on the type of upgrade and the services participating
+      if (upgradeContext.getDirection() == Direction.UPGRADE) {
+        final String message;
+        RepositoryVersionEntity targetRepositoryVersion = 
upgradeContext.getRepositoryVersion();
+
+        if (upgradeContext.getOrchestrationType() == RepositoryType.STANDARD) {
+          message = MessageFormat.format(
+              "Updating the desired repository version to {0} for all cluster 
services.",
+              targetRepositoryVersion.getVersion());
+        } else {
+          Set<String> servicesInUpgrade = 
upgradeContext.getSupportedServices();
+          message = MessageFormat.format(
+              "Updating the desired repository version to {0} for the 
following services: {1}",
+              targetRepositoryVersion.getVersion(), 
StringUtils.join(servicesInUpgrade, ','));
+        }
+
+        out.append(message).append(System.lineSeparator());
+      }
+
+      if( upgradeContext.getDirection() == Direction.DOWNGRADE ){
+        String message = "Updating the desired repository back their original 
values for the following services:";
+        out.append(message).append(System.lineSeparator());
+
+        Map<String, RepositoryVersionEntity> targetVersionsByService = 
upgradeContext.getTargetVersions();
+        for (String serviceName : targetVersionsByService.keySet()) {
+          RepositoryVersionEntity repositoryVersion = 
targetVersionsByService.get(serviceName);
+
+          message = String.format("  %s to %s", serviceName, 
repositoryVersion.getVersion());
+          out.append(message).append(System.lineSeparator());
+        }
+      }
+
+      // move repositories to the right version and create/revert configs
+      m_upgradeHelper.updateDesiredRepositoriesAndConfigs(upgradeContext);
+
+      // a downgrade must force host versions back to INSTALLED for the
+      // repository which failed to be upgraded.
+      if (upgradeContext.getDirection() == Direction.DOWNGRADE) {
+        RepositoryVersionEntity downgradeFromRepositoryVersion = 
upgradeContext.getRepositoryVersion();
+        out.append(String.format("Setting host versions back to %s for 
repository version %s",
+            RepositoryVersionState.INSTALLED, 
downgradeFromRepositoryVersion.getVersion()));
+
+        List<HostVersionEntity> hostVersionsToReset = 
m_hostVersionDAO.findHostVersionByClusterAndRepository(
+            cluster.getClusterId(), downgradeFromRepositoryVersion);
+
+        for (HostVersionEntity hostVersion : hostVersionsToReset) {
+          if( hostVersion.getState() != RepositoryVersionState.NOT_REQUIRED ){
+            hostVersion.setState(RepositoryVersionState.INSTALLED);
+          }
+        }
+      }
+
+      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", 
out.toString(), err.toString());
+    } catch (Exception e) {
+      StringWriter sw = new StringWriter();
+      e.printStackTrace(new PrintWriter(sw));
+      err.append(sw);
+
+      return createCommandReport(-1, HostRoleStatus.FAILED, "{}", 
out.toString(), err.toString());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
deleted file mode 100644
index ff0becc..0000000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
+++ /dev/null
@@ -1,189 +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.serveraction.upgrades;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.actionmanager.HostRoleStatus;
-import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.orm.dao.HostVersionDAO;
-import org.apache.ambari.server.orm.entities.HostVersionEntity;
-import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.serveraction.ServerAction;
-import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.RepositoryType;
-import org.apache.ambari.server.state.RepositoryVersionState;
-import org.apache.ambari.server.state.UpgradeContext;
-import org.apache.ambari.server.state.stack.upgrade.Direction;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Inject;
-import com.google.inject.persist.Transactional;
-
-/**
- * Action that represents updating the Desired Stack Id during the middle of a 
stack upgrade (typically NonRolling).
- * In a {@link 
org.apache.ambari.server.state.stack.upgrade.UpgradeType#NON_ROLLING}, the 
effective Stack Id is
- * actually changed half-way through calculating the Actions, and this serves 
to update the database to make it
- * evident to the user at which point it changed.
- */
-public class UpdateDesiredStackAction extends AbstractUpgradeServerAction {
-
-  /**
-   * Logger.
-   */
-  private static final Logger LOG = 
LoggerFactory.getLogger(UpdateDesiredStackAction.class);
-
-
-  /**
-   * The Cluster that this ServerAction implementation is executing on.
-   */
-  @Inject
-  private Clusters clusters;
-
-  /**
-   * The Ambari configuration.
-   */
-  @Inject
-  private Configuration m_configuration;
-
-  /**
-   * Used for restting host version states on downgrade.
-   */
-  @Inject
-  private HostVersionDAO m_hostVersionDAO;
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public CommandReport execute(ConcurrentMap<String, Object> 
requestSharedDataContext)
-      throws AmbariException, InterruptedException {
-
-    String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
-    UpgradeContext upgradeContext = getUpgradeContext(cluster);
-
-    Map<String, String> roleParams = getExecutionCommand().getRoleParams();
-
-    // Make a best attempt at setting the username
-    String userName;
-    if (roleParams != null && 
roleParams.containsKey(ServerAction.ACTION_USER_NAME)) {
-      userName = roleParams.get(ServerAction.ACTION_USER_NAME);
-    } else {
-      userName = m_configuration.getAnonymousAuditName();
-      LOG.warn(String.format("Did not receive role parameter %s, will save 
configs using anonymous username %s", ServerAction.ACTION_USER_NAME, userName));
-    }
-
-    return updateDesiredRepositoryVersion(cluster, upgradeContext, userName);
-  }
-
-  /**
-   * Sets the desired repository version for services participating in the
-   * upgrade.
-   *
-   * @param cluster
-   *          the cluster
-   * @param upgradeContext
-   *          the upgrade context
-   * @param userName
-   *          username performing the action
-   * @return the command report to return
-   */
-  @Transactional
-  CommandReport updateDesiredRepositoryVersion(
-      Cluster cluster, UpgradeContext upgradeContext, String userName)
-      throws AmbariException, InterruptedException {
-
-    StringBuilder out = new StringBuilder();
-    StringBuilder err = new StringBuilder();
-
-    try {
-      // the desired repository message to put in the command report - this 
will
-      // change based on the type of upgrade and the services participating
-      if (upgradeContext.getDirection() == Direction.UPGRADE) {
-        final String message;
-        RepositoryVersionEntity targetRepositoryVersion = 
upgradeContext.getRepositoryVersion();
-
-        if (upgradeContext.getOrchestrationType() == RepositoryType.STANDARD) {
-          message = MessageFormat.format(
-              "Updating the desired repository version to {0} for all cluster 
services.",
-              targetRepositoryVersion.getVersion());
-        } else {
-          Set<String> servicesInUpgrade = 
upgradeContext.getSupportedServices();
-          message = MessageFormat.format(
-              "Updating the desired repository version to {0} for the 
following services: {1}",
-              targetRepositoryVersion.getVersion(), 
StringUtils.join(servicesInUpgrade, ','));
-        }
-
-        out.append(message).append(System.lineSeparator());
-      }
-
-      if( upgradeContext.getDirection() == Direction.DOWNGRADE ){
-        String message = "Updating the desired repository back their original 
values for the following services:";
-        out.append(message).append(System.lineSeparator());
-
-        Map<String, RepositoryVersionEntity> targetVersionsByService = 
upgradeContext.getTargetVersions();
-        for (String serviceName : targetVersionsByService.keySet()) {
-          RepositoryVersionEntity repositoryVersion = 
targetVersionsByService.get(serviceName);
-
-          message = String.format("  %s to %s", serviceName, 
repositoryVersion.getVersion());
-          out.append(message).append(System.lineSeparator());
-        }
-      }
-
-      // move repositories to the right version and create/revert configs
-      m_upgradeHelper.updateDesiredRepositoriesAndConfigs(upgradeContext);
-
-      // a downgrade must force host versions back to INSTALLED for the
-      // repository which failed to be upgraded.
-      if (upgradeContext.getDirection() == Direction.DOWNGRADE) {
-        RepositoryVersionEntity downgradeFromRepositoryVersion = 
upgradeContext.getRepositoryVersion();
-        out.append(String.format("Setting host versions back to %s for 
repository version %s",
-            RepositoryVersionState.INSTALLED, 
downgradeFromRepositoryVersion.getVersion()));
-
-        List<HostVersionEntity> hostVersionsToReset = 
m_hostVersionDAO.findHostVersionByClusterAndRepository(
-            cluster.getClusterId(), downgradeFromRepositoryVersion);
-
-        for (HostVersionEntity hostVersion : hostVersionsToReset) {
-          if( hostVersion.getState() != RepositoryVersionState.NOT_REQUIRED ){
-            hostVersion.setState(RepositoryVersionState.INSTALLED);
-          }
-        }
-      }
-
-      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", 
out.toString(), err.toString());
-    } catch (Exception e) {
-      StringWriter sw = new StringWriter();
-      e.printStackTrace(new PrintWriter(sw));
-      err.append(sw);
-
-      return createCommandReport(-1, HostRoleStatus.FAILED, "{}", 
out.toString(), err.toString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index ff1d87d..07b34cd 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -242,9 +242,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
index 41cab3f..331306f 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -241,9 +241,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>
@@ -450,6 +450,7 @@
     that are installed on the hosts but not known by Ambari.
     -->
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All 
Hosts">
+      <scope>COMPLETE</scope>
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 76c4ed5..7f9d9d2 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -258,9 +258,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>
@@ -606,6 +606,7 @@
     that are installed on the hosts but not known by Ambari.
     -->
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All 
Hosts">
+      <scope>COMPLETE</scope>
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 5aa08c5..4034f4b 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -260,9 +260,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>
@@ -704,6 +704,7 @@
     that are installed on the hosts but not known by Ambari.
     -->
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All 
Hosts">
+      <scope>COMPLETE</scope>
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
index 8cfaa52..11fb0c5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
@@ -427,6 +427,7 @@
     </group>
 
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+      <scope>COMPLETE</scope>
       <execute-stage title="Update remaining HDP stack to {{version}}">
         <task xsi:type="execute">
           <script>scripts/ru_set_all.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index f7192ae..56c1552 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -495,6 +495,7 @@
     </group>
 
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+      <scope>COMPLETE</scope>
       <execute-stage title="Update remaining HDP stack to {{version}}">
         <task xsi:type="execute">
           <script>scripts/ru_set_all.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index d98bb53..2e2c9c3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -497,6 +497,7 @@
     </group>
 
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+      <scope>COMPLETE</scope>
       <execute-stage title="Update remaining HDP stack to {{version}}">
         <task xsi:type="execute">
           <script>scripts/ru_set_all.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
index 4e66b7c..ed0d2f8 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -240,9 +240,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index 9969a59..77ec871 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -252,9 +252,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index 4a2a502..4703709 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -254,9 +254,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index ad9ae33..e2c7557 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -480,6 +480,7 @@
     </group>
 
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+      <scope>COMPLETE</scope>
       <execute-stage title="Update remaining HDP stack to {{version}}">
         <task xsi:type="execute">
           <script>scripts/ru_set_all.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index 1eb9836..35187c7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -486,6 +486,7 @@
     </group>
 
     <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+      <scope>COMPLETE</scope>
       <execute-stage title="Update remaining HDP stack to {{version}}">
         <task xsi:type="execute">
           <script>scripts/ru_set_all.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index c8cb0b3..b79f644 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -260,9 +260,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index cfd429f..e9490b2 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -266,9 +266,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction"/>
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction"/>
       </execute-stage>
     </group>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index df609cd..86b3956 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -277,9 +277,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
index 7078a6e..5d24ff8 100644
--- 
a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
@@ -72,9 +72,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction"/>
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction"/>
       </execute-stage>
     </group>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index da6d2b2..82d5481 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -289,12 +289,12 @@ public class UpgradeActionTest {
   }
 
   /***
-   * During an Express Upgrade that crosses a stack version, Ambari calls 
UpdateDesiredStackAction
+   * During an Express Upgrade that crosses a stack version, Ambari calls 
UpdateDesiredRepositoryAction
    * in order to change the stack and apply configs.
    * The configs that are applied must be saved with the username that is 
passed in the role params.
    */
   @Test
-  public void testExpressUpgradeUpdateDesiredStackAction() throws Exception {
+  public void testExpressUpgradeUpdateDesiredRepositoryAction() throws 
Exception {
     StackId sourceStack = HDP_21_STACK;
     StackId targetStack = HDP_22_STACK;
     String sourceRepo = HDP_2_1_1_0;
@@ -349,7 +349,7 @@ public class UpgradeActionTest {
     hostRoleCommand.setExecutionCommandWrapper(new 
ExecutionCommandWrapper(executionCommand));
 
     // Call the action to change the desired stack and apply the configs from 
the Config Pack called by the Upgrade Pack.
-    UpdateDesiredStackAction action = 
m_injector.getInstance(UpdateDesiredStackAction.class);
+    UpdateDesiredRepositoryAction action = 
m_injector.getInstance(UpdateDesiredRepositoryAction.class);
     action.setExecutionCommand(executionCommand);
     action.setHostRoleCommand(hostRoleCommand);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
index d682244..c7a761d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
@@ -272,7 +272,7 @@ public class UpgradePackTest {
       "Stop High-Level Daemons",
       "Backups",
       "Stop Low-Level Daemons",
-      "UPDATE_DESIRED_STACK_ID",
+      "UPDATE_DESIRED_REPOSITORY_ID",
       "ALL_HOST_OPS",
       "ZOOKEEPER",
       "HDFS",
@@ -281,7 +281,7 @@ public class UpgradePackTest {
 
     List<String> expected_down = Arrays.asList(
       "Restore Backups",
-      "UPDATE_DESIRED_STACK_ID",
+      "UPDATE_DESIRED_REPOSITORY_ID",
       "ALL_HOST_OPS",
       "ZOOKEEPER",
       "HDFS",

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
 
b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
index a397be9..2a1c889 100644
--- 
a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
+++ 
b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
@@ -237,9 +237,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Target Stack">
-      <execute-stage title="Update Target Stack">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Target Repositories">
+      <execute-stage title="Update Target Repositories">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
 
b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
index dcddbc5..3dd4bc5 100644
--- 
a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
+++ 
b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
@@ -107,9 +107,9 @@
     </group>
 
     <!-- After processing this group, will change the effective Stack of the 
UpgradeContext object. -->
-    <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" 
title="Update Desired Stack Id">
+    <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" 
title="Update Desired Stack Id">
       <execute-stage title="Update Desired Stack Id">
-        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+        <task xsi:type="server_action" 
class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
         </task>
       </execute-stage>
     </group>

Reply via email to