You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by od...@apache.org on 2016/02/22 22:27:00 UTC
ambari git commit: AMBARI-15116. HAWQSEGMENT should be unchecked on
host which does not have DataNode(bhuvnesh chaudhary via odiachenko).
Repository: ambari
Updated Branches:
refs/heads/trunk 9dfe929ee -> ecd6a3057
AMBARI-15116. HAWQSEGMENT should be unchecked on host which does not have DataNode(bhuvnesh chaudhary via odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ecd6a305
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ecd6a305
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ecd6a305
Branch: refs/heads/trunk
Commit: ecd6a3057dafe7adb12e46e7348fea5d912635a6
Parents: 9dfe929
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Mon Feb 22 13:25:41 2016 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Mon Feb 22 13:25:41 2016 -0800
----------------------------------------------------------------------
.../stacks/HDP/2.3/services/stack_advisor.py | 2 +
.../stacks/2.3/common/test_stack_advisor.py | 103 ++++++++++++++++++-
2 files changed, 102 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ecd6a305/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index 34e4cfa..11adca5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -40,6 +40,8 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
for host_group in hostGroups:
if {"name": "DATANODE"} in host_group["components"] and {"name": "HAWQSEGMENT"} not in host_group["components"]:
host_group["components"].append({"name": "HAWQSEGMENT"})
+ if {"name": "DATANODE"} not in host_group["components"] and {"name": "HAWQSEGMENT"} in host_group["components"]:
+ host_group["components"].remove({"name": "HAWQSEGMENT"})
# co-locate PXF with NAMENODE and DATANODE
if "PXF" in servicesList:
http://git-wip-us.apache.org/repos/asf/ambari/blob/ecd6a305/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 03ae6cc..690c053 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -58,6 +58,13 @@ class TestHDP23StackAdvisor(TestCase):
data = json.load(f)
return data
+ def prepareHosts(self, hostsNames):
+ hosts = { "items": [] }
+ for hostName in hostsNames:
+ nextHost = {"Hosts":{"host_name" : hostName}}
+ hosts["items"].append(nextHost)
+ return hosts
+
@patch('__builtin__.open')
@patch('os.path.exists')
def get_system_min_uid_magic(self, exists_mock, open_mock):
@@ -168,15 +175,105 @@ class TestHDP23StackAdvisor(TestCase):
def test_hawqsegmentDatanode(self):
""" Test that HAWQSegment gets recommended on same host group which has DATANODE"""
- services = self.load_json("services-hawq-pxf-hdfs.json")
- hosts = self.load_json("hosts-3-hosts.json")
- recommendations = self.stackAdvisor.createComponentLayoutRecommendations(services, hosts)
+ # Case 1: HDFS is already installed, HAWQ is being added during Add Service Wizard
+ services = {
+ "services" : [
+ {
+ "StackServices" : {
+ "service_name" : "HDFS"
+ },
+ "components" : [
+ {
+ "StackServiceComponents" : {
+ "cardinality" : "1+",
+ "component_category" : "SLAVE",
+ "component_name" : "DATANODE",
+ "hostnames" : [ "c6401.ambari.apache.org" ]
+ }
+ }
+ ]
+ },
+ {
+ "StackServices" : {
+ "service_name" : "HAWQ"
+ },
+ "components" : [
+ {
+ "StackServiceComponents" : {
+ "cardinality" : "1+",
+ "component_category" : "SLAVE",
+ "component_name" : "HAWQSEGMENT",
+ "hostnames" : [ ]
+ }
+ }
+ ]
+ }
+ ]
+ }
+
+ # Cluster has 2 hosts
+ hosts = self.prepareHosts(["c6401.ambari.apache.org", "c6402.ambari.apache.org"])
+ recommendations = self.stackAdvisor.createComponentLayoutRecommendations(services, hosts)
+ """
+ Recommendations is as below:
+ {
+ 'blueprint':{
+ 'host_groups':[
+ {
+ 'name':'host-group-1',
+ 'components':[ ]
+ },
+ {
+ 'name':'host-group-2',
+ 'components':[
+ {
+ 'name':'DATANODE'
+ },
+ {
+ 'name':'HAWQSEGMENT'
+ }
+ ]
+ }
+ ]
+ },
+ 'blueprint_cluster_binding':{
+ 'host_groups':[
+ {
+ 'hosts':[
+ {
+ 'fqdn':'c6402.ambari.apache.org'
+ }
+ ],
+ 'name':'host-group-1'
+ },
+ {
+ 'hosts':[
+ {
+ 'fqdn':'c6401.ambari.apache.org'
+ }
+ ],
+ 'name':'host-group-2'
+ }
+ ]
+ }
+ }
+ """
for hostgroup in recommendations["blueprint"]["host_groups"]:
component_names = [component["name"] for component in hostgroup["components"]]
if 'DATANODE' in component_names:
self.assertTrue('HAWQSEGMENT' in component_names)
+ if 'DATANODE' not in component_names:
+ self.assertTrue('HAWQSEGMENT' not in component_names)
+ # Case 2: HDFS and HAWQ are being installed on a fresh cluster, HAWQSEGMENT and DATANODE must be recommended on all the host groups
+ # Update HDFS hostnames to empty list
+ services["services"][0]["components"][0]["StackServiceComponents"]["hostnames"] = []
+ recommendations = self.stackAdvisor.createComponentLayoutRecommendations(services, hosts)
+ for hostgroup in recommendations["blueprint"]["host_groups"]:
+ component_names = [component["name"] for component in hostgroup["components"]]
+ self.assertTrue('HAWQSEGMENT' in component_names)
+ self.assertTrue('DATANODE' in component_names)
def fqdn_mock_result(value=None):
return 'c6401.ambari.apache.org' if value is None else value