This is an automated email from the ASF dual-hosted git repository.

akovalenko pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 35fe83c  AMBARI-23166. NN Federation Wizard: implement step4 
(akovalenko)
35fe83c is described below

commit 35fe83c4f720348dee3d00af53ce263686fd792e
Author: Aleksandr Kovalenko <akovale...@apache.org>
AuthorDate: Wed Mar 7 18:17:36 2018 +0200

    AMBARI-23166. NN Federation Wizard: implement step4 (akovalenko)
---
 .../main/admin/federation/step3_controller.js      |   9 +-
 .../main/admin/federation/step4_controller.js      | 101 ++++++++++++++++++++-
 .../main/admin/federation/wizard_controller.js     |  18 ----
 .../data/configs/wizards/federation_properties.js  |  52 ++++++++++-
 ambari-web/app/messages.js                         |  15 +++
 .../app/routes/namenode_federation_routes.js       |   7 --
 .../app/templates/main/admin/federation/step4.hbs  |   7 +-
 ambari-web/app/utils/ajax/ajax.js                  |  59 ++++++++++++
 .../app/views/main/admin/federation/step4_view.js  |  13 ++-
 9 files changed, 241 insertions(+), 40 deletions(-)

diff --git 
a/ambari-web/app/controllers/main/admin/federation/step3_controller.js 
b/ambari-web/app/controllers/main/admin/federation/step3_controller.js
index d48043b..993cecc 100644
--- a/ambari-web/app/controllers/main/admin/federation/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/federation/step3_controller.js
@@ -81,13 +81,14 @@ App.NameNodeFederationWizardStep3Controller = 
Em.Controller.extend(App.Blueprint
     var ret = {};
     var configsFromServer = this.get('serverConfigData.items');
     var journalNodes = 
App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE');
+    var nameNodes = 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE');
     // todo: replace with real data
     ret.nameservice1 = 'ns1';
     ret.nameservice2 = this.get('content.nameServiceId');
-    ret.namenode1 = this.get('content.selectedHosts.currentNN')[0];
-    ret.namenode2 = this.get('content.selectedHosts.currentNN')[1];
-    ret.namenode3 = this.get('content.selectedHosts.additionalNN')[0];
-    ret.namenode4 = this.get('content.selectedHosts.additionalNN')[1];
+    ret.namenode1 = 
nameNodes.filterProperty('isInstalled').mapProperty('hostName')[0];
+    ret.namenode2 = 
nameNodes.filterProperty('isInstalled').mapProperty('hostName')[1];
+    ret.namenode3 = nameNodes.filterProperty('isInstalled', 
false).mapProperty('hostName')[0];
+    ret.namenode4 = nameNodes.filterProperty('isInstalled', 
false).mapProperty('hostName')[1];
     ret.journalnodes = journalNodes.map(function (c) {
       return c.get('hostName') + ':8485'
     }).join(';');
diff --git 
a/ambari-web/app/controllers/main/admin/federation/step4_controller.js 
b/ambari-web/app/controllers/main/admin/federation/step4_controller.js
index 2a293a3..fd3a6f3 100644
--- a/ambari-web/app/controllers/main/admin/federation/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/federation/step4_controller.js
@@ -20,5 +20,104 @@ var App = require('app');
 
 App.NameNodeFederationWizardStep4Controller = 
App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
 
-  name: "nameNodeFederationWizardStep4Controller"
+  name: "nameNodeFederationWizardStep4Controller",
+
+  commands: ['stopAllServices', 'reconfigureHDFS', 'installNameNode', 
'installZKFC', 'formatNameNode', 'formatZKFC', 'startZKFC', 'startNameNode', 
'bootstrapNameNode', 'startZKFC2', 'startNameNode2', 'startAllServices'],
+
+  tasksMessagesPrefix: 'admin.nameNodeFederation.wizard.step',
+
+  newNameNodeHosts: function () {
+    return 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE').filterProperty('isInstalled', false).mapProperty('hostName');
+  }.property('content.masterComponentHosts.@each.hostName'),
+
+  reconfigureHDFS: function () {
+    var data = this.get('content.serviceConfigProperties');
+    var note = 
Em.I18n.t('admin.nameNodeFederation.wizard,step4.save.configuration.note');
+    var configData = this.reconfigureSites(['hdfs-site'], data, note);
+    return App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      error: 'onTaskError',
+      success: 'installHDFSClients'
+    });
+  },
+
+  installHDFSClients: function () {
+    var nnHostNames = 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE').mapProperty('hostName');
+    var jnHostNames = App.HostComponent.find().filterProperty('componentName', 
'JOURNALNODE').mapProperty('hostName');
+    var hostNames = nnHostNames.concat(jnHostNames).uniq();
+    this.createInstallComponentTask('HDFS_CLIENT', hostNames, 'HDFS');
+  },
+
+  stopAllServices: function () {
+    this.stopServices([], true, true);
+  },
+
+  installNameNode: function () {
+    this.createInstallComponentTask('NAMENODE', this.get('newNameNodeHosts'), 
"HDFS");
+  },
+
+  installZKFC: function () {
+    this.createInstallComponentTask('ZKFC', this.get('newNameNodeHosts'), 
"HDFS");
+  },
+
+  formatNameNode: function () {
+    App.ajax.send({
+      name: 'nameNode.federation.formatNameNode',
+      sender: this,
+      data: {
+        host: this.get('newNameNodeHosts')[0]
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  formatZKFC: function () {
+    App.ajax.send({
+      name: 'nameNode.federation.formatZKFC',
+      sender: this,
+      data: {
+        host: this.get('newNameNodeHosts')[0]
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  startZKFC: function () {
+    this.updateComponent('ZKFC', this.get('newNameNodeHosts')[0], "HDFS", 
"Start");
+  },
+
+  startNameNode: function () {
+    this.updateComponent('NAMENODE', this.get('newNameNodeHosts')[0], "HDFS", 
"Start");
+  },
+
+  bootstrapNameNode: function () {
+    App.ajax.send({
+      name: 'nameNode.federation.bootstrapNameNode',
+      sender: this,
+      data: {
+        host: this.get('newNameNodeHosts')[1]
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  startZKFC2: function () {
+    this.updateComponent('ZKFC', this.get('newNameNodeHosts')[1], "HDFS", 
"Start");
+  },
+
+  startNameNode2: function () {
+    this.updateComponent('NAMENODE', this.get('newNameNodeHosts')[1], "HDFS", 
"Start");
+  },
+
+  startAllServices: function () {
+    this.startServices(false);
+  }
+
 });
diff --git 
a/ambari-web/app/controllers/main/admin/federation/wizard_controller.js 
b/ambari-web/app/controllers/main/admin/federation/wizard_controller.js
index 8f13711..b71c0f4 100644
--- a/ambari-web/app/controllers/main/admin/federation/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/federation/wizard_controller.js
@@ -54,7 +54,6 @@ App.NameNodeFederationWizardController = 
App.WizardController.extend({
         callback: function () {
           var self = this,
             dfd = $.Deferred();
-          this.loadSelectedHosts();
           this.loadServicesFromServer();
           this.loadMasterComponentHosts().done(function () {
             self.loadConfirmedHosts();
@@ -113,23 +112,6 @@ App.NameNodeFederationWizardController = 
App.WizardController.extend({
     this.set('content.nameServiceId', nameServiceId);
   },
 
-  /**
-   * Save hosts for users selected hosts to local db and 
<code>controller.content</code>
-   * @param selectedHosts
-   */
-  saveSelectedHosts: function (selectedHosts) {
-    this.set('content.selectedHosts', selectedHosts);
-    this.setDBProperty('selectedHosts', selectedHosts);
-  },
-
-  /**
-   * Load hosts for user selected components from local db to 
<code>controller.content</code>
-   */
-  loadSelectedHosts: function() {
-    var selectedHosts = this.getDBProperty('selectedHosts');
-    this.set('content.selectedHosts', selectedHosts);
-  },
-
   saveServiceConfigProperties: function (stepController) {
     var serviceConfigProperties = [];
     var data = stepController.get('serverConfigData');
diff --git a/ambari-web/app/data/configs/wizards/federation_properties.js 
b/ambari-web/app/data/configs/wizards/federation_properties.js
index 5090c3f..d81fe53 100644
--- a/ambari-web/app/data/configs/wizards/federation_properties.js
+++ b/ambari-web/app/data/configs/wizards/federation_properties.js
@@ -130,7 +130,7 @@ module.exports =
       {
         "name": "dfs.namenode.https-address.{{nameservice2}}.nn3",
         "displayName": "dfs.namenode.https-address.{{nameservice2}}.nn3",
-        "description": "The fully-qualified HTTP address for nn3 NameNode.",
+        "description": "The fully-qualified HTTPS address for nn3 NameNode.",
         "isReconfigurable": false,
         "recommendedValue": "{{namenode3}}:{{nnHttpsPort}}",
         "value": "{{namenode3}}:{{nnHttpsPort}}",
@@ -141,7 +141,7 @@ module.exports =
       {
         "name": "dfs.namenode.https-address.{{nameservice2}}.nn4",
         "displayName": "dfs.namenode.https-address.{{nameservice2}}.nn4",
-        "description": "The fully-qualified HTTP address for nn4 NameNode.",
+        "description": "The fully-qualified HTTPS address for nn4 NameNode.",
         "isReconfigurable": false,
         "recommendedValue": "{{namenode4}}:{{nnHttpsPort}}",
         "value": "{{namenode4}}:{{nnHttpsPort}}",
@@ -163,7 +163,7 @@ module.exports =
       {
         "name": "dfs.namenode.shared.edits.dir.{{nameservice1}}",
         "displayName": "dfs.namenode.shared.edits.dir.{{nameservice1}}",
-        "description": " The URI which identifies the group of JNs where the 
NameNodes will write/read edits.",
+        "description": "The URI which identifies the group of JNs where the 
NameNodes will write/read edits.",
         "isReconfigurable": false,
         "recommendedValue": "qjournal://{{journalnodes}}/{{nameservice1}}",
         "value": "qjournal://{{journalnodes}}/{{nameservice1}}",
@@ -174,13 +174,57 @@ module.exports =
       {
         "name": "dfs.namenode.shared.edits.dir.{{nameservice2}}",
         "displayName": "dfs.namenode.shared.edits.dir.{{nameservice2}}",
-        "description": " The URI which identifies the group of JNs where the 
NameNodes will write/read edits.",
+        "description": "The URI which identifies the group of JNs where the 
NameNodes will write/read edits.",
         "isReconfigurable": false,
         "recommendedValue": "qjournal://{{journalnodes}}/{{nameservice2}}",
         "value": "qjournal://{{journalnodes}}/{{nameservice2}}",
         "category": "HDFS",
         "filename": "hdfs-site",
         "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.servicerpc-address.{{nameservice1}}.nn1",
+        "displayName": "dfs.namenode.servicerpc-address.{{nameservice1}}.nn1",
+        "description": "RPC address for HDFS Services communication.",
+        "isReconfigurable": false,
+        "recommendedValue": "{{namenode1}}:8021",
+        "value": "{{namenode1}}:8021",
+        "category": "HDFS",
+        "filename": "hdfs-site",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.servicerpc-address.{{nameservice1}}.nn2",
+        "displayName": "dfs.namenode.servicerpc-address.{{nameservice1}}.nn2",
+        "description": "RPC address for HDFS Services communication.",
+        "isReconfigurable": false,
+        "recommendedValue": "{{namenode2}}:8021",
+        "value": "{{namenode2}}:8021",
+        "category": "HDFS",
+        "filename": "hdfs-site",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.servicerpc-address.{{nameservice2}}.nn3",
+        "displayName": "dfs.namenode.servicerpc-address.{{nameservice2}}.nn3",
+        "description": "RPC address for HDFS Services communication.",
+        "isReconfigurable": false,
+        "recommendedValue": "{{namenode3}}:8021",
+        "value": "{{namenode3}}:8021",
+        "category": "HDFS",
+        "filename": "hdfs-site",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.servicerpc-address.{{nameservice2}}.nn4",
+        "displayName": "dfs.namenode.servicerpc-address.{{nameservice2}}.nn4",
+        "description": "RPC address for HDFS Services communication.",
+        "isReconfigurable": false,
+        "recommendedValue": "{{namenode4}}:8021",
+        "value": "{{namenode4}}:8021",
+        "category": "HDFS",
+        "filename": "hdfs-site",
+        "serviceName": 'MISC'
       }
     ]
   }
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 17b5a7f..c98d6f0 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1680,6 +1680,21 @@ Em.I18n.translations = {
     'The following lists the configuration changes that will be made by the 
Wizard to enable NameNode Federation. This information is for <b> review only 
</b> and is not editable except for the  <b>dfs.journalnode.edits.dir</b> 
properties' +
     '</div>',
   'admin.nameNodeFederation.wizard.step4.header': 'Configure Components',
+  'admin.nameNodeFederation.wizard,step4.save.configuration.note':'This 
configuration is created by Enable NameNode Federation wizard',
+  'admin.nameNodeFederation.wizard.step4.notice.inProgress':'Please wait while 
NameNode Federation Wizard is being deployed.',
+  'admin.nameNodeFederation.wizard.step4.notice.completed':'NameNode 
Federation Wizard has been enabled successfully.',
+  'admin.nameNodeFederation.wizard.step4.task0.title': 'Stop All Services',
+  'admin.nameNodeFederation.wizard.step4.task1.title': 'Reconfigure HDFS',
+  'admin.nameNodeFederation.wizard.step4.task2.title': 'Install Additional 
NameNodes',
+  'admin.nameNodeFederation.wizard.step4.task3.title': 'Install Additional 
ZKFCs',
+  'admin.nameNodeFederation.wizard.step4.task4.title': 'Format NameNode',
+  'admin.nameNodeFederation.wizard.step4.task5.title': 'Format ZKFC',
+  'admin.nameNodeFederation.wizard.step4.task6.title': 'Start ZKFC',
+  'admin.nameNodeFederation.wizard.step4.task7.title': 'Start NameNode',
+  'admin.nameNodeFederation.wizard.step4.task8.title': 'Bootstrap NameNode',
+  'admin.nameNodeFederation.wizard.step4.task9.title': 'Start ZKFC',
+  'admin.nameNodeFederation.wizard.step4.task10.title': 'Start NameNode',
+  'admin.nameNodeFederation.wizard.step4.task11.title': 'Start All Services',
 
   'admin.security.title':'Kerberos security has not been enabled',
   'admin.security.enabled': 'Kerberos security is enabled',
diff --git a/ambari-web/app/routes/namenode_federation_routes.js 
b/ambari-web/app/routes/namenode_federation_routes.js
index db1c826..c6ae1ea 100644
--- a/ambari-web/app/routes/namenode_federation_routes.js
+++ b/ambari-web/app/routes/namenode_federation_routes.js
@@ -113,13 +113,6 @@ module.exports = App.WizardRoute.extend({
     next: function (router) {
       var wizardController = router.get('nameNodeFederationWizardController');
       var stepController = 
router.get('nameNodeFederationWizardStep2Controller');
-      var currentNN = 
stepController.get('servicesMasters').filterProperty('component_name', 
'NAMENODE').filterProperty('isInstalled', true);
-      var additionalNN = 
stepController.get('servicesMasters').filterProperty('component_name', 
'NAMENODE').filterProperty('isInstalled', false);
-      var nnHost = {
-        currentNN: currentNN.mapProperty('selectedHost'),
-        additionalNN: additionalNN.mapProperty('selectedHost')
-      };
-      wizardController.saveSelectedHosts(nnHost);
       wizardController.saveMasterComponentHosts(stepController);
       router.transitionTo('step3');
     },
diff --git a/ambari-web/app/templates/main/admin/federation/step4.hbs 
b/ambari-web/app/templates/main/admin/federation/step4.hbs
index 840d461..79f070a 100644
--- a/ambari-web/app/templates/main/admin/federation/step4.hbs
+++ b/ambari-web/app/templates/main/admin/federation/step4.hbs
@@ -15,8 +15,5 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div class="wizard-footer col-md-12">
-  <div class="btn-area">
-    <button class="btn btn-success pull-right" {{action next}}>{{t 
common.next}} &rarr;</button>
-  </div>
-</div>
+{{template "templates/common/progress"}}
+
diff --git a/ambari-web/app/utils/ajax/ajax.js 
b/ambari-web/app/utils/ajax/ajax.js
index 6c73a84..318be8a 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -3115,6 +3115,65 @@ var urls = {
   'service.components.load': {
     real: 
'/clusters/{clusterName}/services?fields=components&minimal_response=true',
     mock: '/data/services/components.json'
+  },
+
+  'nameNode.federation.formatNameNode': {
+    'real': '/clusters/{clusterName}/requests',
+    'mock': '',
+    'format': function (data) {
+      return {
+        type: 'POST',
+        data: JSON.stringify({
+          "RequestInfo": {
+            "command" : "FORMAT", "context" : "Format NameNode"
+          },
+          "Requests/resource_filters": [{
+            "service_name" : "HDFS",
+            "component_name" : "NAMENODE",
+            "hosts": data.host
+          }]
+        })
+      }
+    }
+  },
+
+  'nameNode.federation.formatZKFC': {
+    'real': '/clusters/{clusterName}/requests',
+    'mock': '',
+    'format': function (data) {
+      return {
+        type: 'POST',
+        data: JSON.stringify({
+          "RequestInfo": {
+            "command" : "FORMAT", "context" : "Format ZKFC"
+          },
+          "Requests/resource_filters": [{
+            "service_name" : "HDFS",
+            "component_name" : "ZKFC",
+            "hosts": data.host
+          }]
+        })
+      }
+    }
+  },
+  'nameNode.federation.bootstrapNameNode': {
+    'real': '/clusters/{clusterName}/requests',
+    'mock': '',
+    'format': function (data) {
+      return {
+        type: 'POST',
+        data: JSON.stringify({
+          "RequestInfo": {
+            "command" : "BOOTSTRAP", "context" : "Bootstrap NameNode"
+          },
+          "Requests/resource_filters": [{
+            "service_name" : "HDFS",
+            "component_name" : "NAMENODE",
+            "hosts": data.host
+          }]
+        })
+      }
+    }
   }
 };
 /**
diff --git a/ambari-web/app/views/main/admin/federation/step4_view.js 
b/ambari-web/app/views/main/admin/federation/step4_view.js
index d645beb..076d2a6 100644
--- a/ambari-web/app/views/main/admin/federation/step4_view.js
+++ b/ambari-web/app/views/main/admin/federation/step4_view.js
@@ -20,5 +20,16 @@ var App = require('app');
 
 App.NameNodeFederationWizardStep4View = 
App.HighAvailabilityProgressPageView.extend({
 
-  templateName: require('templates/main/admin/federation/step4')
+  templateName: require('templates/main/admin/federation/step4'),
+
+  headerTitle: Em.I18n.t('admin.nameNodeFederation.wizard.step4.header'),
+
+  noticeInProgress: 
Em.I18n.t('admin.nameNodeFederation.wizard.step4.notice.inProgress'),
+
+  noticeCompleted: 
Em.I18n.t('admin.nameNodeFederation.wizard.step4.notice.completed'),
+
+  submitButtonText: Em.I18n.t('common.complete'),
+
+  labelWidth: 'col-md-5'
+
 });

-- 
To stop receiving notification emails like this one, please contact
akovale...@apache.org.

Reply via email to