ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject ambari git commit: AMBARI-14528. Hawq yarn-client.xml HA parameters should be shown on UI if yarn rm ha is enabled (Bhuvnesh Chaudhary via odiachenko).
Date Wed, 06 Jan 2016 19:53:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 6d7f13bd4 -> 15e2da6ff


AMBARI-14528. Hawq yarn-client.xml HA parameters should be shown on UI if yarn rm ha is enabled
(Bhuvnesh Chaudhary via odiachenko).


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

Branch: refs/heads/branch-2.2
Commit: 15e2da6ff31de76c4e8f3080fa3dc44e7755621f
Parents: 6d7f13b
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Wed Jan 6 11:52:04 2016 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Wed Jan 6 11:53:08 2016 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 55 ++++++++++++++++++--
 .../test/controllers/wizard/step7_test.js       | 43 +++++++++++++++
 2 files changed, 95 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15e2da6f/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 10afd29..a1788aa 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -703,9 +703,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     if (this.get('allSelectedServiceNames').contains('YARN')) {
       configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
     }
-    // if HA is enabled and HAWQ is selected to be installed -> Add HAWQ related configs
-    if (this.get('wizardController.name') === 'addServiceController' && App.get('isHaEnabled')
&& this.get('allSelectedServiceNames').contains('HAWQ')) {
-      this.addHawqConfigsOnNnHa(configs);
+    // If Hawq service is being added, add NN/RM HA related parameter to hdfs-client/yarn-client
respectively if applicable
+    if (this.get('wizardController.name') === 'addServiceController' && this.get('allSelectedServiceNames').contains('HAWQ'))
{
+      if (App.get('isHaEnabled')) {
+        this.addHawqConfigsOnNnHa(configs);
+      }
+      if (App.get('isRMHaEnabled')) {
+        this.addHawqConfigsOnRMHa(configs);
+      }
     }
     var dependedServices = ["STORM", "YARN"];
     dependedServices.forEach(function (serviceName) {
@@ -879,6 +884,50 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   /**
+   * For ResourceManager HA, HAWQ service requires additional config parameters in yarn-client.xml
+   * This method ensures that these additional parameters are added to yarn-client.xml
+   * @param configs existing configs on cluster
+   * @returns {Object[]} existing configs + additional config parameters in yarn-client.xml
+   * @private
+   */
+  addHawqConfigsOnRMHa: function(configs) {
+    var yarnSiteConfigs = configs.filterProperty('filename', 'yarn-site.xml');
+    rmHost1 = yarnSiteConfigs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').value
;
+    rmHost2 = yarnSiteConfigs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').value
;
+    var yarnConfigToBeAdded = [
+      {
+        propertyName: 'yarn.resourcemanager.ha',
+        displayName: 'yarn.resourcemanager.ha',
+        description: 'Comma separated yarn resourcemanager host addresses with port',
+        port: '8032'
+      },
+      {
+        propertyName: 'yarn.resourcemanager.scheduler.ha',
+        displayName: 'yarn.resourcemanager.scheduler.ha',
+        description: 'Comma separated yarn resourcemanager scheduler addresses with port',
+        port: '8030'
+      }
+    ]
+
+    yarnConfigToBeAdded.forEach(function(propertyDetails) {
+      var newProperty = App.config.createDefaultConfig(propertyDetails.propertyName, 'HAWQ',
'yarn-client.xml', true);
+      var value = rmHost1 + ':' + propertyDetails.port + ',' + rmHost2 + ':' + propertyDetails.port;
+      Em.setProperties(newProperty, {
+        name: propertyDetails.propertyName,
+        description: propertyDetails.description,
+        displayName: propertyDetails.displayName,
+        isOverridable: false,
+        isReconfigurable: false,
+        value: value,
+        recommendedValue: value
+      });
+
+      configs.push(App.ServiceConfigProperty.create(newProperty));
+    });
+    return configs;
+  },
+
+  /**
    * render configs, distribute them by service
    * and wrap each in ServiceConfigProperty object
    * @param configs

http://git-wip-us.apache.org/repos/asf/ambari/blob/15e2da6f/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 88d8bae..59aeb41 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2033,6 +2033,49 @@ describe('App.InstallerStep7Controller', function () {
     });
   });
 
+  describe('#addHawqConfigsOnRMHa', function () {
+    var configs = [
+      {
+        id: 'yarn.resourcemanager.hostname.rm1',
+        name: 'yarn.resourcemanager.hostname.rm1',
+        value: 'c6401.ambari.apache.org',
+        recommendedValue: 'c6401.ambari.apache.org',
+        filename: 'yarn-site.xml'
+      },
+      {
+        id: 'yarn.resourcemanager.hostname.rm2',
+        name: 'yarn.resourcemanager.hostname.rm2',
+        value: 'c6402.ambari.apache.org',
+        recommendedValue: 'c6402.ambari.apache.org',
+        filename: 'yarn-site.xml'
+      }
+    ];
+
+    it('should update properties in yarn-client for HAWQ if yarn ha is enabled', function()
{
+      var inputConfigsCount = configs.length;
+      installerStep7Controller.addHawqConfigsOnRMHa(configs);
+      var yarnClientConfig = configs.filterProperty('filename', 'yarn-client.xml')
+      var yarnRmDetails = yarnClientConfig.findProperty('name', 'yarn.resourcemanager.ha');
+      var yarnRmSchedulerDetails = yarnClientConfig.findProperty('name', 'yarn.resourcemanager.scheduler.ha');
+
+      var expectedYarnRmHaValue = 'c6401.ambari.apache.org:8032,c6402.ambari.apache.org:8032';
+      expect(yarnRmDetails.value).to.be.eql(expectedYarnRmHaValue);
+      expect(yarnRmDetails.recommendedValue).to.be.eql(expectedYarnRmHaValue);
+      expect(yarnRmDetails.displayName).to.be.eql('yarn.resourcemanager.ha');
+      expect(yarnRmDetails.description).to.be.eql('Comma separated yarn resourcemanager host
addresses with port');
+
+      var expectedYarnRmSchedulerValue = 'c6401.ambari.apache.org:8030,c6402.ambari.apache.org:8030';
+      expect(yarnRmSchedulerDetails.value).to.be.eql(expectedYarnRmSchedulerValue);
+      expect(yarnRmSchedulerDetails.recommendedValue).to.be.eql(expectedYarnRmSchedulerValue);
+      expect(yarnRmSchedulerDetails.displayName).to.be.eql('yarn.resourcemanager.scheduler.ha');
+      expect(yarnRmSchedulerDetails.description).to.be.eql('Comma separated yarn resourcemanager
scheduler addresses with port');
+
+      var noOfConfigsAdded = 2;
+      expect(configs.length).to.be.eql(inputConfigsCount + noOfConfigsAdded) ;
+    });
+  });
+
+
   describe('#errorsCount', function () {
 
     it('should ignore configs with widgets (enhanced configs)', function () {


Mime
View raw message