ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [2/2] ambari git commit: AMBARI-9950. YARN RM HA Mode Configurations Are Incorrect (alexantonenko)
Date Fri, 06 Mar 2015 01:47:22 GMT
AMBARI-9950. YARN RM HA Mode Configurations Are Incorrect (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 9c14b8f66cef7671eafa1815a5434a37dd6af281
Parents: 7a3b5ba
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Mar 6 03:35:28 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Mar 6 03:35:28 2015 +0200

----------------------------------------------------------------------
 .../resourceManager/step3_controller.js         | 65 +++++++++++++-------
 ambari-web/app/data/HDP2/rm_ha_properties.js    | 46 ++++++++++++++
 .../resourceManager/step3_controller_test.js    | 63 +++++++++++++++++--
 3 files changed, 147 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9c14b8f6/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
index 18e1d38..f97bd07 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
@@ -70,7 +70,8 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
   },
 
   loadConfigTagsSuccessCallback: function (data, opt, params) {
-    var urlParams = '(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag
+ ')';
+    var urlParams = '(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag
+ ')|' +
+      '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')';
     App.ajax.send({
       name: 'reassign.load_configs',
       sender: this,
@@ -79,25 +80,27 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
         serviceConfig: params.serviceConfig
       },
       success: 'loadConfigsSuccessCallback',
-      error: 'loadConfigsErrorCallback'
+      error: 'loadConfigsSuccessCallback'
     });
   },
 
   loadConfigsSuccessCallback: function (data, opt, params) {
-    var zooCfg = data.items.findProperty('type', 'zoo.cfg');
-    var portValue = zooCfg && Em.get(zooCfg, 'properties.clientPort');
-    var zkPort = typeof portValue === 'undefined' ? '2181' : portValue;
-    this.setDynamicConfigValues(params.serviceConfig, zkPort);
-    this.setProperties({
-      selectedService: params.serviceConfig,
-      isLoaded: true
-    });
-  },
+    var
+      zooCfg = data && data.items ? data.items.findProperty('type', 'zoo.cfg') :
null,
+      yarnSite = data && data.items ? data.items.findProperty('type', 'yarn-site')
: null,
+      portValue = zooCfg && Em.get(zooCfg, 'properties.clientPort'),
+      zkPort = portValue ? portValue : '2181',
+      webAddressPort = yarnSite && yarnSite.properties ? yarnSite.properties['yarn.resourcemanager.webapp.address']
: null,
+      httpsWebAddressPort = yarnSite && yarnSite.properties ? yarnSite. properties['yarn.resourcemanager.webapp.https.address']
: null;
+
+    webAddressPort = webAddressPort && webAddressPort.match(/:[0-9]*/g) ? webAddressPort.match(/:[0-9]*/g)[0]
: ":8088";
+    httpsWebAddressPort = httpsWebAddressPort && httpsWebAddressPort.match(/:[0-9]*/g)
? httpsWebAddressPort.match(/:[0-9]*/g)[0] : ":8090";
+
+    params = params.serviceConfig ? params.serviceConfig : arguments[4].serviceConfig;
 
-  loadConfigsErrorCallback: function (request, ajaxOptions, error, data, params) {
-    this.setDynamicConfigValues(params.serviceConfig, '2181');
+    this.setDynamicConfigValues(params, zkPort, webAddressPort, httpsWebAddressPort);
     this.setProperties({
-      selectedService: params.serviceConfig,
+      selectedService: params,
       isLoaded: true
     });
   },
@@ -106,17 +109,37 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
    * Set values dependent on host selection
    * @param configs
    * @param zkPort
+   * @param webAddressPort
+   * @param httpsWebAddressPort
    */
-  setDynamicConfigValues: function (configs, zkPort) {
-    var configProperties = configs.configs;
-    var currentRMHost = this.get('content.rmHosts.currentRM');
-    var additionalRMHost = this.get('content.rmHosts.additionalRM');
-    var zooKeeperHostsWithPort = App.HostComponent.find().filterProperty('componentName',
'ZOOKEEPER_SERVER').map(function (item) {
-      return item.get('host.hostName') + ':' + zkPort;
-    }).join(',');
+  setDynamicConfigValues: function (configs, zkPort, webAddressPort, httpsWebAddressPort)
{
+    var
+      configProperties = configs.configs,
+      currentRMHost = this.get('content.rmHosts.currentRM'),
+      additionalRMHost = this.get('content.rmHosts.additionalRM'),
+      zooKeeperHostsWithPort = App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').map(function
(item) {
+        return item.get('host.hostName') + ':' + zkPort;
+      }).join(',');
+
     configProperties.findProperty('name', 'yarn.resourcemanager.hostname.rm1').set('value',
currentRMHost).set('defaultValue', currentRMHost);
     configProperties.findProperty('name', 'yarn.resourcemanager.hostname.rm2').set('value',
additionalRMHost).set('defaultValue', additionalRMHost);
     configProperties.findProperty('name', 'yarn.resourcemanager.zk-address').set('value',
zooKeeperHostsWithPort).set('defaultValue', zooKeeperHostsWithPort);
+
+    configProperties.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1')
+      .set('value', currentRMHost + webAddressPort)
+      .set('defaultValue', currentRMHost + webAddressPort);
+
+    configProperties.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2')
+      .set('value', additionalRMHost + webAddressPort)
+      .set('defaultValue', additionalRMHost + webAddressPort);
+
+    configProperties.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1')
+      .set('value', currentRMHost + httpsWebAddressPort)
+      .set('defaultValue', currentRMHost + httpsWebAddressPort);
+
+    configProperties.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2')
+      .set('value', additionalRMHost + httpsWebAddressPort)
+      .set('defaultValue', additionalRMHost + httpsWebAddressPort);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c14b8f6/ambari-web/app/data/HDP2/rm_ha_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/rm_ha_properties.js b/ambari-web/app/data/HDP2/rm_ha_properties.js
index 84e3cd8..ef77b1e 100644
--- a/ambari-web/app/data/HDP2/rm_ha_properties.js
+++ b/ambari-web/app/data/HDP2/rm_ha_properties.js
@@ -61,6 +61,52 @@ module.exports =
         "filename": "yarn-site",
         serviceName: 'MISC'
       },
+
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.webapp.address.rm1",
+        "displayName": "yarn.resourcemanager.webapp.address.rm1",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.webapp.address.rm2",
+        "displayName": "yarn.resourcemanager.webapp.address.rm2",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.webapp.https.address.rm1",
+        "displayName": "yarn.resourcemanager.webapp.https.address.rm1",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.webapp.https.address.rm2",
+        "displayName": "yarn.resourcemanager.webapp.https.address.rm2",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+
       {
         "id": "site property",
         "name": "yarn.resourcemanager.hostname.rm2",

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c14b8f6/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
index 155bc67..b85d665 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
@@ -64,6 +64,9 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
           'desired_configs': {
             'zoo.cfg': {
               'tag': 1
+            },
+            'yarn-site': {
+              'tag': 1
             }
           }
         }
@@ -71,7 +74,7 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
         'serviceConfig': {}
       });
       var data = App.ajax.send.args[0][0].data;
-      expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)');
+      expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)|(type=yarn-site&tag=1)');
       expect(data.serviceConfig).to.eql({});
     });
 
@@ -87,18 +90,25 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
             'serviceConfig': {}
           },
           'port': '2181',
+          'webAddressPort' : ':8088',
+          'httpsWebAddressPort' : ':8090',
           'title': 'empty response'
         },
         {
           'items': [
             {
               'type': 'zoo.cfg'
+            },
+            {
+              'type': 'yarn-site'
             }
           ],
           'params': {
             'serviceConfig': {}
           },
           'port': '2181',
+          'webAddressPort' : ':8088',
+          'httpsWebAddressPort' : ':8090',
           'title': 'no zoo.cfg properties received'
         },
         {
@@ -108,12 +118,20 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function ()
{
               'properties': {
                 'n': 'v'
               }
+            },
+            {
+              'type': 'yarn-site',
+              'properties': {
+                'n': 'v'
+              }
             }
           ],
           'params': {
             'serviceConfig': {}
           },
           'port': '2181',
+          'webAddressPort' : ':8088',
+          'httpsWebAddressPort' : ':8090',
           'title': 'no clientPort property received'
         },
         {
@@ -123,12 +141,21 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function ()
{
               'properties': {
                 'clientPort': '2182'
               }
+            },
+            {
+              'type': 'yarn-site',
+              'properties': {
+                'yarn.resourcemanager.webapp.address' : 'c6402.ambari.apache.org:7777',
+                'yarn.resourcemanager.webapp.https.address' : 'c6402.ambari.apache.org:8888'
+              }
             }
           ],
           'params': {
             'serviceConfig': {}
           },
           'port': '2182',
+          'webAddressPort' : ':7777',
+          'httpsWebAddressPort' : ':8888',
           'title': 'clientPort property received'
         }
       ];
@@ -146,7 +173,7 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
         controller.loadConfigsSuccessCallback({
           items: item.items
         }, {}, item.params);
-        expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, item.port]);
+        expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, item.port, item.webAddressPort,
item.httpsWebAddressPort]);
         expect(controller.get('selectedService')).to.eql({});
         expect(controller.get('isLoaded')).to.be.true;
       });
@@ -154,7 +181,7 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
 
   });
 
-  describe('#loadConfigsErrorCallback', function () {
+  describe('#loadConfigsSuccessCallback=loadConfigsErrorCallback(we have one callback for
bouth cases)', function () {
 
     var controller = App.RMHighAvailabilityWizardStep3Controller.create();
 
@@ -167,10 +194,11 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function ()
{
     });
 
     it('should proceed with default value', function () {
-      controller.loadConfigsErrorCallback({}, {}, {}, {}, {
+      controller.loadConfigsSuccessCallback({}, {}, {}, {}, {
         serviceConfig: {}
       });
-      expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, '2181']);
+      console.error("test_alex!!!!!",controller.setDynamicConfigValues.args[0]);
+      expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, '2181', ':8088', ':8090']);
       expect(controller.get('selectedService')).to.eql({});
       expect(controller.get('isLoaded')).to.be.true;
     });
@@ -197,6 +225,18 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
           }),
           Em.Object.create({
             name: 'yarn.resourcemanager.zk-address'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.webapp.address.rm1'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.webapp.address.rm2'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.webapp.https.address.rm1'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.webapp.https.address.rm2'
           })
         ]
       };
@@ -231,11 +271,22 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function ()
{
     });
 
     it('setting new RM properties values', function () {
-      controller.setDynamicConfigValues(configs, '2181');
+      controller.setDynamicConfigValues(configs, '2181', ':8088', ':8090');
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('value')).to.equal('h0');
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('defaultValue')).to.equal('h0');
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('value')).to.equal('h1');
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('defaultValue')).to.equal('h1');
+
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('value')).to.equal('h0:8088');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('defaultValue')).to.equal('h0:8088');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('value')).to.equal('h1:8088');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('defaultValue')).to.equal('h1:8088');
+
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('value')).to.equal('h0:8090');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('defaultValue')).to.equal('h0:8090');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('value')).to.equal('h1:8090');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('defaultValue')).to.equal('h1:8090');
+
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('value')).to.equal('h2:2181,h3:2181');
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('defaultValue')).to.equal('h2:2181,h3:2181');
     });


Mime
View raw message