You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/05/27 13:51:44 UTC
ambari git commit: AMBARI-11417. Adding HBase service fails after HA
is enabled (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk b570fc1f7 -> 64ce4989e
AMBARI-11417. Adding HBase service fails after HA is enabled (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64ce4989
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64ce4989
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64ce4989
Branch: refs/heads/trunk
Commit: 64ce4989eee30dc9d83dbc8e7731336ab20f37eb
Parents: b570fc1
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed May 27 14:49:00 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed May 27 14:51:27 2015 +0300
----------------------------------------------------------------------
.../app/controllers/wizard/step7_controller.js | 57 +++++++++++++-------
ambari-web/app/utils/config.js | 2 +-
.../test/controllers/wizard/step7_test.js | 47 ++++++++++++++++
3 files changed, 85 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/64ce4989/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index b8771e5..a3297ff 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -749,32 +749,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
var isInstallableService = App.StackService.find(serviceName).get('isInstallable');
if (!isInstallableService) serviceConfigObj.set('showConfig', false);
}, this);
- // if HA is enabled -> Remove SNameNode, hbase.rootdir should use Name Service ID
+ // if HA is enabled -> Remove SNameNode
if (App.get('isHaEnabled')) {
var c = serviceConfigs.findProperty('serviceName', 'HDFS').configs,
- nameServiceId = c.findProperty('name', 'dfs.nameservices'),
removedConfigs = c.filterProperty('category', 'SECONDARY_NAMENODE');
removedConfigs.setEach('isVisible', false);
serviceConfigs.findProperty('serviceName', 'HDFS').configs = c;
- if(this.get('selectedServiceNames').contains('HBASE') && nameServiceId){
- var hRootDir = serviceConfigs.findProperty('serviceName', 'HBASE').configs.findProperty('name','hbase.rootdir'),
- valueToChange = hRootDir.get('value').replace(/\/\/.*:/i, '//' + nameServiceId.get('value') + ':');
-
- hRootDir.setProperties({
- 'value': valueToChange,
- 'recommendedValue' : valueToChange
- });
- }
- if(this.get('selectedServiceNames').contains('ACCUMULO') && nameServiceId){
- var vols = serviceConfigs.findProperty('serviceName', 'ACCUMULO').configs.findProperty('name','instance.volumes'),
- valueToChange = vols.get('value').replace(/\/\/.*:[0-9]+/i, '//' + nameServiceId.get('value'));
-
- vols.setProperties({
- 'value': valueToChange,
- 'recommendedValue' : valueToChange
- });
- }
+ serviceConfigs = this._reconfigureServicesOnNnHa(serviceConfigs);
}
}
@@ -795,6 +777,41 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * When NameNode HA is enabled some configs based on <code>dfs.nameservices</code> should be changed
+ * This happens only if service is added AFTER NN HA is enabled
+ *
+ * @param {App.ServiceConfig[]} serviceConfigs
+ * @method _reconfigureServiceOnNnHa
+ * @private
+ * @returns {App.ServiceConfig[]}
+ */
+ _reconfigureServicesOnNnHa: function (serviceConfigs) {
+ var selectedServiceNames = this.get('selectedServiceNames');
+ var nameServiceId = serviceConfigs.findProperty('serviceName', 'HDFS').configs.findProperty('name', 'dfs.nameservices');
+ Em.A([
+ {
+ serviceName: 'HBASE',
+ configToUpdate: 'hbase.rootdir'
+ },
+ {
+ serviceName: 'ACCUMULO',
+ configToUpdate: 'instance.volumes'
+ }
+ ]).forEach(function (c) {
+ if (selectedServiceNames.contains(c.serviceName) && nameServiceId) {
+ var cfg = serviceConfigs.findProperty('serviceName', c.serviceName).configs.findProperty('name', c.configToUpdate),
+ newValue = cfg.get('value').replace(/\/\/.*:[0-9]+/i, '//' + nameServiceId.get('value'));
+
+ cfg.setProperties({
+ value: newValue,
+ recommendedValue: newValue
+ });
+ }
+ });
+ return serviceConfigs;
+ },
+
+ /**
* Select first addable service for <code>addServiceWizard</code>
* Select first service at all in other cases
* @method selectProperService
http://git-wip-us.apache.org/repos/asf/ambari/blob/64ce4989/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 976c251..353168b 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -711,7 +711,7 @@ App.config = Em.Object.create({
* @param allSelectedServiceNames
* @param installedServiceNames
* @param localDB
- * @return {Array}
+ * @return {App.ServiceConfig[]}
*/
renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames, localDB) {
var renderedServiceConfigs = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/64ce4989/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index acd3fbf..35bd6d0 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2046,4 +2046,51 @@ describe('App.InstallerStep7Controller', function () {
});
+ describe('#_reconfigureServicesOnNnHa', function () {
+
+ var dfsNameservices = 'some_cluster';
+
+ Em.A([
+ {
+ serviceName: 'HBASE',
+ configToUpdate: 'hbase.rootdir',
+ oldValue: 'hdfs://nameserv:8020/apps/hbase/data',
+ expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/hbase/data'
+ },
+ {
+ serviceName: 'ACCUMULO',
+ configToUpdate: 'instance.volumes',
+ oldValue: 'hdfs://localhost:8020/apps/accumulo/data',
+ expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/accumulo/data'
+ }
+ ]).forEach(function (test) {
+ it(test.serviceName + ' ' + test.configToUpdate, function () {
+ var serviceConfigs = [App.ServiceConfig.create({
+ serviceName: test.serviceName,
+ configs: [
+ Em.Object.create({
+ name: test.configToUpdate,
+ value: test.oldValue
+ })
+ ]
+ }),
+ App.ServiceConfig.create({
+ serviceName: 'HDFS',
+ configs: [
+ Em.Object.create({
+ name: 'dfs.nameservices',
+ value: dfsNameservices
+ })
+ ]
+ })];
+ installerStep7Controller.reopen({
+ selectedServiceNames: [test.serviceName, 'HDFS']
+ });
+ serviceConfigs = installerStep7Controller._reconfigureServicesOnNnHa(serviceConfigs);
+ expect(serviceConfigs.findProperty('serviceName', test.serviceName).configs.findProperty('name', test.configToUpdate).get('value')).to.equal(test.expectedNewValue);
+ });
+ });
+
+ });
+
});