Bläddra i källkod

AMBARI-16829: Warning for HAWQSTANDBY does not show up on Assign Masters page (mithmatt)

Matt 9 år sedan
förälder
incheckning
0a351b46bf

+ 3 - 2
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

+ 12 - 0
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):