Repository: ambari
Updated Branches:
  refs/heads/trunk c9f0dd0b8 -> 623929f58


AMBARI-10751. Multiple changes to YARN enhanced configs (srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/623929f5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/623929f5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/623929f5

Branch: refs/heads/trunk
Commit: 623929f58e40a04429d696879205a955f7cceb41
Parents: c9f0dd0
Author: Srimanth Gunturi <sgunt...@hortonworks.com>
Authored: Sun Apr 26 13:16:23 2015 -0700
Committer: Srimanth Gunturi <sgunt...@hortonworks.com>
Committed: Sun Apr 26 23:26:39 2015 -0700

----------------------------------------------------------------------
 .../YARN/2.1.0.2.0/configuration/yarn-site.xml  |  2 +-
 .../YARN/configuration/capacity-scheduler.xml   | 16 ++++-
 .../services/YARN/configuration/yarn-env.xml    | 33 ++++++++++
 .../services/YARN/configuration/yarn-site.xml   | 53 +++++++++++++++-
 .../HDP/2.2/services/YARN/themes/theme.json     | 65 +++++++++++---------
 .../stacks/HDP/2.2/services/stack_advisor.py    | 14 +++++
 .../services/YARN/configuration/yarn-env.xml    | 33 ----------
 .../services/YARN/configuration/yarn-site.xml   | 64 -------------------
 .../stacks/HDP/2.3/services/YARN/metainfo.xml   |  7 ---
 .../HDP/2.3/services/YARN/themes/theme.json     | 33 ----------
 .../stacks/2.2/common/test_stack_advisor.py     | 43 +++++++++++++
 11 files changed, 191 insertions(+), 172 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
index ed59973..2efddb8 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
@@ -135,7 +135,7 @@
     <value>5120</value>
     <description>Amount of physical memory, in MB, that can be allocated
       for containers.</description>
-    <display-name>Total NM Physical Memory Available to 
Containers</display-name>
+    <display-name>Total RAM per NM</display-name>
     <value-attributes>
       <type>int</type>
       <minimum>0</minimum>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/capacity-scheduler.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/capacity-scheduler.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/capacity-scheduler.xml
index 63d56b0..870983b 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/capacity-scheduler.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/capacity-scheduler.xml
@@ -19,7 +19,21 @@
   <property>
     <name>yarn.scheduler.capacity.resource-calculator</name>
     
<value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
-    <description></description>
+    <display-name>Enable CPU Scheduling</display-name>
+    <value-attributes>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          
<value>org.apache.hadoop.yarn.util.resource.DominantResourceCalculator</value>
+          <label>Enabled</label>
+        </entry>
+        <entry>
+          
<value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
+          <label>Disabled</label>
+        </entry>
+      </entries>
+      <selection-cardinality>1</selection-cardinality>
+    </value-attributes>
   </property>
   <property>
     <name>yarn.scheduler.capacity.root.accessible-node-labels</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-env.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-env.xml
new file mode 100644
index 0000000..6920386
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-env.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<configuration>
+  <property>
+    <name>yarn_cgroups_enabled</name>
+    <value>false</value>
+    <description>You can use CGroups to isolate CPU-heavy processes in a 
Hadoop cluster.</description>
+    <display-name>Enable CPU Isolation</display-name>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
index 6c6dcb0..b1f8774 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
@@ -187,7 +187,7 @@
     <name>yarn.nodemanager.resource.cpu-vcores</name>
     <value>8</value>
     <description></description>
-    <display-name>Total NM CPU vCores available to Containers</display-name>
+    <display-name>Total NM CPU vCores</display-name>
     <value-attributes>
       <type>int</type>
       <minimum>0</minimum>
@@ -198,7 +198,7 @@
     <name>yarn.nodemanager.resource.percentage-physical-cpu-limit</name>
     <value>80</value>
     <description>The amount of CPU allocated for YARN containers - only 
effective when used with CGroups</description>
-    <display-name>% of Total NM CPU available to Containers</display-name>
+    <display-name>%ge of Total NM CPU</display-name>
     <value-attributes>
       <type>int</type>
       <minimum>0</minimum>
@@ -376,4 +376,51 @@
       </property>
     </depends-on>
   </property>
-</configuration>
+  <property>
+    <name>yarn.node-labels.enabled</name>
+    <value>false</value>
+    <description>
+      Enabled node labels to restrict YARN applications so that they run only 
on cluster nodes that have a specified node label.
+    </description>
+    <display-name>Enable Node Labels</display-name>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+  </property>
+  <property>
+    <name>yarn.node-labels.manager-class</name>
+    
<value>org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager</value>
+    <description>If user want to enable this feature, specify it to 
"org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager</description>
+    <deleted>true</deleted>
+  </property>
+  <property>
+    <name>yarn.nodemanager.container-executor.class</name>
+    
<value>org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor</value>
+    <description>ContainerExecutor for launching containers</description>
+    <depends-on>
+      <property>
+        <type>yarn-env</type>
+        <name>yarn_cgroups_enabled</name>
+      </property>
+    </depends-on>
+  </property>
+  <property>
+    <name>yarn.nodemanager.linux-container-executor.group</name>
+    <value>hadoop</value>
+    <description>Unix group of the NodeManager</description>
+    <depends-on>
+      <property>
+        <type>yarn-env</type>
+        <name>yarn_cgroups_enabled</name>
+      </property>
+    </depends-on>
+  </property>
+  <property>
+    <name>yarn.resourcemanager.scheduler.monitor.enable</name>
+    <value>false</value>
+    <display-name>Enable Pre-emption</display-name>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+  </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/themes/theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/themes/theme.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/themes/theme.json
index 5dbf19f..9fd466c 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/themes/theme.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/themes/theme.json
@@ -15,7 +15,7 @@
               "sections": [
                 {
                   "name": "section-nm-sizing",
-                  "display-name": "NodeManager Sizing",
+                  "display-name": "Memory Sizing",
                   "row-index": "0",
                   "column-index": "0",
                   "row-span": "1",
@@ -60,7 +60,7 @@
                 },
                 {
                   "name": "section-container-sizing",
-                  "display-name": "Container Sizing",
+                  "display-name": "CPU Sizing",
                   "row-index": "1",
                   "column-index": "0",
                   "row-span": "1",
@@ -98,40 +98,44 @@
           "subsection-name": "subsection-nm-sizing-col1"
         },
         {
-          "config": "yarn-site/yarn.nodemanager.vmem-pmem-ratio",
-          "subsection-name": "subsection-nm-sizing-col1"
+          "config": "yarn-site/yarn.scheduler.minimum-allocation-mb",
+          "subsection-name": "subsection-nm-sizing-col2"
         },
         {
-          "config": 
"yarn-site/yarn.nodemanager.resource.percentage-physical-cpu-limit",
+          "config": "yarn-site/yarn.scheduler.maximum-allocation-mb",
           "subsection-name": "subsection-nm-sizing-col2"
         },
         {
-          "config": "yarn-site/yarn.nodemanager.resource.cpu-vcores",
-          "subsection-name": "subsection-nm-sizing-col2"
+          "config": "yarn-site/yarn.node-labels.enabled",
+          "subsection-name": "subsection-yarn-platform-features-col1"
         },
         {
-          "config": "yarn-site/yarn.scheduler.minimum-allocation-mb",
+          "config": "yarn-site/yarn.resourcemanager.scheduler.monitor.enable",
+          "subsection-name": "subsection-yarn-platform-features-col1"
+        },
+        {
+          "config": 
"capacity-scheduler/yarn.scheduler.capacity.resource-calculator",
           "subsection-name": "subsection-container-sizing-col1"
         },
         {
-          "config": "yarn-site/yarn.scheduler.maximum-allocation-mb",
+          "config": "yarn-env/yarn_cgroups_enabled",
           "subsection-name": "subsection-container-sizing-col1"
         },
         {
-          "config": "yarn-site/yarn.scheduler.minimum-allocation-vcores",
-          "subsection-name": "subsection-container-sizing-col2"
+          "config": "yarn-site/yarn.nodemanager.resource.cpu-vcores",
+          "subsection-name": "subsection-container-sizing-col1"
         },
         {
-          "config": "yarn-site/yarn.scheduler.maximum-allocation-vcores",
-          "subsection-name": "subsection-container-sizing-col2"
+          "config": 
"yarn-site/yarn.nodemanager.resource.percentage-physical-cpu-limit",
+          "subsection-name": "subsection-container-sizing-col1"
         },
         {
-          "config": 
"yarn-site/yarn.resourcemanager.work-preserving-recovery.enabled",
-          "subsection-name": "subsection-yarn-platform-features-col1"
+          "config": "yarn-site/yarn.scheduler.minimum-allocation-vcores",
+          "subsection-name": "subsection-container-sizing-col2"
         },
         {
-          "config": "yarn-site/yarn.log-aggregation-enable",
-          "subsection-name": "subsection-yarn-platform-features-col1"
+          "config": "yarn-site/yarn.scheduler.maximum-allocation-vcores",
+          "subsection-name": "subsection-container-sizing-col2"
         }
       ]
     },
@@ -148,17 +152,6 @@
         }
       },
       {
-        "config": "yarn-site/yarn.nodemanager.vmem-pmem-ratio",
-        "widget": {
-          "type": "slider",
-          "units": [
-            {
-              "unit-name": "float"
-            }
-          ]
-        }
-      },
-      {
         "config": 
"yarn-site/yarn.nodemanager.resource.percentage-physical-cpu-limit",
         "widget": {
           "type": "slider",
@@ -225,16 +218,28 @@
         }
       },
       {
-        "config": "yarn-site/yarn.log-aggregation-enable",
+        "config": "yarn-site/yarn.node-labels.enabled",
         "widget": {
           "type": "checkbox"
         }
       },
       {
-        "config": 
"yarn-site/yarn.resourcemanager.work-preserving-recovery.enabled",
+        "config": "yarn-env/yarn_cgroups_enabled",
         "widget": {
           "type": "checkbox"
         }
+      },
+      {
+        "config": "yarn-site/yarn.resourcemanager.scheduler.monitor.enable",
+        "widget": {
+          "type": "checkbox"
+        }
+      },
+      {
+        "config": 
"capacity-scheduler/yarn.scheduler.capacity.resource-calculator",
+        "widget": {
+          "type": "toggle"
+        }
       }
     ]
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 1fd1c68..3405e8c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -407,6 +407,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     childValidators = {
       "HDFS": {"hdfs-site": self.validateHDFSConfigurations,
                "hadoop-env": self.validateHDFSConfigurationsEnv},
+      "YARN": {"yarn-env": self.validateYARNEnvConfigurations},
       "HIVE": {"hiveserver2-site": self.validateHiveServer2Configurations, 
"hive-site": self.validateHiveConfigurations},
       "HBASE": {"hbase-site": self.validateHBASEConfigurations,
                 "hbase-env": self.validateHBASEEnvConfigurations},
@@ -758,6 +759,19 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
 
     return self.toConfigurationValidationProblems(validationItems, "hbase-env")
 
+  def validateYARNEnvConfigurations(self, properties, recommendedDefaults, 
configurations, services, hosts):
+    validationItems = []
+    if "yarn_cgroups_enabled" in properties:
+      yarn_cgroups_enabled = properties["yarn_cgroups_enabled"].lower() == 
"true"
+      core_site_properties = getSiteProperties(configurations, "core-site")
+      security_enbaled = False
+      if core_site_properties:
+        security_enabled = 
core_site_properties['hadoop.security.authentication'] == 'kerberos' and 
core_site_properties['hadoop.security.authorization'] == 'true'
+      if not security_enabled and yarn_cgroups_enabled:
+        validationItems.append({"config-name": "yarn_cgroups_enabled",
+                              "item": self.getWarnItem("CPU Isolation should 
only be enabled if security is enabled")})
+    return self.toConfigurationValidationProblems(validationItems, "yarn-env")
+
   def getMastersWithMultipleInstances(self):
     result = super(HDP22StackAdvisor, self).getMastersWithMultipleInstances()
     result.extend(['METRICS_COLLECTOR'])

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-env.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-env.xml
deleted file mode 100644
index 8f97f54..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-env.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<configuration>
-  <property>
-    <name>yarn_cgroups_enabled</name>
-    <value>false</value>
-    <description>You can use CGroups to isolate CPU-heavy processes in a 
Hadoop cluster.</description>
-    <display-name>Enable CGroup Isolation</display-name>
-    <value-attributes>
-      <type>boolean</type>
-    </value-attributes>
-  </property>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
deleted file mode 100644
index f5e701f..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-
-<!-- Put site-specific property overrides in this file. -->
-
-<configuration supports_final="true" 
xmlns:xi="http://www.w3.org/2001/XInclude";>
-
-  <property>
-    <name>yarn.node-labels.manager-class</name>
-    
<value>org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager</value>
-    <description>If user want to enable this feature, specify it to 
"org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager</description>
-    <deleted>true</deleted>
-  </property>
-  <property>
-    <name>yarn.node-labels.enabled</name>
-    <value>false</value>
-    <description>
-      Enabled node labels to restrict YARN applications so that they run only 
on cluster nodes that have a specified node label.
-    </description>
-    <display-name>Enable Node Labels</display-name>
-    <value-attributes>
-      <type>boolean</type>
-    </value-attributes>
-  </property>
-  <property>
-    <name>yarn.nodemanager.container-executor.class</name>
-    
<value>org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor</value>
-    <description>ContainerExecutor for launching containers</description>
-    <depends-on>
-      <property>
-        <type>yarn-env</type>
-        <name>yarn_cgroups_enabled</name>
-      </property>
-    </depends-on>
-  </property>
-  <property>
-    <name>yarn.nodemanager.linux-container-executor.group</name>
-    <value>hadoop</value>
-    <description>Unix group of the NodeManager</description>
-    <depends-on>
-      <property>
-        <type>yarn-env</type>
-        <name>yarn_cgroups_enabled</name>
-      </property>
-    </depends-on>
-  </property>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
index 4332bb7..40c9b3d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
@@ -50,13 +50,6 @@
           </packages>
         </osSpecific>
       </osSpecifics>
-      
-      <themes>
-        <theme>
-          <fileName>theme.json</fileName>
-          <default>true</default>
-        </theme>
-      </themes>
     </service>
 
     <service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/themes/theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/themes/theme.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/themes/theme.json
deleted file mode 100644
index 553c9a9..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/themes/theme.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-  "name": "default",
-  "description": "Default theme for YARN service",
-  "configuration": {
-    "placement": {
-      "configuration-layout": "default",
-      "configs": [
-        {
-          "config": "yarn-site/yarn.node-labels.enabled",
-          "subsection-name": "subsection-yarn-platform-features-col1"
-        },
-        {
-          "config": "yarn-env/yarn_cgroups_enabled",
-          "subsection-name": "subsection-yarn-platform-features-col1"
-        }
-      ]
-    },
-    "widgets": [
-      {
-        "config": "yarn-site/yarn.node-labels.enabled",
-        "widget": {
-          "type": "checkbox"
-        }
-      },
-      {
-        "config": "yarn-env/yarn_cgroups_enabled",
-        "widget": {
-          "type": "checkbox"
-        }
-      }
-    ]
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/623929f5/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 33705f3..a86de57 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -1710,6 +1710,49 @@ class TestHDP22StackAdvisor(TestCase):
     res = self.stackAdvisor.validateHDFSConfigurationsEnv(properties, 
recommendedDefaults, configurations, '', '')
     self.assertEquals(res, res_expected)
 
+  def test_validateYARNConfigurationsEnv(self):
+    configurations = {}
+
+    # 1) ok: No yarn_cgroups_enabled
+    recommendedDefaults = {'namenode_heapsize': '1024',
+                           'namenode_opt_newsize' : '256',
+                           'namenode_opt_maxnewsize' : '256'}
+    properties = {}
+    res_expected = []
+
+    res = self.stackAdvisor.validateYARNEnvConfigurations(properties, 
recommendedDefaults, configurations, '', '')
+    self.assertEquals(res, res_expected)
+
+    # 2) ok: yarn_cgroups_enabled=false, but security enabled
+    properties['yarn_cgroups_enabled'] = 'false'
+    configurations = {
+      "core-site": {
+        "properties": {
+          "hadoop.security.authentication": "kerberos",
+          "hadoop.security.authorization": "true"
+        }
+      }
+    }
+    res_expected = []
+    res = self.stackAdvisor.validateYARNEnvConfigurations(properties, 
recommendedDefaults, configurations, '', '')
+    self.assertEquals(res, res_expected)
+
+    # 3) ok: yarn_cgroups_enabled=true, but security enabled
+    properties['yarn_cgroups_enabled'] = 'true'
+    res_expected = []
+    res = self.stackAdvisor.validateYARNEnvConfigurations(properties, 
recommendedDefaults, configurations, '', '')
+    self.assertEquals(res, res_expected)
+
+    # 4) fail: yarn_cgroups_enabled=true, but security disabled
+    configurations['core-site']['properties']['hadoop.security.authorization'] 
= 'false'
+    res_expected = [{'config-type': 'yarn-env',
+                     'message': 'CPU Isolation should only be enabled if 
security is enabled',
+                     'type': 'configuration',
+                     'config-name': 'yarn_cgroups_enabled',
+                     'level': 'WARN'}]
+    res = self.stackAdvisor.validateYARNEnvConfigurations(properties, 
recommendedDefaults, configurations, '', '')
+    self.assertEquals(res, res_expected)
+
   def test_validateMR2XmxOptsEnv(self):
 
     recommendedDefaults = {'mapreduce.map.java.opts': '-Xmx500m',

Reply via email to