Browse Source

AMBARI-5973. Usability: Add checks for THP to the Ambari pre-req check for Linux (aonishuk)

Andrew Onishuk 11 years ago
parent
commit
46abfca2dd

+ 10 - 0
ambari-agent/src/main/python/resource_management/core/system.py

@@ -69,6 +69,16 @@ class System(object):
     In case cannot detect --> Fail
     """
     return OSCheck.get_os_version()
+
+  @lazy_property
+  def os_major_version(self):
+    """
+    Example return value:
+    "6" for "Centos 6.3"
+
+    In case cannot detect --> Fail
+    """
+    return OSCheck.get_os_major_version()
   
   @lazy_property
   def os_release_name(self):

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py

@@ -27,8 +27,8 @@ class BeforeConfigureHook(Hook):
 
   def hook(self, env):
     import params
-
     env.set_params(params)
+    change_thp()
     install_repos()
     setup_java()
     setup_users()

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/params.py

@@ -124,7 +124,7 @@ if has_ganglia_server:
 
 hbase_tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
 ignore_groupsusers_create = default("ignore_groupsusers_create", False)
-
+transparent_huge_pages_file = "/sys/kernel/mm/redhat_transparent_hugepage/enabled"
 
 #repo params
 repo_info = config['hostLevelParams']['repo_info']

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py

@@ -196,3 +196,8 @@ def setup_java():
 
 def install_packages():
   Package(['unzip'])
+
+def change_thp():
+  import params
+  if System.get_instance().os_family == "redhat" and System.get_instance().os_major_version == '6' :
+    Execute(format("echo never > {transparent_huge_pages_file}"))

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py

@@ -26,8 +26,8 @@ class BeforeConfigureHook(Hook):
 
   def hook(self, env):
     import params
-
     env.set_params(params)
+    change_thp()
     install_repos()
     install_packages()
     setup_java()

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/params.py

@@ -101,6 +101,7 @@ jce_policy_zip = default("/hostLevelParams/jce_name", None) # None when jdk is a
 jce_location = config['hostLevelParams']['jdk_location']
 jdk_location = config['hostLevelParams']['jdk_location']
 ignore_groupsusers_create = default("ignore_groupsusers_create", False)
+transparent_huge_pages_file = "/sys/kernel/mm/redhat_transparent_hugepage/enabled"
 
 #repo params
 repo_info = config['hostLevelParams']['repo_info']

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py

@@ -218,3 +218,8 @@ def setup_java():
 
 def install_packages():
   Package(['unzip', 'curl'])
+
+def change_thp():
+  import params
+  if System.get_instance().os_family == "redhat" and System.get_instance().os_major_version == '6' :
+    Execute(format("echo never > {transparent_huge_pages_file}"))