incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject git commit: AMBARI-3142. NameNode HA Wizard (rollback): Based on which task failed, show tasks that need to be done for rollback
Date Mon, 09 Sep 2013 07:20:55 GMT
Updated Branches:
  refs/heads/trunk b19122629 -> 8098df95b


AMBARI-3142. NameNode HA Wizard (rollback): Based on which task failed, show tasks that need
to be done for rollback


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

Branch: refs/heads/trunk
Commit: 8098df95b87554dedbac164c21c3f0fedcf6bff7
Parents: b191226
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Sat Sep 7 17:32:23 2013 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Sat Sep 7 17:32:23 2013 +0300

----------------------------------------------------------------------
 .../highAvailability/progress_controller.js     |  4 ++
 .../highAvailability/rollback_controller.js     | 53 ++++++++++++++++++--
 .../admin/highAvailability/wizard_controller.js |  8 ++-
 ambari-web/app/routes/main.js                   |  9 ++--
 ambari-web/app/utils/db.js                      | 10 ++++
 5 files changed, 74 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8098df95/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index b2c022b..8a7283e 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -20,6 +20,8 @@ var App = require('app');
 
 App.HighAvailabilityProgressPageController = Em.Controller.extend({
 
+  name: 'highAvailabilityProgressPageController',
+
   status: 'IN_PROGRESS',
   tasks: [],
   commands: [],
@@ -107,9 +109,11 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
 
   rollback: function () {
     var task = this.get('tasks').findProperty('status', 'FAILED');
+    App.router.get(this.get('content.controllerName')).saveFailedTask(task);
     App.ModalPopup.show({
       header: Em.I18n.t('admin.highAvailability.confirmRollbackHeader'),
       primary: Em.I18n.t('common.confirm'),
+      showCloseButton: false,
       onPrimary: function () {
         App.router.transitionTo('root.main.admin.adminHighAvailability.rollback');
         this.hide();

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8098df95/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js
b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js
index 65de169..c628656 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js
@@ -23,13 +23,15 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
 
   name: "highAvailabilityRollbackController",
 
+  failedTask: null,
+
   commands: [
     'stopAllServices',
     'restoreHBaseConfigs',
     'stopFailoverControllers',
     'deleteFailoverControllers',
     'stopStandbyNameNode',
-    'stopNamenode',
+    'stopNameNode',
     'restoreHDFSConfigs',
     'enableSecondaryNameNode',
     'stopJournalNodes',
@@ -38,8 +40,42 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     'startAllServices'
   ],
 
-  getStartingPoint: function() {
-
+  loadStep: function () {
+    this.loadFailedTask();
+    this.clearStep();
+    this.loadTasks();
+    this.addObserver('tasks.@each.status', this, 'onTaskStatusChange');
+    this.onTaskStatusChange();
+  },
+
+  setCommandsAndTasks: function(tmpTasks) {
+    var fTask = this.get('failedTask');
+    var newCommands = [];
+    var newTasks = [];
+    var index = [
+      'deleteSNameNode',
+      'startAllServices',
+      'reconfigureHBase',
+      'startZKFC',
+      'installZKFC',
+      'startSecondNameNode',
+      'startNameNode',
+      'startZooKeeperServers',
+      'reconfigureHDFS',
+      'disableSNameNode',
+      'startJournalNodes',
+      'installJournalNodes',
+      'installNameNode',
+      'stopAllServices'
+    ].indexOf(fTask.command);
+
+    if(index > 6){
+      --index;
+    }
+    newCommands = this.get('commands').splice(index);
+    this.set('commands', newCommands);
+    newTasks = tmpTasks.splice(index);
+    this.set('tasks', newTasks);
   },
 
   clearStep: function () {
@@ -48,8 +84,9 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     this.set('logs', []);
     this.set('currentRequestIds', []);
     var commands = this.get('commands');
+    var tmpTasks = [];
     for (var i = 0; i < commands.length; i++) {
-      this.get('tasks').pushObject(Ember.Object.create({
+      tmpTasks.pushObject(Ember.Object.create({
         title: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'),
         status: 'PENDING',
         id: i,
@@ -62,6 +99,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
         hosts: []
       }));
     }
+    this.setCommandsAndTasks(tmpTasks);
   },
 
   onTaskStatusChange: function () {
@@ -103,6 +141,11 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     //this.set('content.tasksStatuses', statuses);
   },
 
+  loadFailedTask: function(){
+    var failedTask = App.db.getHighAvailabilityWizardFailedTask();
+    this.set('failedTask', failedTask);
+  },
+
   saveRequestIds: function(requestIds){
     App.db.setHighAvailabilityWizardRequestIds(requestIds);
     //this.set('content.requestIds', requestIds);
@@ -137,7 +180,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   stopStandbyNameNode: function(){
 
   },
-  stopNamenode: function(){
+  stopNameNode: function(){
 
   },
   restoreHDFSConfigs: function(){

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8098df95/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
index 8adde25..0f0b643 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
@@ -39,7 +39,8 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
     masterComponentHosts: null,
     serviceName: 'MISC',
     hdfsUser:"hdfs",
-    nameServiceId: ''
+    nameServiceId: '',
+    failedTask : null
   }),
 
   /**
@@ -158,6 +159,11 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
     this.set('content.tasksStatuses', statuses);
   },
 
+  saveFailedTask: function(task){
+    App.db.setHighAvailabilityWizardFailedTask(task);
+    this.set('content.failedTask', task);
+  },
+
   saveConfigTag: function(tag){
     App.db.setHighAvailabilityWizardConfigTag(tag);
     this.set('content.'+[tag.name], tag.value);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8098df95/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index f69dbb9..bc51aa4 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -661,17 +661,18 @@ module.exports = Em.Route.extend({
           Ember.run.next(function () {
             App.router.get('updateController').set('isWorking', false);
 
-
             var highAvailabilityWizardController = router.get('highAvailabilityWizardController');
-            highAvailabilityWizardController.finish();
-            highAvailabilityWizardController.get('popup').hide();
-
+            if(highAvailabilityWizardController.get('popup')){
+              highAvailabilityWizardController.finish();
+              highAvailabilityWizardController.get('popup').hide();
+            }
             var popup = App.ModalPopup.show({
               classNames: ['full-width-modal'],
               header: Em.I18n.t('admin.highAvailability.rollback.header'),
               bodyClass: App.HighAvailabilityRollbackView.extend({
                 controllerBinding: 'App.router.highAvailabilityRollbackController'
               }),
+              showCloseButton: false,
               primary: Em.I18n.t('form.cancel'),
               secondary: null,
               showFooter: false,

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8098df95/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 0287aa0..fb4c5f4 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -355,6 +355,11 @@ App.db.setHighAvailabilityWizardConfigTag = function (tag) {
   App.db.data.HighAvailabilityWizard[tag.name] = tag.value;
   localStorage.setObject('ambari', App.db.data);
 };
+App.db.setHighAvailabilityWizardFailedTask = function (task) {
+  App.db.data = localStorage.getObject('ambari');
+  App.db.data.HighAvailabilityWizard.failedTask = task;
+  localStorage.setObject('ambari', App.db.data);
+};
 
 App.db.setHighAvailabilityWizardTasksStatuses = function (tasksStatuses) {
   App.db.data = localStorage.getObject('ambari');
@@ -592,6 +597,11 @@ App.db.getHighAvailabilityWizardTasksStatuses = function () {
   return App.db.data.HighAvailabilityWizard.tasksStatuses;
 };
 
+App.db.getHighAvailabilityWizardFailedTask = function () {
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.HighAvailabilityWizard.failedTask;
+};
+
 App.db.getHighAvailabilityWizardRequestIds = function () {
   App.db.data = localStorage.getObject('ambari');
   return App.db.data.HighAvailabilityWizard.requestIds;


Mime
View raw message