ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-15470: List of decommission-allowed components should be stack driven (dili)
Date Tue, 05 Apr 2016 18:45:54 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3de6be60a -> 3811e1921


AMBARI-15470: List of decommission-allowed components should be stack driven (dili)


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

Branch: refs/heads/trunk
Commit: 3811e1921599dae035cce4ebc5bddaf982837045
Parents: 3de6be6
Author: Di Li <dili@apache.org>
Authored: Tue Apr 5 14:45:19 2016 -0400
Committer: Di Li <dili@apache.org>
Committed: Tue Apr 5 14:45:19 2016 -0400

----------------------------------------------------------------------
 .../StackServiceComponentResponse.java          | 28 +++++++++++++
 .../StackServiceComponentResourceProvider.java  |  6 +++
 .../ambari/server/stack/ComponentModule.java    |  5 +++
 .../ambari/server/state/ComponentInfo.java      | 17 ++++++++
 .../HBASE/0.96.0.2.0/metainfo.xml               |  1 +
 .../common-services/HDFS/2.1.0.2.0/metainfo.xml |  1 +
 .../common-services/YARN/2.1.0.2.0/metainfo.xml |  1 +
 .../src/main/resources/properties.json          |  1 +
 .../AmbariManagementControllerTest.java         | 43 +++++++++++++++++++
 .../server/stack/ComponentModuleTest.java       | 44 ++++++++++++++++++++
 .../stacks/HDP/2.0.5/services/HDFS/metainfo.xml |  1 +
 .../stacks/HDP/2.0.5/services/YARN/metainfo.xml |  1 +
 .../HDP/2.0.6/services/HBASE/metainfo.xml       |  1 +
 .../stacks/HDP/2.0.6/services/YARN/metainfo.xml |  1 +
 ambari-web/app/mappers/stack_service_mapper.js  |  1 +
 .../app/models/stack_service_component.js       |  5 ++-
 .../test/mappers/stack_service_mapper_test.js   |  2 +
 ambari-web/test/service_components.js           |  2 +
 18 files changed, 160 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
index c7ffe75..b41ff09 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
@@ -82,6 +82,11 @@ public class StackServiceComponentResponse {
   private boolean versionAdvertised;
 
   /**
+   * Whether the component can be decommissioned.
+   * */
+  private String decommissionAllowed;
+
+  /**
    * auto deploy information
    */
   private AutoDeployInfo autoDeploy;
@@ -114,6 +119,7 @@ public class StackServiceComponentResponse {
     isMaster = component.isMaster();
     cardinality = component.getCardinality();
     versionAdvertised = component.isVersionAdvertised();
+    decommissionAllowed = component.getDecommissionAllowed();
     autoDeploy = component.getAutoDeploy();
     recoveryEnabled = component.isRecoveryEnabled();
     hasBulkCommands = componentHasBulkCommands(component);
@@ -363,6 +369,28 @@ public class StackServiceComponentResponse {
   }
 
   /**
+   * Get whether the components can be decommissioned.
+   *
+   * @return Whether the components can be decommissioned
+   */
+  public boolean isDecommissionAlllowed() {
+    if (decommissionAllowed != null && decommissionAllowed.equals("true")) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * Set whether the component can be decommissioned.
+   *
+   * @param decommissionAllowed whether the component can be decommissioned
+   */
+  public void setDecommissionAllowed(String decommissionAllowed) {
+    this.decommissionAllowed = decommissionAllowed;
+  }
+
+  /**
    * Get whether auto start is enabled.
    *
    * @return True or false.

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
index 8ea7569..301bfda 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
@@ -62,6 +62,9 @@ public class StackServiceComponentResourceProvider extends
   private static final String ADVERTISE_VERSION_ID = PropertyHelper.getPropertyId(
       "StackServiceComponents", "advertise_version");
 
+  private static final String DECOMISSION_ALLOWED_ID = PropertyHelper.getPropertyId(
+      "StackServiceComponents", "decommission_allowed");
+
   private static final String CUSTOM_COMMANDS_PROPERTY_ID = PropertyHelper.getPropertyId(
       "StackServiceComponents", "custom_commands");
 
@@ -153,6 +156,9 @@ public class StackServiceComponentResourceProvider extends
       setResourceProperty(resource, ADVERTISE_VERSION_ID,
           response.isVersionAdvertised(), requestedIds);
 
+      setResourceProperty(resource, DECOMISSION_ALLOWED_ID,
+          response.isDecommissionAlllowed(), requestedIds);
+
       setResourceProperty(resource, RECOVERY_ENABLED,
           response.isRecoveryEnabled(), requestedIds);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
index a3e06a5..6b3ed76 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
@@ -84,6 +84,11 @@ public class ComponentModule extends BaseModule<ComponentModule, ComponentInfo>
         componentInfo.setCardinality(parentInfo.getCardinality());
       }
       componentInfo.setVersionAdvertised(parentInfo.isVersionAdvertised());
+
+      if(componentInfo.getDecommissionAllowed() == null) {
+        componentInfo.setDecommissionAllowed(parentInfo.getDecommissionAllowed());
+      }
+
       if (componentInfo.getAutoDeploy() == null) {
         componentInfo.setAutoDeploy(parentInfo.getAutoDeploy());
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
index 9fb3ef6..f676dab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
@@ -51,6 +51,12 @@ public class ComponentInfo {
   private boolean versionAdvertised = false;
 
   /**
+   * Used to determine if decommission is allowed
+   * */
+  @XmlElements(@XmlElement(name = "decommissionAllowed"))
+  private String decommissionAllowed;
+
+  /**
   * Added at schema ver 2
   */
   private CommandScriptDefinition commandScript;
@@ -129,6 +135,7 @@ public class ComponentInfo {
     deleted = prototype.deleted;
     cardinality = prototype.cardinality;
     versionAdvertised = prototype.versionAdvertised;
+    decommissionAllowed = prototype.decommissionAllowed;
     clientsToUpdateConfigs = prototype.clientsToUpdateConfigs;
     commandScript = prototype.commandScript;
     logs = prototype.logs;
@@ -290,6 +297,14 @@ public class ComponentInfo {
     return versionAdvertised;
   }
 
+  public String getDecommissionAllowed() {
+    return decommissionAllowed;
+  }
+
+  public void setDecommissionAllowed(String decommissionAllowed) {
+    this.decommissionAllowed = decommissionAllowed;
+  }
+
   public void setRecoveryEnabled(boolean recoveryEnabled) {
     this.recoveryEnabled = recoveryEnabled;
   }
@@ -325,6 +340,7 @@ public class ComponentInfo {
     if (autoDeploy != null ? !autoDeploy.equals(that.autoDeploy) : that.autoDeploy != null)
return false;
     if (cardinality != null ? !cardinality.equals(that.cardinality) : that.cardinality !=
null) return false;
     if (versionAdvertised != that.versionAdvertised) return false;
+    if (decommissionAllowed != that.decommissionAllowed) return false;
     if (category != null ? !category.equals(that.category) : that.category != null) return
false;
     if (clientConfigFiles != null ? !clientConfigFiles.equals(that.clientConfigFiles) : that.clientConfigFiles
!= null)
       return false;
@@ -353,6 +369,7 @@ public class ComponentInfo {
     result = 31 * result + (deleted ? 1 : 0);
     result = 31 * result + (cardinality != null ? cardinality.hashCode() : 0);
     result = 31 * result + (versionAdvertised ? 1 : 0);
+    result = 31 * result + (decommissionAllowed != null ? decommissionAllowed.hashCode()
: 0);
     result = 31 * result + (commandScript != null ? commandScript.hashCode() : 0);
     result = 31 * result + (logs != null ? logs.hashCode() : 0);
     result = 31 * result + (clientConfigFiles != null ? clientConfigFiles.hashCode() : 0);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
index f910677..db46879 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
@@ -78,6 +78,7 @@
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
+          <decommissionAllowed>true</decommissionAllowed>
           <timelineAppid>HBASE</timelineAppid>
           <commandScript>
             <script>scripts/hbase_regionserver.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index b445f28..ebe0de8 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -70,6 +70,7 @@
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
+          <decommissionAllowed>true</decommissionAllowed>
           <commandScript>
             <script>scripts/datanode.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
index 8f954c8..ea52a69 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
@@ -84,6 +84,7 @@
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
+          <decommissionAllowed>true</decommissionAllowed>
           <commandScript>
             <script>scripts/nodemanager.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index c5f720a..627e22b 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -245,6 +245,7 @@
         "StackServiceComponents/custom_commands",
         "StackServiceComponents/recovery_enabled",
         "StackServiceComponents/advertise_version",
+        "StackServiceComponents/decommission_allowed",
         "StackServiceComponents/has_bulk_commands_definition",
         "StackServiceComponents/bulk_commands_display_name",
         "StackServiceComponents/bulk_commands_master_component_name",

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index d6fcba2..05f3dcf 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -176,6 +176,8 @@ public class AmbariManagementControllerTest {
 
   private static final String STACK_NAME = "HDP";
 
+  private static final String SERVICE_NAME_YARN = "YARN";
+  private static final String COMPONENT_NAME_NODEMANAGER = "NODEMANAGER";
   private static final String SERVICE_NAME_HBASE = "HBASE";
   private static final String COMPONENT_NAME_REGIONSERVER = "HBASE_REGIONSERVER";
   private static final String COMPONENT_NAME_DATANODE = "DATANODE";
@@ -7418,6 +7420,47 @@ public class AmbariManagementControllerTest {
   }
 
   @Test
+  public void testDecommissionAllowed() throws Exception{
+    StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME,
NEW_STACK_VERSION, SERVICE_NAME_HBASE, COMPONENT_NAME_REGIONSERVER);
+    Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+    for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+      Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_REGIONSERVER);
+      Assert.assertTrue(responseWithParams.isDecommissionAlllowed());
+    }
+  }
+
+  @Test
+  public void testDecommissionAllowedInheritance() throws Exception{
+    //parent has it, child doesn't
+    StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME,
NEW_STACK_VERSION, SERVICE_NAME, COMPONENT_NAME_DATANODE);
+    Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+    for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+      Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_DATANODE);
+      Assert.assertTrue(responseWithParams.isDecommissionAlllowed());
+    }
+  }
+
+  @Test
+  public void testDecommissionAllowedOverwrite() throws Exception{
+    StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME,
"2.0.5", SERVICE_NAME_YARN, COMPONENT_NAME_NODEMANAGER);
+    Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+
+    //parent has it
+    for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+      Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_NODEMANAGER);
+      Assert.assertFalse(responseWithParams.isDecommissionAlllowed());
+    }
+
+    requestWithParams = new StackServiceComponentRequest(STACK_NAME, NEW_STACK_VERSION, SERVICE_NAME_YARN,
COMPONENT_NAME_NODEMANAGER);
+    responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+    //parent has it, child overwrites it
+    for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+      Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_NODEMANAGER);
+      Assert.assertTrue(responseWithParams.isDecommissionAlllowed());
+    }
+  }
+
+  @Test
   public void testBulkCommandsInheritence() throws Exception{
     //HDP 2.0.6 inherit HDFS configurations from HDP 2.0.5
     StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME,
NEW_STACK_VERSION, SERVICE_NAME, COMPONENT_NAME_DATANODE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
index 86fad13..a3d9655 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
@@ -410,6 +410,50 @@ public class ComponentModuleTest {
     assertSame(bulkCommandsDefinition, resolveComponent(info, parentInfo).getModuleInfo().getBulkCommandDefinition());
   }
 
+  @Test
+  public void testResolve_DecommissionAllowedInheritance(){
+    List<ComponentInfo> components = createComponentInfo(2);
+    ComponentInfo info = components.get(0);
+    ComponentInfo parentInfo = components.get(1);
+
+    //parent has it, child doesn't
+    parentInfo.setDecommissionAllowed("true");
+    assertSame("true", resolveComponent(info, parentInfo).getModuleInfo().getDecommissionAllowed());
+  }
+
+  @Test
+  public void testResolve_DecommissionAllowed(){
+    List<ComponentInfo> components = createComponentInfo(2);
+    ComponentInfo info = components.get(0);
+    ComponentInfo parentInfo = components.get(1);
+
+    //parent doesn't have it, child has it
+    info.setDecommissionAllowed("false");
+    assertSame("false", resolveComponent(info, parentInfo).getModuleInfo().getDecommissionAllowed());
+  }
+
+  @Test
+  public void testResolve_DecommissionAllowedOverwrite(){
+    List<ComponentInfo> components = createComponentInfo(2);
+    ComponentInfo info = components.get(0);
+    ComponentInfo parentInfo = components.get(1);
+
+    //parent has it, child overwrites it
+    parentInfo.setDecommissionAllowed("false");
+    info.setDecommissionAllowed("true");
+    assertSame("true", resolveComponent(info, parentInfo).getModuleInfo().getDecommissionAllowed());
+  }
+
+  private List<ComponentInfo> createComponentInfo(int count){
+    List<ComponentInfo> result = new ArrayList<ComponentInfo>();
+    if(count > 0) {
+      for(int i = 0; i < count; i++){
+        result.add(new ComponentInfo());
+      }
+    }
+    return result;
+  }
+
   private ComponentModule resolveComponent(ComponentInfo info, ComponentInfo parentInfo)
{
     info.setName("FOO");
     parentInfo.setName("FOO");

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
index d00b0b1..8ffd055 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
@@ -60,6 +60,7 @@
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
+          <decommissionAllowed>true</decommissionAllowed>
           <commandScript>
             <script>scripts/datanode.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/YARN/metainfo.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/YARN/metainfo.xml
index 40e6957..d479a20 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/YARN/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/YARN/metainfo.xml
@@ -60,6 +60,7 @@
           <name>NODEMANAGER</name>
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
+          <decommissionAllowed>false</decommissionAllowed>
           <commandScript>
             <script>scripts/nodemanager.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HBASE/metainfo.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HBASE/metainfo.xml
index 2e02427..bedeecc 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HBASE/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HBASE/metainfo.xml
@@ -66,6 +66,7 @@
           <name>HBASE_REGIONSERVER</name>
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
+          <decommissionAllowed>true</decommissionAllowed>
           <commandScript>
             <script>scripts/hbase_regionserver.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml
index de0b1c0..8ce291c 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml
@@ -64,6 +64,7 @@
           <displayName>NodeManager</displayName>
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
+          <decommissionAllowed>true</decommissionAllowed>
           <commandScript>
             <script>scripts/nodemanager.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index 6bcd6b5..b837452 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -51,6 +51,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     display_name: 'display_name',
     cardinality: 'cardinality',
     custom_commands: 'custom_commands',
+    decommission_allowed: 'decommission_allowed',
     has_bulk_commands_definition: 'has_bulk_commands_definition',
     bulk_commands_display_name: 'bulk_commands_display_name',
     bulk_commands_master_component_name: 'bulk_commands_master_component_name',

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index 850088b..690c32f 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -27,6 +27,7 @@ App.StackServiceComponent = DS.Model.extend({
   displayName: DS.attr('string'),
   cardinality: DS.attr('string'),
   customCommands: DS.attr('array'),
+  decommissionAllowed: DS.attr('boolean'),
   hasBulkCommandsDefinition: DS.attr('boolean'),
   bulkCommandsDisplayName: DS.attr('string'),
   bulkCommandsMasterComponentName: DS.attr('string'),
@@ -85,7 +86,9 @@ App.StackServiceComponent = DS.Model.extend({
   }.property('componentName'),
 
   /** @property {Boolean} isDecommissionAllowed - component supports decommission action
**/
-  isDecommissionAllowed: Em.computed.existsIn('componentName', ['DATANODE', 'TASKTRACKER',
'NODEMANAGER', 'HBASE_REGIONSERVER']),
+  isDecommissionAllowed: function() {
+   return this.get('decommissionAllowed');
+  }.property('decommissionAllowed'),
 
   /** @property {Boolean} isRefreshConfigsAllowed - component supports refresh configs action
**/
   isRefreshConfigsAllowed: Em.computed.existsIn('componentName', ['FLUME_HANDLER']),

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-web/test/mappers/stack_service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js
index e999999..2f82bb1 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -125,6 +125,7 @@ describe('App.stackServiceMapper', function () {
                   "component_category" : "SLAVE",
                   "component_name" : "DATANODE",
                   "custom_commands" : [ ],
+                  "decommission_allowed" : true,
                   "bulk_commands_display_name" : "DataNodes",
                   "bulk_commands_master_component_name" : "NAMENODE",
                   "has_bulk_commands_definition" : true,
@@ -250,6 +251,7 @@ describe('App.stackServiceMapper', function () {
       expect(components.findProperty('componentName', 'DATANODE').get('hasBulkCommandsDefinition')).to.be.true;
       expect(components.findProperty('componentName', 'DATANODE').get('bulkCommandsDisplayName')).to.eql("DataNodes");
       expect(components.findProperty('componentName', 'DATANODE').get('bulkCommandsMasterComponentName')).to.eql("NAMENODE");
+      expect(components.findProperty('componentName', 'DATANODE').get('decommissionAllowed')).to.be.true;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/3811e192/ambari-web/test/service_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/service_components.js b/ambari-web/test/service_components.js
index e9791ff..614ffa8 100644
--- a/ambari-web/test/service_components.js
+++ b/ambari-web/test/service_components.js
@@ -392,6 +392,7 @@ module.exports = {
             "component_name" : "DATANODE",
             "display_name" : "DataNode",
             "custom_commands" : [ ],
+            "decommission_allowed" : true,
             "is_client" : false,
             "is_master" : false,
             "service_name" : "HDFS",
@@ -1297,6 +1298,7 @@ module.exports = {
             "component_name" : "NODEMANAGER",
             "display_name" : "NodeManager",
             "custom_commands" : [ ],
+            "decommission_allowed" : false,
             "is_client" : false,
             "is_master" : false,
             "service_name" : "YARN",


Mime
View raw message