Return-Path: X-Original-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 31B1210AAD for ; Thu, 25 Jul 2013 22:00:19 +0000 (UTC) Received: (qmail 64183 invoked by uid 500); 25 Jul 2013 22:00:19 -0000 Delivered-To: apmail-incubator-ambari-commits-archive@incubator.apache.org Received: (qmail 64159 invoked by uid 500); 25 Jul 2013 22:00:19 -0000 Mailing-List: contact ambari-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@incubator.apache.org Delivered-To: mailing list ambari-commits@incubator.apache.org Received: (qmail 64152 invoked by uid 99); 25 Jul 2013 22:00:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jul 2013 22:00:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A5AA585D5; Thu, 25 Jul 2013 22:00:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: swagle@apache.org To: ambari-commits@incubator.apache.org Message-Id: <6887a62cce644ddc9db7364d775049bf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-2738. Allow Client component to be re-installed. (swagle) Date: Thu, 25 Jul 2013 22:00:18 +0000 (UTC) Updated Branches: refs/heads/trunk fb69284e6 -> 23ea7ee55 AMBARI-2738. Allow Client component to be re-installed. (swagle) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/23ea7ee5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/23ea7ee5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/23ea7ee5 Branch: refs/heads/trunk Commit: 23ea7ee55bb8d6b952a71d4fbdda6a42771c8784 Parents: fb69284 Author: Siddharth Wagle Authored: Thu Jul 25 15:00:02 2013 -0700 Committer: Siddharth Wagle Committed: Thu Jul 25 15:00:02 2013 -0700 ---------------------------------------------------------------------- .../AmbariManagementControllerImpl.java | 3 +- .../AmbariManagementControllerTest.java | 77 ++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/23ea7ee5/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 9380420..9534d61 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 @@ -3246,7 +3246,8 @@ public class AmbariManagementControllerImpl implements } State oldSchState = sch.getState(); - if (newState == oldSchState) { + // Client component reinstall allowed + if (newState == oldSchState && !sc.isClientComponent()) { sch.setDesiredState(newState); if (LOG.isDebugEnabled()) { LOG.debug("Ignoring ServiceComponentHost" http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/23ea7ee5/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 7ab7d0b..676a954 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 @@ -5184,6 +5184,83 @@ public class AmbariManagementControllerTest { } @Test + public void testReInstallClientComponent() throws AmbariException { + String clusterName = "foo1"; + createCluster(clusterName); + clusters.getCluster(clusterName) + .setDesiredStackVersion(new StackId("HDP-0.1")); + String serviceName = "HDFS"; + createService(clusterName, serviceName, null); + String componentName1 = "NAMENODE"; + String componentName2 = "DATANODE"; + String componentName3 = "HDFS_CLIENT"; + + createServiceComponent(clusterName, serviceName, componentName1, + State.INIT); + createServiceComponent(clusterName, serviceName, componentName2, + State.INIT); + createServiceComponent(clusterName, serviceName, componentName3, + State.INIT); + + String host1 = "h1"; + clusters.addHost(host1); + clusters.getHost("h1").setOsType("centos5"); + clusters.getHost("h1").setState(HostState.HEALTHY); + clusters.getHost("h1").persist(); + String host2 = "h2"; + clusters.addHost(host2); + clusters.getHost("h2").setOsType("centos6"); + clusters.getHost("h2").setState(HostState.HEALTHY); + clusters.getHost("h2").persist(); + String host3 = "h3"; + clusters.addHost(host3); + clusters.getHost("h3").setOsType("centos6"); + clusters.getHost("h3").setState(HostState.HEALTHY); + clusters.getHost("h3").persist(); + + clusters.mapHostToCluster(host1, clusterName); + clusters.mapHostToCluster(host2, clusterName); + clusters.mapHostToCluster(host3, clusterName); + + createServiceComponentHost(clusterName, serviceName, componentName1, + host1, null); + createServiceComponentHost(clusterName, serviceName, componentName2, + host1, null); + createServiceComponentHost(clusterName, serviceName, componentName3, + host2, null); + createServiceComponentHost(clusterName, serviceName, componentName3, + host3, null); + + // Install + installService(clusterName, serviceName, false, false); + + // Reinstall SCH + ServiceComponentHostRequest schr = new ServiceComponentHostRequest + (clusterName, serviceName, componentName3, host3, null, + State.INSTALLED.name()); + Set setReqs = new + HashSet(); + setReqs.add(schr); + RequestStatusResponse resp = controller.updateHostComponents(setReqs, + Collections.emptyMap(), false); + + Assert.assertNotNull(resp); + Assert.assertTrue(resp.getRequestId() > 0); + List stages = actionDB.getAllStages(resp.getRequestId()); + HostRoleCommand clientReinstallCmd = null; + for (Stage stage : stages) { + for (HostRoleCommand hrc : stage.getOrderedHostRoleCommands()) { + if (hrc.getHostName().equals(host3) && hrc.getRole().toString() + .equals("HDFS_CLIENT")) { + clientReinstallCmd = hrc; + break; + } + } + } + Assert.assertNotNull(clientReinstallCmd); + } + + @Test public void testHivePasswordAbsentInConfigs() throws AmbariException { String clusterName = "c1"; String serviceName = "HIVE";