ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-3143 NameNode HA Wizard: Add check to make sure that the JournalNodes have been initialized. (atkach)
Date Mon, 09 Sep 2013 11:04:53 GMT
Updated Branches:
  refs/heads/trunk 8098df95b -> 570028027


AMBARI-3143 NameNode HA Wizard: Add check to make sure that the JournalNodes have been initialized.
(atkach)


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

Branch: refs/heads/trunk
Commit: 5700280279b8c8b87b82c798b8959d09839e87dd
Parents: 8098df9
Author: atkach <andrey91.07@gmail.com>
Authored: Mon Sep 9 14:04:44 2013 +0300
Committer: atkach <andrey91.07@gmail.com>
Committed: Mon Sep 9 14:04:44 2013 +0300

----------------------------------------------------------------------
 .../admin/highAvailability/step6_controller.js  | 52 +++++++++++++++++++-
 ambari-web/app/messages.js                      |  1 +
 .../main/admin/highAvailability/step6.hbs       |  4 +-
 ambari-web/app/utils/ajax.js                    |  4 ++
 .../main/admin/highAvailability/step6_view.js   | 15 +++++-
 5 files changed, 72 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/57002802/ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js
index 8a36a3f..14cef8c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js
@@ -20,7 +20,57 @@ var App = require('app');
 
 App.HighAvailabilityWizardStep6Controller = Em.Controller.extend({
 
-  name:"highAvailabilityWizardStep6Controller"
+  name:"highAvailabilityWizardStep6Controller",
+
+  POLL_INTERVAL: 1000,
+
+  isNextEnabled: function(){
+    //only 3 JournalNodes could be installed
+    return (this.get('initJnCounter') === 3);
+  }.property('initJnCounter'),
+
+  initJnCounter: 0,
+
+  pullCheckPointStatus: function () {
+    this.set('initJnCounter', 0);
+    var hostNames = this.get('content.masterComponentHosts').filterProperty('component',
"JOURNALNODE").mapProperty('hostName');
+    hostNames.forEach(function (hostName) {
+      this.pullEachJnStatus(hostName);
+    }, this);
+  },
+
+  pullEachJnStatus: function(hostName){
+    App.ajax.send({
+      name: 'admin.high_availability.getJnCheckPointStatus',
+      sender: this,
+      data: {
+        hostName: hostName
+      },
+      success: 'checkJnCheckPointStatus'
+    });
+  },
+
+  checkJnCheckPointStatus: function (data) {
+    var self = this;
+    var journalStatusInfo;
+    if (data.metrics) {
+      journalStatusInfo = $.parseJSON(data.metrics.dfs.journalnode.journalsStatus);
+      if (journalStatusInfo[this.get('content.nameServiceId')] && journalStatusInfo[this.get('content.nameServiceId')].Formatted
=== "true") {
+        this.set("initJnCounter", (this.get('initJnCounter') + 1));
+        return;
+      }
+    }
+
+    window.setTimeout(function () {
+      self.pullEachJnStatus(data.HostRoles.host_name);
+    }, self.POLL_INTERVAL);
+  },
+
+  done: function () {
+    if (this.get('isNextEnabled')) {
+      App.router.send('next');
+    }
+  }
 
 })
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/57002802/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 44c6378..5156262 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -699,6 +699,7 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step4.ckNotCreated':'Checkpoint not created yet',
   'admin.highAvailability.wizard.step4.ckCreated':'Checkpoint created',
   'admin.highAvailability.wizard.step6.jsNoInit':'JournalNodes not initialized yet',
+  'admin.highAvailability.wizard.step6.jsInit':'JournalNodes initialized',
   'admin.highAvailability.wizard.step8.metaNoInit':'Metadata not initialized yet',
 
   'admin.highAvailability.rollback.header':'Disable NameNode HA Wizard',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/57002802/ambari-web/app/templates/main/admin/highAvailability/step6.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/step6.hbs b/ambari-web/app/templates/main/admin/highAvailability/step6.hbs
index 22975b5..441f94c 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/step6.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/step6.hbs
@@ -21,7 +21,7 @@
     {{{view.step6BodyText}}}
   </div>
   <div class="btn-area">
-    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
-    <span class="pull-right btn-extra-info">{{t admin.highAvailability.wizard.step6.jsNoInit}}</span>
+    <a {{bindAttr class="controller.isNextEnabled::disabled :btn :btn-success :pull-right"}}
{{action done target="controller"}}>{{t common.next}} &rarr;</a>
+    <span class="pull-right btn-extra-info">{{view.jnCheckPointText}}</span>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/57002802/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 4da2e88..626ed0b 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -621,6 +621,10 @@ var urls = {
     'mock': '',
     'type': 'GET'
   },
+  'admin.high_availability.getJnCheckPointStatus': {
+    'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics',
+    'mock': ''
+  },
   'admin.high_availability.create_component': {
     'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/57002802/ambari-web/app/views/main/admin/highAvailability/step6_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/step6_view.js b/ambari-web/app/views/main/admin/highAvailability/step6_view.js
index 4ffe6d1..375f900 100644
--- a/ambari-web/app/views/main/admin/highAvailability/step6_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/step6_view.js
@@ -23,9 +23,22 @@ App.HighAvailabilityWizardStep6View = Em.View.extend({
 
   templateName: require('templates/main/admin/highAvailability/step6'),
 
+  didInsertElement: function() {
+    this.get('controller').pullCheckPointStatus();
+  },
+
   step6BodyText: function () {
     var nN = this.get('controller.content.masterComponentHosts').findProperty('isCurNameNode',
true);
     return Em.I18n.t('admin.highAvailability.wizard.step6.body').format(this.get('controller.content.hdfsUser'),
nN.hostName);
-  }.property('controller.content.masterComponentHosts')
+  }.property('controller.content.masterComponentHosts'),
+
+  jnCheckPointText: function () {
+    var curStatus = this.get('controller.isNextEnabled');
+    if (curStatus) {
+      return Em.I18n.t('admin.highAvailability.wizard.step6.jsInit');
+    } else {
+      return Em.I18n.t('admin.highAvailability.wizard.step6.jsNoInit');
+    }
+  }.property('controller.isNextEnabled')
 
 });


Mime
View raw message