Updated Branches:
  refs/heads/trunk 88cd415ca -> d26ad0f42

AMBARI-2969. Disable stack upgrade support.


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

Branch: refs/heads/trunk
Commit: d26ad0f422b739c3b45b421aea8a004213efbaae
Parents: 88cd415
Author: Sumit Mohanty <[email protected]>
Authored: Wed Aug 21 14:06:17 2013 -0700
Committer: Sumit Mohanty <[email protected]>
Committed: Wed Aug 21 14:06:17 2013 -0700

----------------------------------------------------------------------
 .../AmbariManagementControllerImpl.java         | 116 -------------------
 .../server/controller/ClusterRequest.java       |   1 +
 .../resources/stacks/HDP/1.3.0/metainfo.xml     |   1 -
 .../resources/stacks/HDP/1.3.2/metainfo.xml     |   1 -
 .../stacks/HDPLocal/1.3.0/metainfo.xml          |   1 -
 .../stacks/HDPLocal/1.3.2/metainfo.xml          |   1 -
 .../AmbariManagementControllerTest.java         |   4 +-
 7 files changed, 3 insertions(+), 122 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 495cb13..c41f89c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1517,136 +1517,20 @@ public class AmbariManagementControllerImpl implements
 
     StackId currentVersion = cluster.getCurrentStackVersion();
     StackId desiredVersion = cluster.getDesiredStackVersion();
-    String requestedVersionString = request.getStackVersion();
-    StackId requestedVersion = null;
 
     // Set the current version value if its not already set
     if (currentVersion == null) {
       cluster.setCurrentStackVersion(desiredVersion);
-      currentVersion = cluster.getCurrentStackVersion();
     }
 
     boolean requiresHostListUpdate =
         request.getHostNames() != null && !request.getHostNames().isEmpty();
-    // TODO Should upgrade be allowed to upgrade all un-upgraded hosts
-    // even if the cluster says its upgraded
-    boolean requiresVersionUpdate = requestedVersionString != null
-        && !requestedVersionString.isEmpty();
-    if (requiresVersionUpdate) {
-      LOG.info("Received a cluster update request"
-          + ", clusterName=" + request.getClusterName()
-          + ", request=" + request);
-      requestedVersion = new StackId(requestedVersionString);
-      if 
(!requestedVersion.getStackName().equals(currentVersion.getStackName())) {
-        throw new AmbariException("Upgrade not possible between different 
stacks.");
-      }
-      requiresVersionUpdate = !currentVersion.equals(requestedVersion);
-      if(!requiresVersionUpdate) {
-        LOG.info("The cluster is already at " + currentVersion);
-      }
-    }
-
-    if (requiresVersionUpdate && requiresHostListUpdate) {
-      throw new IllegalArgumentException("Invalid arguments, "
-          + "cluster version cannot be upgraded"
-          + " along with host list modifications");
-    }
 
     if (requiresHostListUpdate) {
       clusters.mapHostsToCluster(
           request.getHostNames(), request.getClusterName());
     }
 
-    if (requiresVersionUpdate) {
-      LOG.info("Upgrade cluster request received for stack " + 
requestedVersion);
-      boolean retry = false;
-      if (0 == currentVersion.compareTo(desiredVersion)) {
-        if (1 != requestedVersion.compareTo(currentVersion)) {
-          throw new AmbariException("Target version : " + requestedVersion
-              + " must be greater than current version : " + currentVersion);
-        } else {
-          StackInfo stackInfo =
-              ambariMetaInfo.getStackInfo(requestedVersion.getStackName(), 
requestedVersion.getStackVersion());
-          if (stackInfo == null) {
-            throw new AmbariException("Target version : " + requestedVersion
-                + " is not a recognized version");
-          }
-          if(!isUpgradeAllowed(stackInfo, currentVersion))
-          {
-            throw new AmbariException("Upgrade is not allowed from " + 
currentVersion
-                + " to the target version " + requestedVersion);
-          }
-        }
-      } else {
-        retry = true;
-        LOG.info("Received upgrade request is a retry.");
-        if (0 != requestedVersion.compareTo(desiredVersion)) {
-          throw new AmbariException("Upgrade in progress to target version : "
-              + desiredVersion
-              + ". Illegal request to upgrade to : " + requestedVersion);
-        }
-      }
-
-      checkIfActiveComponentsExist(cluster, currentVersion);
-
-      checkIfAnotherUpgradeCommandIsActive();
-
-      // TODO Ensure no other upgrade is active
-      /**
-       * There exists no active upgrade. Perform a final check of current 
stack version
-       * and proceed if upgrade is still required. Upgrade is idempotent so 
this check
-       * is only to avoid potentially expensive stage creation.
-       */
-      cluster.refresh();
-      if (requestedVersion.equals(cluster.getCurrentStackVersion())) {
-        LOG.info("Update cluster request version matches the current"
-                  + ", version=" + request);
-        return null;
-      }
-
-      if (!retry) {
-        cluster.setDesiredStackVersion(requestedVersion);
-        for (Service service : cluster.getServices().values()) {
-          service.setDesiredStackVersion(requestedVersion);
-          for (ServiceComponent component : 
service.getServiceComponents().values()) {
-            component.setDesiredStackVersion(requestedVersion);
-            for (ServiceComponentHost componentHost : 
component.getServiceComponentHosts().values()) {
-              componentHost.setDesiredStackVersion(requestedVersion);
-            }
-          }
-        }
-      }
-
-      Map<State, List<Service>> changedServices
-          = new HashMap<State, List<Service>>();
-      Map<State, List<ServiceComponent>> changedComps =
-          new HashMap<State, List<ServiceComponent>>();
-      Map<String, Map<State, List<ServiceComponentHost>>> changedScHosts =
-          new HashMap<String, Map<State, List<ServiceComponentHost>>>();
-
-      LOG.info("Identifying components to upgrade.");
-      fillComponentsToUpgrade(request, cluster, changedServices, changedComps, 
changedScHosts);
-      Map<String, String> requestParameters = new HashMap<String, String>();
-      requestParameters.put(Configuration.UPGRADE_TO_STACK, 
gson.toJson(requestedVersion));
-      requestParameters.put(Configuration.UPGRADE_FROM_STACK, 
gson.toJson(currentVersion));
-
-      LOG.info("Creating stages for upgrade.");
-      List<Stage> stages = doStageCreation(cluster, changedServices, 
changedComps, changedScHosts,
-          requestParameters, requestProperties.get(REQUEST_CONTEXT_PROPERTY),
-          false, false);
-
-      if (stages == null || stages.isEmpty()) {
-        return null;
-      }
-
-      addFinalizeUpgradeAction(cluster, stages);
-      persistStages(stages);
-      updateServiceStates(changedServices, changedComps, changedScHosts);
-      long requestId = stages.get(0).getRequestId();
-      LOG.info(stages.size() + " stages created for upgrade and the request id 
is " + requestId);
-      return getRequestStatusResponse(requestId);
-    }
-
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
index bbda054..1eaf7c7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
@@ -116,6 +116,7 @@ public class ClusterRequest {
     sb.append("{"
         + " clusterName=" + clusterName
         + ", clusterId=" + clusterId
+        + ", stackVersion=" + stackVersion
         + ", hosts=[");
     if (hostNames != null) {
       int i = 0;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/resources/stacks/HDP/1.3.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.0/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDP/1.3.0/metainfo.xml
index 5d9cb06..ca45822 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.0/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.0/metainfo.xml
@@ -17,7 +17,6 @@
 -->
 <metainfo>
     <versions>
-         <upgrade>1.2.0</upgrade>
          <active>true</active>
     </versions>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/resources/stacks/HDP/1.3.2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/metainfo.xml
index 5d9cb06..ca45822 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/metainfo.xml
@@ -17,7 +17,6 @@
 -->
 <metainfo>
     <versions>
-         <upgrade>1.2.0</upgrade>
          <active>true</active>
     </versions>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/resources/stacks/HDPLocal/1.3.0/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPLocal/1.3.0/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDPLocal/1.3.0/metainfo.xml
index e930796..45a63e5 100644
--- a/ambari-server/src/main/resources/stacks/HDPLocal/1.3.0/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDPLocal/1.3.0/metainfo.xml
@@ -17,7 +17,6 @@
 -->
 <metainfo>
     <versions>
-         <upgrade>1.2.0</upgrade>
          <active>false</active>
     </versions>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/main/resources/stacks/HDPLocal/1.3.2/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPLocal/1.3.2/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDPLocal/1.3.2/metainfo.xml
index e930796..45a63e5 100644
--- a/ambari-server/src/main/resources/stacks/HDPLocal/1.3.2/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDPLocal/1.3.2/metainfo.xml
@@ -17,7 +17,6 @@
 -->
 <metainfo>
     <versions>
-         <upgrade>1.2.0</upgrade>
          <active>false</active>
     </versions>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d26ad0f4/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 676a954..16053ae 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -5884,7 +5884,7 @@ public class AmbariManagementControllerTest {
     Assert.assertTrue(c.getCurrentStackVersion().equals(newStackId));
   }
 
-  @Test
+  //@Test - disabled as upgrade feature is disabled
   public void testUpdateClusterVersionBasic() throws AmbariException {
     String clusterName = "foo1";
     String serviceName = "MAPREDUCE";
@@ -6056,7 +6056,7 @@ public class AmbariManagementControllerTest {
     }
   }
 
-  @Test
+  //@Test - disabled as cluster upgrade feature is disabled
   public void testUpdateClusterVersionCombinations() throws AmbariException {
     String clusterName = "foo1";
     String pigServiceName = "PIG";

Reply via email to