Browse Source

AMBARI-6551. RM HA: Create Step3. (akovalenko)

Aleksandr Kovalenko 11 years ago
parent
commit
29475cb1e0

+ 62 - 1
ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js

@@ -19,6 +19,67 @@
 var App = require('app');
 
 App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
-  name: "rMHighAvailabilityWizardStep3Controller"
+  name: "rMHighAvailabilityWizardStep3Controller",
+
+  selectedService: null,
+
+  loadStep: function () {
+    this.renderConfigs();
+  },
+
+  /**
+   * Render configs to show them in <code>App.ServiceConfigView</code>
+   */
+  renderConfigs: function () {
+
+    var configs = $.extend(true, {}, require('data/HDP2/rm_ha_properties').haConfig);
+
+    var serviceConfig = App.ServiceConfig.create({
+      serviceName: configs.serviceName,
+      displayName: configs.displayName,
+      configCategories: [],
+      showConfig: true,
+      configs: []
+    });
+
+    configs.configCategories.forEach(function (configCategory) {
+      if (App.Service.find().someProperty('serviceName', configCategory.name)) {
+        serviceConfig.configCategories.pushObject(configCategory);
+      }
+    }, this);
+
+    this.renderConfigProperties(configs, serviceConfig);
+    this.setDynamicConfigValues(serviceConfig);
+
+    this.set('selectedService', serviceConfig);
+  },
+
+  /**
+   * Set values dependent on host selection
+   * @param configs
+   */
+  setDynamicConfigValues: function (configs) {
+    var configProperties = configs.configs;
+    var currentRMHost = this.get('content.rmHosts.currentRM');
+    var additionalRMHost = this.get('content.rmHosts.additionalRM');
+    var zooKeeperHosts = App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').mapProperty('host.hostName').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', zooKeeperHosts).set('defaultValue', zooKeeperHosts);
+  },
+
+  /**
+   * Load child components to service config object
+   * @param _componentConfig
+   * @param componentConfig
+   */
+  renderConfigProperties: function (_componentConfig, componentConfig) {
+    _componentConfig.configs.forEach(function (_serviceConfigProperty) {
+      var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+      componentConfig.configs.pushObject(serviceConfigProperty);
+      serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
+      serviceConfigProperty.validate();
+    }, this);
+  }
 });
 

+ 18 - 0
ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js

@@ -39,6 +39,23 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({
     });
   },
 
+  /**
+   * Save hosts for additional and current ResourceManagers to local db and <code>controller.content</code>
+   * @param rmHosts
+   */
+  saveRmHosts: function (rmHosts) {
+    this.set('content.rmHosts', rmHosts);
+    this.setDBProperty('rmHosts', rmHosts);
+  },
+
+  /**
+   * Load hosts for additional and current ResourceManagers from local db to <code>controller.content</code>
+   */
+  loadRmHosts: function() {
+    var rmHosts = this.getDBProperty('rmHosts');
+    this.set('content.rmHosts', rmHosts);
+  },
+
   /**
    * Load data for all steps until <code>current step</code>
    */
@@ -47,6 +64,7 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({
     switch (step) {
       case '4':
       case '3':
+        this.loadRmHosts();
       case '2':
         this.loadServicesFromServer();
         this.loadMasterComponentHosts();

+ 133 - 0
ambari-web/app/data/HDP2/rm_ha_properties.js

@@ -0,0 +1,133 @@
+/**
+ * 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.
+ */
+
+module.exports =
+{
+  "haConfig": {
+    serviceName: 'MISC',
+    displayName: 'MISC',
+    configCategories: [
+      App.ServiceConfigCategory.create({ name: 'YARN', displayName: 'YARN'})
+    ],
+    sites: ['yarn-site'],
+    configs: [
+    /**********************************************HDFS***************************************/
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.ha.enabled",
+        "displayName": "yarn.resourcemanager.ha.enabled",
+        "isReconfigurable": false,
+        "defaultValue": true,
+        "value": true,
+        "displayType": "checkbox",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.ha.rm-ids",
+        "displayName": "yarn.resourcemanager.ha.rm-ids",
+        "isReconfigurable": false,
+        "defaultValue": "rm1,rm2",
+        "value": "rm1,rm2",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.hostname.rm1",
+        "displayName": "yarn.resourcemanager.hostname.rm1",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.hostname.rm2",
+        "displayName": "yarn.resourcemanager.hostname.rm2",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.recovery.enabled",
+        "displayName": "yarn.resourcemanager.recovery.enabled",
+        "isReconfigurable": false,
+        "defaultValue": true,
+        "value": true,
+        "displayType": "checkbox",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.store.class",
+        "displayName": "yarn.resourcemanager.store.class",
+        "isReconfigurable": false,
+        "defaultValue": "org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore",
+        "value": "org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.zk-address",
+        "displayName": "yarn.resourcemanager.zk-address",
+        "isReconfigurable": false,
+        "defaultValue": "",
+        "value": "",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.cluster-id",
+        "displayName": "yarn.resourcemanager.cluster-id",
+        "isReconfigurable": false,
+        "defaultValue": "yarn-cluster",
+        "value": "yarn-cluster",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "yarn.resourcemanager.ha.automatic-failover.zk-base-path",
+        "displayName": "yarn.resourcemanager.ha.automatic-failover.zk-base-path",
+        "isReconfigurable": false,
+        "defaultValue": "/yarn-leader-election",
+        "value": "/yarn-leader-election",
+        "category": "YARN",
+        "filename": "yarn-site",
+        serviceName: 'MISC'
+      }
+    ]
+  }
+};

+ 7 - 0
ambari-web/app/messages.js

@@ -982,6 +982,13 @@ Em.I18n.translations = {
   'admin.rm_highAvailability.wizard.step2.header': 'Select Host',
   'admin.rm_highAvailability.wizard.step2.body': 'Select a host that will be running the additional ResourceManager',
   'admin.rm_highAvailability.wizard.step3.header': 'Review',
+  'admin.rm_highAvailability.wizard.step3.confirm.host.body':'<b>Confirm your host selections.</b>',
+  'admin.rm_highAvailability.wizard.step3.confirm.config.body':'<div class="alert alert-info">' +
+      '<b>Review Configuration Changes.</b></br>' +
+      'The following lists the configuration changes that will be made by the Wizard to enable ResourceManager HA. This information is for <b> review only </b> and is not editable.' +
+      '</div>',
+  'admin.rm_highAvailability.wizard.step3.currentRM': 'Current ResourceManager',
+  'admin.rm_highAvailability.wizard.step3.additionalRM': 'Additional ResourceManager',
   'admin.rm_highAvailability.wizard.step4.header': 'Configure Components',
 
   'admin.security.title':'Kerberos security has not been enabled',

+ 10 - 0
ambari-web/app/routes/rm_high_availability_routes.js

@@ -101,6 +101,15 @@ module.exports = App.WizardRoute.extend({
       return false;
     },
     next: function (router) {
+      var wizardController = router.get('rMHighAvailabilityWizardController');
+      var stepController = router.get('rMHighAvailabilityWizardStep2Controller');
+      var currentRM = stepController.get('servicesMasters').findProperty('isAdditional', false);
+      var additionalRM = stepController.get('servicesMasters').findProperty('isAdditional', true);
+      var rmHost = {
+        currentRM: currentRM.get('selectedHost'),
+        additionalRM: additionalRM.get('selectedHost')
+      };
+      wizardController.saveRmHosts(rmHost);
       router.transitionTo('step3');
     },
     back: function (router) {
@@ -114,6 +123,7 @@ module.exports = App.WizardRoute.extend({
       var controller = router.get('rMHighAvailabilityWizardController');
       controller.setCurrentStep('3');
       controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
         controller.connectOutlet('rMHighAvailabilityWizardStep3',  controller.get('content'));
       })
     },

+ 1 - 0
ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs

@@ -87,6 +87,7 @@
   <div class="spinner"></div>
 {{/if}}
 <div class="btn-area">
+  <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
   <a class="btn btn-success pull-right" {{bindAttr disabled="submitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</a>
 </div>
 

+ 36 - 4
ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs

@@ -15,10 +15,42 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div>
-  <h2>{{t admin.rm_highAvailability.wizard.step3.header}}</h2>
+<h2>{{t admin.rm_highAvailability.wizard.step3.header}}</h2>
 
-  <div class="btn-area">
+<div class="alert alert-info">
+  {{t admin.rm_highAvailability.wizard.step3.confirm.host.body}}
+</div>
+
+<div id="ha-step3-content" class="well pre-scrollable">
+    <div id="step8-info">
+        <table id="ha-step3-review-table">
+            <tr>
+                <td>
+                    <b>{{t admin.rm_highAvailability.wizard.step3.currentRM}}</b>:
+                </td>
+                <td>{{controller.content.rmHosts.currentRM}}</td>
+                <td></td>
+            </tr>
+            <tr>
+                <td>
+                  <b>{{t admin.rm_highAvailability.wizard.step3.additionalRM}}</b>:
+                </td>
+                <td>{{controller.content.rmHosts.additionalRM}}</td>
+                <td><span class="to-be-installed-green"><i class="icon-plus"></i>&nbsp;{{t admin.highAvailability.wizard.step3.toBeInstalled}}</span></td>
+            </tr>
+        </table>
+    </div>
+</div>
+
+
+<div id="serviceConfig">
+
+  {{{t admin.rm_highAvailability.wizard.step3.confirm.config.body}}}
+
+  {{view App.ServiceConfigView}}
+</div>
+
+<div class="btn-area">
+    <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
     <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
-  </div>
 </div>

+ 4 - 1
ambari-web/app/views/main/admin/highAvailability/resourceManager/step3_view.js

@@ -21,6 +21,9 @@ var App = require('app');
 
 App.RMHighAvailabilityWizardStep3View = Em.View.extend({
 
-  templateName: require('templates/main/admin/highAvailability/resourceManager/step3')
+  templateName: require('templates/main/admin/highAvailability/resourceManager/step3'),
 
+  didInsertElement: function () {
+    this.get('controller').loadStep();
+  }
 });