You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by di...@apache.org on 2016/04/08 19:36:55 UTC
ambari git commit: AMBARI-15719: Make list of reassignable components
stack driven instead of hardcoding them in the UI code (dili)
Repository: ambari
Updated Branches:
refs/heads/trunk 49c7dcd15 -> 438657cba
AMBARI-15719: Make list of reassignable components stack driven instead of hardcoding them in the UI code (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/438657cb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/438657cb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/438657cb
Branch: refs/heads/trunk
Commit: 438657cbacabe4bee6f6ac720561a1f659c4f498
Parents: 49c7dcd
Author: Di Li <di...@apache.org>
Authored: Fri Apr 8 13:36:23 2016 -0400
Committer: Di Li <di...@apache.org>
Committed: Fri Apr 8 13:36:23 2016 -0400
----------------------------------------------------------------------
.../StackServiceComponentResponse.java | 28 ++
.../StackServiceComponentResourceProvider.java | 6 +
.../ambari/server/stack/ComponentModule.java | 4 +
.../ambari/server/state/ComponentInfo.java | 16 ++
.../AMBARI_METRICS/0.1.0/metainfo.xml | 1 +
.../common-services/HDFS/2.1.0.2.0/metainfo.xml | 2 +
.../HIVE/0.12.0.2.0/metainfo.xml | 4 +
.../OOZIE/4.0.0.2.0/metainfo.xml | 1 +
.../OOZIE/4.2.0.2.3/metainfo.xml | 1 +
.../common-services/YARN/2.1.0.2.0/metainfo.xml | 2 +
.../src/main/resources/properties.json | 1 +
.../2.0.6.GlusterFS/services/YARN/metainfo.xml | 1 +
.../stacks/HDP/2.1/services/YARN/metainfo.xml | 1 +
.../stacks/HDP/2.2/services/YARN/metainfo.xml | 1 +
.../AmbariManagementControllerTest.java | 51 ++++
.../server/stack/ComponentModuleTest.java | 34 +++
.../stacks/HDP/2.0.5/services/HDFS/metainfo.xml | 1 +
.../stacks/HDP/2.0.5/services/HIVE/metainfo.xml | 2 +
.../stacks/HDP/2.0.6/services/HIVE/metainfo.xml | 261 +++++++++++++++++++
ambari-web/app/mappers/stack_service_mapper.js | 1 +
.../app/models/stack_service_component.js | 6 +-
.../test/mappers/stack_service_mapper_test.js | 2 +
ambari-web/test/service_components.js | 3 +
23 files changed, 428 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 b41ff09..980ca68 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
@@ -106,6 +106,11 @@ public class StackServiceComponentResponse {
private boolean hasBulkCommands;
/**
+ * Whether the component can be reassigned to a different node.
+ * */
+ private String reassignAllowed;
+
+ /**
* Constructor.
*
* @param component
@@ -125,6 +130,7 @@ public class StackServiceComponentResponse {
hasBulkCommands = componentHasBulkCommands(component);
bulkCommandsDisplayName = getBulkCommandsDisplayName(component);
bulkCommandMasterComponentName = getBulkCommandsMasterComponentName(component);
+ reassignAllowed = component.getReassignAllowed();
// the custom command names defined for this component
List<CustomCommandDefinition> definitions = component.getCustomCommands();
@@ -391,6 +397,28 @@ public class StackServiceComponentResponse {
}
/**
+ * Get whether the components can be reassigned.
+ *
+ * @return Whether the components can be reassigned
+ */
+ public boolean isReassignAlllowed() {
+ if (reassignAllowed != null && reassignAllowed.equals("true")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Set whether the component can be reassigned.
+ *
+ * @param reassignAllowed whether the component can be reassigned
+ */
+ public void setReassignAllowed(String reassignAllowed) {
+ this.reassignAllowed = reassignAllowed;
+ }
+
+ /**
* Get whether auto start is enabled.
*
* @return True or false.
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 301bfda..8dc4d2c 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
@@ -65,6 +65,9 @@ public class StackServiceComponentResourceProvider extends
private static final String DECOMISSION_ALLOWED_ID = PropertyHelper.getPropertyId(
"StackServiceComponents", "decommission_allowed");
+ private static final String REASSIGN_ALLOWED_ID = PropertyHelper.getPropertyId(
+ "StackServiceComponents", "reassign_allowed");
+
private static final String CUSTOM_COMMANDS_PROPERTY_ID = PropertyHelper.getPropertyId(
"StackServiceComponents", "custom_commands");
@@ -162,6 +165,9 @@ public class StackServiceComponentResourceProvider extends
setResourceProperty(resource, RECOVERY_ENABLED,
response.isRecoveryEnabled(), requestedIds);
+ setResourceProperty(resource, REASSIGN_ALLOWED_ID,
+ response.isReassignAlllowed(), requestedIds);
+
setResourceProperty(resource, CUSTOM_COMMANDS_PROPERTY_ID,
response.getCustomCommands(), requestedIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 6b3ed76..7a76684 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
@@ -99,6 +99,10 @@ public class ComponentModule extends BaseModule<ComponentModule, ComponentInfo>
componentInfo.setBulkCommands(parentInfo.getBulkCommandDefinition());
}
+ if(componentInfo.getReassignAllowed() == null) {
+ componentInfo.setReassignAllowed(parentInfo.getReassignAllowed());
+ }
+
mergeComponentDependencies(parentInfo.getDependencies(),
componentInfo.getDependencies());
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 2205316..5e576a8 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
@@ -120,6 +120,11 @@ public class ComponentInfo {
@XmlElements(@XmlElement(name = "recovery_enabled"))
private boolean recoveryEnabled = false;
+ /**
+ * Used to determine if reassign is allowed
+ * */
+ @XmlElements(@XmlElement(name = "reassignAllowed"))
+ private String reassignAllowed;
private String timelineAppid;
@@ -146,6 +151,7 @@ public class ComponentInfo {
configDependencies = prototype.configDependencies;
clientConfigFiles = prototype.clientConfigFiles;
timelineAppid = prototype.timelineAppid;
+ reassignAllowed = prototype.reassignAllowed;
}
public String getName() {
@@ -329,6 +335,14 @@ public class ComponentInfo {
this.timelineAppid = timelineAppid;
}
+ public String getReassignAllowed() {
+ return reassignAllowed;
+ }
+
+ public void setReassignAllowed(String reassignAllowed) {
+ this.reassignAllowed = reassignAllowed;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -341,6 +355,7 @@ public class ComponentInfo {
if (cardinality != null ? !cardinality.equals(that.cardinality) : that.cardinality != null) return false;
if (versionAdvertised != that.versionAdvertised) return false;
if (decommissionAllowed != null ? !decommissionAllowed.equals(that.decommissionAllowed) : that.decommissionAllowed != null) return false;
+ if (reassignAllowed != null ? !reassignAllowed.equals(that.reassignAllowed) : that.reassignAllowed != null) 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;
@@ -370,6 +385,7 @@ public class ComponentInfo {
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 + (reassignAllowed != null ? reassignAllowed.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/438657cb/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
index f8131c0..ff8a4c3 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
@@ -31,6 +31,7 @@
<category>MASTER</category>
<cardinality>1+</cardinality>
<versionAdvertised>false</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<timelineAppid>AMS-HBASE</timelineAppid>
<recovery_enabled>true</recovery_enabled>
<dependencies>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 ebe0de8..86b021d 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
@@ -31,6 +31,7 @@
<category>MASTER</category>
<cardinality>1-2</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<commandScript>
<script>scripts/namenode.py</script>
<scriptType>PYTHON</scriptType>
@@ -94,6 +95,7 @@
<!-- TODO: cardinality is conditional on HA usage -->
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<category>MASTER</category>
<commandScript>
<script>scripts/snamenode.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
index 1f09364..fae9556 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
@@ -31,6 +31,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
<auto-deploy>
<enabled>true</enabled>
@@ -57,6 +58,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
<dependencies>
<dependency>
@@ -101,6 +103,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<clientsToUpdateConfigs>
<client>HCAT</client>
</clientsToUpdateConfigs>
@@ -171,6 +174,7 @@
<category>MASTER</category>
<cardinality>0-1</cardinality>
<versionAdvertised>false</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
<commandScript>
<script>scripts/mysql_server.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
index bd1b193..ed45439 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
@@ -31,6 +31,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<dependencies>
<dependency>
<name>HDFS/HDFS_CLIENT</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
index f1e377b..9502b94 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
@@ -32,6 +32,7 @@
<category>MASTER</category>
<cardinality>1+</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<dependencies>
<dependency>
<name>HDFS/HDFS_CLIENT</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 1323e8d..702ccb8 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
@@ -32,6 +32,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<commandScript>
<script>scripts/resourcemanager.py</script>
<scriptType>PYTHON</scriptType>
@@ -197,6 +198,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<auto-deploy>
<enabled>true</enabled>
<co-locate>YARN/RESOURCEMANAGER</co-locate>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 627e22b..eac0dbd 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -246,6 +246,7 @@
"StackServiceComponents/recovery_enabled",
"StackServiceComponents/advertise_version",
"StackServiceComponents/decommission_allowed",
+ "StackServiceComponents/reassign_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/438657cb/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/services/YARN/metainfo.xml
index 64fab13..695b33f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/services/YARN/metainfo.xml
@@ -30,6 +30,7 @@
<displayName>App Timeline Server</displayName>
<category>MASTER</category>
<cardinality>1</cardinality>
+ <reassignAllowed>true</reassignAllowed>
<commandScript>
<script>scripts/application_timeline_server.py</script>
<scriptType>PYTHON</scriptType>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/metainfo.xml
index a508673..077ae90 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/metainfo.xml
@@ -29,6 +29,7 @@
<displayName>App Timeline Server</displayName>
<category>MASTER</category>
<cardinality>0-1</cardinality>
+ <reassignAllowed>true</reassignAllowed>
<commandScript>
<script>scripts/application_timeline_server.py</script>
<scriptType>PYTHON</scriptType>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml
index eeb71fb..5e44ced 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml
@@ -27,6 +27,7 @@
<component>
<name>APP_TIMELINE_SERVER</name>
<cardinality>1</cardinality>
+ <reassignAllowed>true</reassignAllowed>
</component>
</components>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 caaf6a9..186ebe7 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
@@ -182,6 +182,9 @@ public class AmbariManagementControllerTest {
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";
+ private static final String SERVICE_NAME_HIVE = "HIVE";
+ private static final String COMPONENT_NAME_HIVE_METASTORE = "HIVE_METASTORE";
+ private static final String COMPONENT_NAME_HIVE_SERVER = "HIVE_SERVER";
private static final String STACK_VERSION = "0.2";
private static final String NEW_STACK_VERSION = "2.0.6";
private static final String OS_TYPE = "centos5";
@@ -7465,6 +7468,54 @@ public class AmbariManagementControllerTest {
}
@Test
+ public void testRassignAllowed() throws Exception{
+ StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME, "2.0.5", SERVICE_NAME, COMPONENT_NAME);
+ Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+ for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+ Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME);
+ Assert.assertTrue(responseWithParams.isReassignAlllowed());
+ }
+
+ requestWithParams = new StackServiceComponentRequest(STACK_NAME, "2.0.5", SERVICE_NAME, COMPONENT_NAME_DATANODE);
+ responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+ for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+ Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_DATANODE);
+ Assert.assertFalse(responseWithParams.isReassignAlllowed());
+ }
+ }
+
+ @Test
+ public void testReassignAllowedInheritance() throws Exception{
+ //parent has it, child doesn't
+ StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME, NEW_STACK_VERSION, SERVICE_NAME_HIVE, COMPONENT_NAME_HIVE_METASTORE);
+ Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+ for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+ Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_HIVE_METASTORE);
+ Assert.assertTrue(responseWithParams.isReassignAlllowed());
+ }
+ }
+
+ @Test
+ public void testReassignAllowedOverwrite() throws Exception{
+ StackServiceComponentRequest requestWithParams = new StackServiceComponentRequest(STACK_NAME, "2.0.5", SERVICE_NAME_HIVE, COMPONENT_NAME_HIVE_SERVER);
+ Set<StackServiceComponentResponse> responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+
+ //parent has it
+ for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+ Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_HIVE_SERVER);
+ Assert.assertTrue(responseWithParams.isReassignAlllowed());
+ }
+
+ requestWithParams = new StackServiceComponentRequest(STACK_NAME, NEW_STACK_VERSION, SERVICE_NAME_HIVE, COMPONENT_NAME_HIVE_SERVER);
+ responsesWithParams = controller.getStackComponents(Collections.singleton(requestWithParams));
+ //parent has it, child overwrites it
+ for (StackServiceComponentResponse responseWithParams: responsesWithParams) {
+ Assert.assertEquals(responseWithParams.getComponentName(), COMPONENT_NAME_HIVE_SERVER);
+ Assert.assertFalse(responseWithParams.isReassignAlllowed());
+ }
+ }
+
+ @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/438657cb/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 a3d9655..a02311a 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
@@ -444,6 +444,40 @@ public class ComponentModuleTest {
assertSame("true", resolveComponent(info, parentInfo).getModuleInfo().getDecommissionAllowed());
}
+ @Test
+ public void testResolve_Reassignable(){
+ List<ComponentInfo> components = createComponentInfo(2);
+ ComponentInfo info = components.get(0);
+ ComponentInfo parentInfo = components.get(1);
+
+ //parent doesn't have it, child has it
+ info.setReassignAllowed("false");
+ assertSame("false", resolveComponent(info, parentInfo).getModuleInfo().getReassignAllowed());
+ }
+
+ @Test
+ public void testResolve_ReassignableInheritance(){
+ List<ComponentInfo> components = createComponentInfo(2);
+ ComponentInfo info = components.get(0);
+ ComponentInfo parentInfo = components.get(1);
+
+ //parent has it, child doesn't
+ parentInfo.setReassignAllowed("true");
+ assertSame("true", resolveComponent(info, parentInfo).getModuleInfo().getReassignAllowed());
+ }
+
+ @Test
+ public void testResolve_ReassignableOverwrite(){
+ List<ComponentInfo> components = createComponentInfo(2);
+ ComponentInfo info = components.get(0);
+ ComponentInfo parentInfo = components.get(1);
+
+ //parent has it, child overwrites it
+ parentInfo.setReassignAllowed("false");
+ info.setReassignAllowed("true");
+ assertSame("true", resolveComponent(info, parentInfo).getModuleInfo().getReassignAllowed());
+ }
+
private List<ComponentInfo> createComponentInfo(int count){
List<ComponentInfo> result = new ArrayList<ComponentInfo>();
if(count > 0) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 8ffd055..600f56e 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
@@ -29,6 +29,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<versionAdvertised>true</versionAdvertised>
+ <reassignAllowed>true</reassignAllowed>
<commandScript>
<script>scripts/namenode.py</script>
<scriptType>PYTHON</scriptType>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml
index 35f77f8..3224eac 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml
@@ -28,6 +28,7 @@
<name>HIVE_METASTORE</name>
<category>MASTER</category>
<cardinality>1</cardinality>
+ <reassignAllowed>true</reassignAllowed>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
<auto-deploy>
<enabled>true</enabled>
@@ -48,6 +49,7 @@
<category>MASTER</category>
<cardinality>1</cardinality>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
+ <reassignAllowed>true</reassignAllowed>
<dependencies>
<dependency>
<name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml
new file mode 100644
index 0000000..edc5dfb
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml
@@ -0,0 +1,261 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<metainfo>
+ <schemaVersion>2.0</schemaVersion>
+ <services>
+ <service>
+ <name>HIVE</name>
+ <comment>Data warehouse system for ad-hoc queries & analysis of large datasets and table & storage management service</comment>
+ <version>0.11.0.2.0.5.0</version>
+ <components>
+
+ <component>
+ <name>HIVE_METASTORE</name>
+ <category>MASTER</category>
+ <cardinality>1</cardinality>
+ <clientsToUpdateConfigs></clientsToUpdateConfigs>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER</co-locate>
+ </auto-deploy>
+ <commandScript>
+ <script>scripts/hive_metastore.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>600</timeout>
+ </commandScript>
+ <configuration-dependencies>
+ <config-type>hive-site</config-type>
+ </configuration-dependencies>
+ </component>
+
+ <component>
+ <name>HIVE_SERVER</name>
+ <category>MASTER</category>
+ <cardinality>1</cardinality>
+ <clientsToUpdateConfigs></clientsToUpdateConfigs>
+ <reassignAllowed>false</reassignAllowed>
+ <dependencies>
+ <dependency>
+ <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+ <scope>cluster</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER</co-locate>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>TEZ/TEZ_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>YARN/YARN_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>MAPREDUCE2/MAPREDUCE2_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ </dependencies>
+ <commandScript>
+ <script>scripts/hive_server.py</script>
+ <scriptType>PYTHON</scriptType>
+ </commandScript>
+ <configuration-dependencies>
+ <config-type>hive-site</config-type>
+ </configuration-dependencies>
+ </component>
+
+ <component>
+ <name>WEBHCAT_SERVER</name>
+ <displayName>WebHCat Server</displayName>
+ <category>MASTER</category>
+ <cardinality>1</cardinality>
+ <clientsToUpdateConfigs>
+ <client>HCAT</client>
+ </clientsToUpdateConfigs>
+ <dependencies>
+ <dependency>
+ <name>HDFS/HDFS_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>MAPREDUCE/MAPREDUCE_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+ <scope>cluster</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>WEBHCAT/WEBHCAT_SERVER</co-locate>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>ZOOKEEPER/ZOOKEEPER_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ </auto-deploy>
+ </dependency>
+ </dependencies>
+ <commandScript>
+ <script>scripts/webhcat_server.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>600</timeout>
+ </commandScript>
+ <configuration-dependencies>
+ <config-type>hive-site</config-type>
+ </configuration-dependencies>
+ </component>
+
+ <component>
+ <name>MYSQL_SERVER</name>
+ <category>MASTER</category>
+ <cardinality>1</cardinality>
+ <commandScript>
+ <script>scripts/mysql_server.py</script>
+ <scriptType>PYTHON</scriptType>
+ </commandScript>
+ </component>
+
+ <component>
+ <name>HIVE_CLIENT</name>
+ <category>CLIENT</category>
+ <cardinality>0+</cardinality>
+ <commandScript>
+ <script>scripts/hive_client.py</script>
+ <scriptType>PYTHON</scriptType>
+ </commandScript>
+ <configFiles>
+ <configFile>
+ <type>xml</type>
+ <fileName>hive-site.xml</fileName>
+ <dictionaryName>hive-site</dictionaryName>
+ </configFile>
+ <configFile>
+ <type>env</type>
+ <fileName>hive-env.sh</fileName>
+ <dictionaryName>hive-env</dictionaryName>
+ </configFile>
+ </configFiles>
+ <configuration-dependencies>
+ <config-type>hive-site</config-type>
+ </configuration-dependencies>
+ </component>
+ <component>
+ <name>HCAT</name>
+ <displayName>HCat</displayName>
+ <category>CLIENT</category>
+ <commandScript>
+ <script>scripts/hcat_client.py</script>
+ <scriptType>PYTHON</scriptType>
+ </commandScript>
+ <configFiles>
+ <configFile>
+ <type>xml</type>
+ <fileName>hive-site.xml</fileName>
+ <dictionaryName>hive-site</dictionaryName>
+ </configFile>
+ <configFile>
+ <type>env</type>
+ <fileName>hive-env.sh</fileName>
+ <dictionaryName>hive-env</dictionaryName>
+ </configFile>
+ <configFile>
+ <type>env</type>
+ <fileName>hive-log4j.properties</fileName>
+ <dictionaryName>hive-log4j</dictionaryName>
+ </configFile>
+ <configFile>
+ <type>env</type>
+ <fileName>hive-exec-log4j.properties</fileName>
+ <dictionaryName>hive-exec-log4j</dictionaryName>
+ </configFile>
+ </configFiles>
+ <configuration-dependencies>
+ <config-type>hive-site</config-type>
+ </configuration-dependencies>
+ </component>
+ </components>
+
+ <osSpecifics>
+ <osSpecific>
+ <osFamily>any</osFamily>
+ <packages>
+ <package>
+ <name>hive</name>
+ </package>
+ <package>
+ <name>mysql-connector-java</name>
+ </package>
+ </packages>
+ </osSpecific>
+ <osSpecific>
+ <osFamily>redhat5,redhat6,suse11</osFamily>
+ <packages>
+ <package>
+ <name>mysql</name>
+ </package>
+ </packages>
+ </osSpecific>
+ <osSpecific>
+ <osFamily>redhat5,redhat6,ubuntu12</osFamily>
+ <packages>
+ <package>
+ <name>mysql-server</name>
+ </package>
+ </packages>
+ </osSpecific>
+ <osSpecific>
+ <osFamily>suse11</osFamily>
+ <packages>
+ <package>
+ <name>mysql-client</name>
+ </package>
+ </packages>
+ </osSpecific>
+ </osSpecifics>
+
+ <commandScript>
+ <script>scripts/service_check.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>300</timeout>
+ </commandScript>
+
+ <configuration-dependencies>
+ <config-type>hive-log4j</config-type>
+ <config-type>hive-exec-log4j</config-type>
+ </configuration-dependencies>
+ </service>
+ </services>
+</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 b837452..91a4370 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',
+ reassign_allowed : 'reassign_allowed',
decommission_allowed: 'decommission_allowed',
has_bulk_commands_definition: 'has_bulk_commands_definition',
bulk_commands_display_name: 'bulk_commands_display_name',
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 690c32f..26244f7 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'),
+ reassignAllowed: DS.attr('boolean'),
decommissionAllowed: DS.attr('boolean'),
hasBulkCommandsDefinition: DS.attr('boolean'),
bulkCommandsDisplayName: DS.attr('string'),
@@ -72,8 +73,9 @@ App.StackServiceComponent = DS.Model.extend({
isRestartable: Em.computed.not('isClient'),
/** @property {Boolean} isReassignable - component supports reassign action **/
- isReassignable: Em.computed.existsIn('componentName', ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER', 'APP_TIMELINE_SERVER', 'OOZIE_SERVER',
- 'WEBHCAT_SERVER', 'HIVE_SERVER', 'HIVE_METASTORE', 'MYSQL_SERVER', 'METRICS_COLLECTOR', 'HISTORYSERVER']),
+ isReassignable: function(){
+ return this.get('reassignAllowed');
+ }.property('reassignAllowed'),
/** @property {Boolean} isNonHDPComponent - component not belongs to HDP services **/
isNonHDPComponent: function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/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 2f82bb1..b64688f 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -129,6 +129,7 @@ describe('App.stackServiceMapper', function () {
"bulk_commands_display_name" : "DataNodes",
"bulk_commands_master_component_name" : "NAMENODE",
"has_bulk_commands_definition" : true,
+ "reassign_allowed" : true,
"cardinality" : "1+",
"display_name" : "DataNode",
"is_client" : false,
@@ -252,6 +253,7 @@ describe('App.stackServiceMapper', function () {
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;
+ expect(components.findProperty('componentName', 'DATANODE').get('reassignAllowed')).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/438657cb/ambari-web/test/service_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/service_components.js b/ambari-web/test/service_components.js
index 614ffa8..bcc4a29 100644
--- a/ambari-web/test/service_components.js
+++ b/ambari-web/test/service_components.js
@@ -557,6 +557,7 @@ module.exports = {
"custom_commands" : [ ],
"is_client" : false,
"is_master" : true,
+ "reassign_allowed" : true,
"service_name" : "HIVE",
"stack_name" : "HDP",
"stack_version" : "2.1"
@@ -577,6 +578,7 @@ module.exports = {
"custom_commands" : [ ],
"is_client" : false,
"is_master" : true,
+ "reassign_allowed" : true,
"service_name" : "HIVE",
"stack_name" : "HDP",
"stack_version" : "2.1"
@@ -1284,6 +1286,7 @@ module.exports = {
"custom_commands" : [ ],
"is_client" : false,
"is_master" : true,
+ "reassign_allowed" : true,
"service_name" : "YARN",
"stack_name" : "HDP",
"stack_version" : "2.1"