Repository: ambari Updated Branches: refs/heads/branch-2.2 95d9ec61c -> f848cb3c6
AMBARI-15083: Add Stack Advisor validations for hawq_global_rm_type property in HAWQ (bhuvnesh2703 via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f848cb3c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f848cb3c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f848cb3c Branch: refs/heads/branch-2.2 Commit: f848cb3c680eba8134d707f4c43eb5cd1a6c6a6a Parents: 95d9ec6 Author: Jun Aoki <ja...@apache.org> Authored: Fri Feb 19 13:39:25 2016 -0800 Committer: Jun Aoki <ja...@apache.org> Committed: Fri Feb 19 13:39:25 2016 -0800 ---------------------------------------------------------------------- .../stacks/HDP/2.3/services/stack_advisor.py | 32 ++++++------- .../stacks/2.3/common/test_stack_advisor.py | 47 ++++++++++++++++++++ 2 files changed, 63 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f848cb3c/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 71b0e2a..d5cfac6 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 @@ -931,31 +931,31 @@ class HDP23StackAdvisor(HDP22StackAdvisor): "HAWQ Master or Standby Master cannot use the port 5432 when installed on the same host as the Ambari Server. Ambari Postgres DB uses the same port. Please choose a different value (e.g. 10432)")}) # 2. Check if any data directories are pointing to root dir '/' - prop_name = 'hawq_master_directory' - display_name = 'HAWQ Master directory' - self.validateIfRootDir (properties, validationItems, prop_name, display_name) - - prop_name = 'hawq_master_temp_directory' - display_name = 'HAWQ Master temp directory' - self.validateIfRootDir (properties, validationItems, prop_name, display_name) - - prop_name = 'hawq_segment_directory' - display_name = 'HAWQ Segment directory' - self.validateIfRootDir (properties, validationItems, prop_name, display_name) - - prop_name = 'hawq_segment_temp_directory' - display_name = 'HAWQ Segment temp directory' - self.validateIfRootDir (properties, validationItems, prop_name, display_name) + directories = { + 'hawq_master_directory': 'HAWQ Master directory', + 'hawq_master_temp_directory': 'HAWQ Master temp directory', + 'hawq_segment_directory': 'HAWQ Segment directory', + 'hawq_segment_temp_directory': 'HAWQ Segment temp directory' + } + for property_name, display_name in directories.iteritems(): + self.validateIfRootDir(properties, validationItems, property_name, display_name) # 3. Check YARN RM address properties + YARN = "YARN" servicesList = [service["StackServices"]["service_name"] for service in services["services"]] - if "YARN" in servicesList and "yarn-site" in configurations: + if YARN in servicesList and "yarn-site" in configurations: yarn_site = getSiteProperties(configurations, "yarn-site") for hs_prop, ys_prop in self.getHAWQYARNPropertyMapping().items(): if hs_prop in hawq_site and ys_prop in yarn_site and hawq_site[hs_prop] != yarn_site[ys_prop]: message = "Expected value: {0} (this property should have the same value as the property {1} in yarn-site)".format(yarn_site[ys_prop], ys_prop) validationItems.append({"config-name": hs_prop, "item": self.getWarnItem(message)}) + # 4. Check HAWQ Resource Manager type + HAWQ_GLOBAL_RM_TYPE = "hawq_global_rm_type" + if YARN not in servicesList and HAWQ_GLOBAL_RM_TYPE in hawq_site and hawq_site[HAWQ_GLOBAL_RM_TYPE].upper() == YARN: + message = "{0} must be set to none if YARN service is not installed".format(HAWQ_GLOBAL_RM_TYPE) + validationItems.append({"config-name": HAWQ_GLOBAL_RM_TYPE, "item": self.getErrorItem(message)}) + return self.toConfigurationValidationProblems(validationItems, "hawq-site") http://git-wip-us.apache.org/repos/asf/ambari/blob/f848cb3c/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 d1501c9..e456a7e 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 @@ -1617,6 +1617,7 @@ class TestHDP23StackAdvisor(TestCase): def test_validateHAWQConfigurations(self): services = self.load_json("services-hawq-3-hosts.json") # setup default configuration values + # Test hawq_rm_yarn_address and hawq_rm_scheduler_address are set correctly configurations = services["configurations"] configurations["hawq-site"] = {"properties": {"hawq_rm_yarn_address": "localhost:8032", "hawq_rm_yarn_scheduler_address": "localhost:8030"}} @@ -1650,3 +1651,49 @@ class TestHDP23StackAdvisor(TestCase): problems_dict[problem['config-name']] = problem self.assertEqual(len(problems), 2) self.assertEqual(problems_dict, expected_warnings) + + # Test hawq_global_rm_type validation + services = { + "services" : [ + { + "StackServices" : { + "service_name" : "HAWQ" + }, + "components": [] + } ], + "configurations": + { + "hawq-site": { + "properties": { + "hawq_global_rm_type": "yarn" + } + } + } + } + properties = services["configurations"]["hawq-site"]["properties"] + + # case 1: hawq_global_rm_type is set as yarn, but YARN service is not installed. Validation error expected. + """ + Validation error expected is as below: + [ { + "config-type": "hawq-site", + "message": "hawq_global_rm_type must be set to none if YARN service is not installed", + "type": "configuration", + "config-name": "hawq_global_rm_type", + "level": "ERROR" + } ] + """ + problems = self.stackAdvisor.validateHAWQConfigurations(properties, defaults, services["configurations"], services, hosts) + self.assertEqual(len(problems), 1) + self.assertEqual(problems[0]["config-type"], "hawq-site") + self.assertEqual(problems[0]["message"], "hawq_global_rm_type must be set to none if YARN service is not installed") + self.assertEqual(problems[0]["type"], "configuration") + self.assertEqual(problems[0]["config-name"], "hawq_global_rm_type") + self.assertEqual(problems[0]["level"], "ERROR") + + + # case 2: hawq_global_rm_type is set as yarn, and YARN service is installed. No validation errors expected. + services["services"].append({"StackServices" : {"service_name" : "YARN"}, "components":[]}) + + problems = self.stackAdvisor.validateHAWQConfigurations(properties, defaults, services["configurations"], services, hosts) + self.assertEqual(len(problems), 0)