Prechádzať zdrojové kódy

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

Oleksandr Diachenko 9 rokov pred
rodič
commit
c0efc80d8b

+ 52 - 3
ambari-web/app/controllers/wizard/step7_controller.js

@@ -688,9 +688,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     if (this.get('allSelectedServiceNames').contains('YARN')) {
     if (this.get('allSelectedServiceNames').contains('YARN')) {
       configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
       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);
+      }
     }
     }
     if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
     if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
       this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
       this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
@@ -797,6 +802,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     return stepConfigs;
     return stepConfigs;
   },
   },
 
 
+
   /**
   /**
    * For Namenode HA, HAWQ service requires additional config parameters in hdfs-client.xml
    * For Namenode HA, HAWQ service requires additional config parameters in hdfs-client.xml
    * This method ensures that these additional parameters are added to hdfs-client.xml
    * This method ensures that these additional parameters are added to hdfs-client.xml
@@ -835,6 +841,49 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     return configs;
     return configs;
   },
   },
 
 
+  /**
+   * 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) {
+    rmHost1 = configs.findProperty('id', 'yarn.resourcemanager.hostname.rm1__yarn-site').value ;
+    rmHost2 = configs.findProperty('id', 'yarn.resourcemanager.hostname.rm2__yarn-site').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.name,
+        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
    * render configs, distribute them by service
    * and wrap each in ServiceConfigProperty object
    * and wrap each in ServiceConfigProperty object

+ 39 - 0
ambari-web/test/controllers/wizard/step7_test.js

@@ -1702,6 +1702,45 @@ describe('App.InstallerStep7Controller', function () {
     });
     });
   });
   });
 
 
+  describe('#addHawqConfigsOnRMHa', function () {
+    var configs = [
+      {
+        id: 'yarn.resourcemanager.hostname.rm1__yarn-site',
+        name: 'yarn.resourcemanager.hostname.rm1',
+        value: 'c6401.ambari.apache.org',
+        recommendedValue: 'c6401.ambari.apache.org'
+      },
+      {
+        id: 'yarn.resourcemanager.hostname.rm2__yarn-site',
+        name: 'yarn.resourcemanager.hostname.rm2',
+        value: 'c6402.ambari.apache.org',
+        recommendedValue: 'c6402.ambari.apache.org'
+      }
+    ];
+
+    it('should update properties in yarn-client for HAWQ if yarn ha is enabled', function() {
+      var inputConfigsCount = configs.length;
+      installerStep7Controller.addHawqConfigsOnRMHa(configs);
+      var yarnRmDetails = configs.findProperty('id', 'yarn.resourcemanager.ha__yarn-client');
+      var yarnRmSchedulerDetails = configs.findProperty('id', 'yarn.resourcemanager.scheduler.ha__yarn-client');
+
+      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 () {
   describe('#errorsCount', function () {
 
 
     it('should ignore configs with widgets (enhanced configs)', function () {
     it('should ignore configs with widgets (enhanced configs)', function () {