Repository: ambari Updated Branches: refs/heads/trunk 3249bf6cf -> 8a99eb31f
AMBARI-16829: Warning for HAWQSTANDBY does not show up on Assign Masters page (mithmatt) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8a99eb31 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8a99eb31 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8a99eb31 Branch: refs/heads/trunk Commit: 8a99eb31f250b29933922e8efb3c1987e795a4f6 Parents: 3249bf6 Author: Matt <mmat...@pivotal.io> Authored: Tue May 24 00:19:29 2016 -0700 Committer: Matt <mmat...@pivotal.io> Committed: Tue May 24 00:19:29 2016 -0700 ---------------------------------------------------------------------- .../common-services/HAWQ/2.0.0/service_advisor.py | 5 +++-- .../test/python/stacks/2.3/HAWQ/test_service_advisor.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8a99eb31/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py index c5813ad..836144c 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py @@ -45,9 +45,10 @@ class HAWQ200ServiceAdvisor(service_advisor.ServiceAdvisor): componentsListList = [service["components"] for service in services["services"]] componentsList = [item["StackServiceComponents"] for sublist in componentsListList for item in sublist] hawqMasterHosts = self.getHosts(componentsList, "HAWQMASTER") + hawqStandbyHosts = self.getHosts(componentsList, "HAWQSTANDBY") - # if HAWQMASTER has already been assigned, try to ensure HAWQSTANDBY is not placed on the same host - if len(hawqMasterHosts) > 0: + # if HAWQMASTER has already been assigned and HAWQSTANDBY has not been assigned, try to ensure HAWQSTANDBY is not placed on the same host + if len(hawqMasterHosts) > 0 and len(hawqStandbyHosts) == 0: ambariServerHost = socket.getfqdn() availableHosts = [host for host in hostsList if host not in (hawqMasterHosts[0], ambariServerHost)] # Return list containing first available host if there are available hosts http://git-wip-us.apache.org/repos/asf/ambari/blob/8a99eb31/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py index c33a223..53c5574 100644 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py +++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py @@ -113,6 +113,18 @@ class TestHAWQ200ServiceAdvisor(TestCase): standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(self.stackAdvisor, services, None, component, hostsList, None) self.assertEquals(standbyHosts, []) + # Case 5: + # Ambari Server is placed on c6401.ambari.apache.org + # HAWQMASTER is placed on c6402.ambari.apache.org + # HAWQSTANDBY is placed on c6401.ambari.apache.org + # There are 3 available host in the cluster + # Do not change HAWQSTANDBY host according to recommendation since HAWQSTANDBY has already been assigned a host + hostsList = ["c6401.ambari.apache.org", "c6402.ambari.apache.org", "c6403.ambari.apache.org"] + services["services"][0]["components"][0]["StackServiceComponents"]["hostnames"] = ["c6402.ambari.apache.org"] + services["services"][0]["components"][1]["StackServiceComponents"]["hostnames"] = ["c6401.ambari.apache.org"] + standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(self.stackAdvisor, services, None, component, hostsList, None) + self.assertEquals(standbyHosts, ["c6401.ambari.apache.org"]) + def test_getServiceConfigurationRecommendations(self):