You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/08/16 22:33:34 UTC
git commit: AMBARI-2934. NameNode HA Wizard: hardening. (Aleksandr
Kovalenko via yusaku)
Updated Branches:
refs/heads/trunk 024a009e7 -> 2ebffb165
AMBARI-2934. NameNode HA Wizard: hardening. (Aleksandr Kovalenko via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/2ebffb16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/2ebffb16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/2ebffb16
Branch: refs/heads/trunk
Commit: 2ebffb16523b875e1af87040176a77bda0de30ba
Parents: 024a009
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Fri Aug 16 13:32:55 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Fri Aug 16 13:33:23 2013 -0700
----------------------------------------------------------------------
.../highAvailability/progress_controller.js | 38 +++++++++++++++----
.../admin/highAvailability/step9_controller.js | 9 +++++
.../admin/highAvailability/wizard_controller.js | 25 +++++++++---
ambari-web/app/models/cluster_states.js | 2 +-
ambari-web/app/router.js | 3 ++
.../app/routes/high_availability_routes.js | 40 ++++++++++++++++++--
ambari-web/app/utils/ajax.js | 18 +++++++++
ambari-web/app/utils/db.js | 22 +++++++++++
.../main/admin/highAvailability/wizard_view.js | 7 ++++
9 files changed, 147 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/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 a6f4a27..1bd8ede 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -64,7 +64,20 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
}.property('tasks'),
loadTasks: function () {
- //load and set tasks statuses form server
+ var loadedStauses = this.get('content.tasksStatuses');
+ if (loadedStauses && loadedStauses.length === this.get('tasks').length) {
+ for (var i = 0; i < loadedStauses.length; i++) {
+ this.setTaskStatus(i, loadedStauses[i]);
+ }
+ if (loadedStauses.contains('FAILED')) {
+ this.showRetry();
+ }
+ if (loadedStauses.contains('IN_PROGRESS')) {
+ this.set('currentRequestIds', this.get('content.requestIds'));
+ this.set('currentTaskId', loadedStauses.indexOf('IN_PROGRESS'));
+ this.doPolling();
+ }
+ }
},
setTaskStatus: function (taskId, status) {
@@ -86,8 +99,8 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
this.set('serviceTimestamp', new Date().getTime());
},
- showRetry: function (taskId) {
- this.get('tasks').findProperty('id', taskId).set('showRetry', true);
+ showRetry: function () {
+ this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
},
retryTask: function () {
@@ -107,6 +120,17 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
this.set('isSubmitDisabled', false);
}
}
+
+ var statuses = this.get('tasks').mapProperty('status');
+ var requestIds = this.get('currentRequestIds');
+ App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
+ App.router.get(this.get('content.controllerName')).saveRequestIds(requestIds);
+ App.clusterStatus.setClusterStatus({
+ clusterName: this.get('content.cluster.name'),
+ clusterState: 'HIGH_AVAILABILITY_DEPLOY',
+ wizardControllerName: this.get('content.controllerName'),
+ localdb: App.db.data
+ });
},
/*
@@ -118,7 +142,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
onTaskError: function () {
this.setTaskStatus(this.get('currentTaskId'), 'FAILED');
- this.showRetry(this.get('currentTaskId'));
+ this.showRetry();
},
onTaskCompleted: function () {
@@ -211,6 +235,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
},
doPolling: function () {
+ this.setTaskStatus(this.get('currentTaskId'), 'IN_PROGRESS');
var requestIds = this.get('currentRequestIds');
for (var i = 0; i < requestIds.length; i++) {
App.ajax.send({
@@ -235,13 +260,13 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
var self = this;
var currentTaskId = this.get('currentTaskId');
if (!tasks.someProperty('Tasks.status', 'PENDING') && !tasks.someProperty('Tasks.status', 'QUEUED') && !tasks.someProperty('Tasks.status', 'IN_PROGRESS')) {
+ this.set('currentRequestIds', []);
if (tasks.someProperty('Tasks.status', 'FAILED')) {
this.setTaskStatus(currentTaskId, 'FAILED');
- this.showRetry(currentTaskId);
+ this.showRetry();
} else {
this.setTaskStatus(currentTaskId, 'COMPLETED');
}
- this.set('currentRequestIds', []);
} else {
var actionsPerHost = tasks.length;
var completedActions = tasks.filterProperty('Tasks.status', 'COMPLETED').length
@@ -252,7 +277,6 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
var inProgressActions = tasks.filterProperty('Tasks.status', 'IN_PROGRESS').length;
var progress = Math.ceil(((queuedActions * 0.09) + (inProgressActions * 0.35) + completedActions ) / actionsPerHost * 100);
this.get('tasks').findProperty('id', currentTaskId).set('progress', progress);
- this.setTaskStatus(currentTaskId, 'IN_PROGRESS');
window.setTimeout(function () {
self.doPolling()
}, self.POLL_INTERVAL);
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js
index 1d98775..90fd51b 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js
@@ -28,6 +28,15 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
},
installZKFC: function () {
+ App.ajax.send({
+ name: 'admin.high_availability.create_zkfc',
+ sender: this,
+ success: 'onZKFCCreate',
+ error: 'onZKFCCreate'
+ });
+ },
+
+ onZKFCCreate: function () {
var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName')
this.createComponent('ZKFC', hostName);
},
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/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 ca2f484..dd24785 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
@@ -152,11 +152,24 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
this.set('content.masterComponentHosts', masterComponentHosts);
},
- loadComponentToReassign: function () {
- var masterComponent = App.db.getMasterToReassign();
- if (masterComponent) {
- this.set('content.reassign', masterComponent);
- }
+ saveTasksStatuses: function(statuses){
+ App.db.setHighAvailabilityWizardTasksStatuses(statuses);
+ this.set('content.tasksStatuses', statuses);
+ },
+
+ loadTasksStatuses: function(){
+ var statuses = App.db.getHighAvailabilityWizardTasksStatuses();
+ this.set('content.tasksStatuses', statuses);
+ },
+
+ saveRequestIds: function(requestIds){
+ App.db.setHighAvailabilityWizardRequestIds(requestIds);
+ this.set('content.requestIds', requestIds);
+ },
+
+ loadRequestIds: function(){
+ var requestIds = App.db.getHighAvailabilityWizardRequestIds();
+ this.set('content.requestIds', requestIds);
},
/**
@@ -170,6 +183,8 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
case '7':
case '6':
case '5':
+ this.loadTasksStatuses();
+ this.loadRequestIds();
case '4':
case '3':
case '2':
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index ea6a851..14c0e90 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -23,7 +23,7 @@ App.clusterStatus = Ember.Object.create({
'ADD_HOSTS_DEPLOY_PREP_2', 'ADD_HOSTS_INSTALLING_3', 'ADD_HOSTS_INSTALLED_4', 'ADD_HOSTS_COMPLETED_5',
'ADD_SERVICES_DEPLOY_PREP_2', 'ADD_SERVICES_INSTALLING_3', 'ADD_SERVICES_INSTALLED_4', 'ADD_SERVICES_COMPLETED_5',
'STOPPING_SERVICES', 'STACK_UPGRADING', 'STACK_UPGRADE_FAILED', 'STACK_UPGRADED', 'STACK_UPGRADE_COMPLETED', 'ADD_SECURITY_STEP_1',
- 'ADD_SECURITY_STEP_2', 'ADD_SECURITY_STEP_3', 'ADD_SECURITY_STEP_4', 'DISABLE_SECURITY', 'SECURITY_COMPLETED'],
+ 'ADD_SECURITY_STEP_2', 'ADD_SECURITY_STEP_3', 'ADD_SECURITY_STEP_4', 'DISABLE_SECURITY', 'SECURITY_COMPLETED', 'HIGH_AVAILABILITY_DEPLOY'],
clusterState: 'CLUSTER_NOT_CREATED_1',
wizardControllerName: null,
localdb: null,
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 146704b..2cecd3f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -288,6 +288,9 @@ App.Router = Em.Router.extend({
} else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('reassignMasterController.name')) {
// if wizardControllerName == "reassignMasterController", then it means someone closed the browser or the browser was crashed when we were last in Reassign Master wizard
return 'main.reassignMaster';
+ } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('highAvailabilityWizardController.name')) {
+ // if wizardControllerName == "highAvailabilityWizardController", then it means someone closed the browser or the browser was crashed when we were last in NameNode High Availability wizard
+ return 'main.admin.enableHighAvailability';
} else {
// if wizardControllerName == "installerController", then it means someone closed the browser or the browser was crashed when we were last in Installer wizard
return 'installer';
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/routes/high_availability_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/high_availability_routes.js b/ambari-web/app/routes/high_availability_routes.js
index ac086b3..ad6171c 100644
--- a/ambari-web/app/routes/high_availability_routes.js
+++ b/ambari-web/app/routes/high_availability_routes.js
@@ -32,6 +32,9 @@ module.exports = Em.Route.extend({
primary: Em.I18n.t('form.cancel'),
showFooter: false,
secondary: null,
+ hideCloseButton: function () {
+ this.set('showCloseButton', App.router.get('highAvailabilityWizardController.currentStep') < 5);
+ }.observes('App.router.highAvailabilityWizardController.currentStep'),
onClose: function () {
this.hide();
@@ -42,7 +45,20 @@ module.exports = Em.Route.extend({
this.fitHeight();
}
});
- router.transitionTo('step1');
+ App.clusterStatus.updateFromServer();
+ var currentClusterStatus = App.clusterStatus.get('value');
+ if (currentClusterStatus) {
+ switch (currentClusterStatus.clusterState) {
+ case 'HIGH_AVAILABILITY_DEPLOY' :
+ App.db.data = currentClusterStatus.localdb;
+ highAvailabilityWizardController.setCurrentStep(currentClusterStatus.localdb.HighAvailabilityWizard.currentStep);
+ break;
+ default:
+ highAvailabilityWizardController.setCurrentStep('1');
+ break;
+ }
+ }
+ router.transitionTo('step' + highAvailabilityWizardController.get('currentStep'));
});
},
@@ -111,6 +127,9 @@ module.exports = Em.Route.extend({
controller.connectOutlet('highAvailabilityWizardStep4', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
next: function (router) {
router.transitionTo('step5');
}
@@ -119,7 +138,6 @@ module.exports = Em.Route.extend({
step5: Em.Route.extend({
route: '/step5',
connectOutlets: function (router) {
- $('a.close').hide();
var controller = router.get('highAvailabilityWizardController');
controller.setCurrentStep('5');
controller.setLowerStepsDisable(5);
@@ -128,6 +146,9 @@ module.exports = Em.Route.extend({
controller.connectOutlet('highAvailabilityWizardStep5', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
back: function (router) {
router.transitionTo('step4');
},
@@ -139,14 +160,17 @@ module.exports = Em.Route.extend({
step6: Em.Route.extend({
route: '/step6',
connectOutlets: function (router) {
- $('a.close').hide();
var controller = router.get('highAvailabilityWizardController');
controller.setCurrentStep('6');
+ controller.setLowerStepsDisable(6);
controller.dataLoading().done(function () {
controller.loadAllPriorSteps();
controller.connectOutlet('highAvailabilityWizardStep6', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
back: function (router) {
router.transitionTo('step5');
},
@@ -166,6 +190,9 @@ module.exports = Em.Route.extend({
controller.connectOutlet('highAvailabilityWizardStep7', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
back: function (router) {
router.transitionTo('step6');
},
@@ -177,7 +204,6 @@ module.exports = Em.Route.extend({
step8: Em.Route.extend({
route: '/step8',
connectOutlets: function (router) {
- $('a.close').hide();
var controller = router.get('highAvailabilityWizardController');
controller.setCurrentStep('8');
controller.setLowerStepsDisable(8);
@@ -186,6 +212,9 @@ module.exports = Em.Route.extend({
controller.connectOutlet('highAvailabilityWizardStep8', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
back: function (router) {
router.transitionTo('step7');
},
@@ -205,6 +234,9 @@ module.exports = Em.Route.extend({
controller.connectOutlet('highAvailabilityWizardStep9', controller.get('content'));
})
},
+ unroutePath: function () {
+ return false;
+ },
back: function (router) {
router.transitionTo('step8');
},
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index ac522ec..2cf9cf5 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -642,6 +642,24 @@ var urls = {
}
}
},
+ 'admin.high_availability.create_zkfc': {
+ 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=ZOOKEEPER',
+ 'mock': '',
+ 'type': 'POST',
+ 'format': function (data) {
+ return {
+ data: JSON.stringify({
+ "components": [
+ {
+ "ServiceComponentInfo": {
+ "component_name": "ZKFC"
+ }
+ }
+ ]
+ })
+ }
+ }
+ },
'admin.high_availability.install_component': {
'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
'mock': '',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 2061918..2cfff1d 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -350,6 +350,18 @@ App.db.setIsNameNodeHa = function (haStatus) {
localStorage.setObject('ambari', App.db.data);
};
+App.db.setHighAvailabilityWizardTasksStatuses = function (tasksStatuses) {
+ App.db.data = localStorage.getObject('ambari');
+ App.db.data.HighAvailabilityWizard.tasksStatuses = tasksStatuses;
+ localStorage.setObject('ambari', App.db.data);
+};
+
+App.db.setHighAvailabilityWizardRequestIds = function (requestIds) {
+ App.db.data = localStorage.getObject('ambari');
+ App.db.data.HighAvailabilityWizard.requestIds = requestIds;
+ localStorage.setObject('ambari', App.db.data);
+};
+
/*
* getter methods
*/
@@ -563,4 +575,14 @@ App.db.getStacks = function () {
return App.db.data.app.stacksVersions;
};
+App.db.getHighAvailabilityWizardTasksStatuses = function () {
+ App.db.data = localStorage.getObject('ambari');
+ return App.db.data.HighAvailabilityWizard.tasksStatuses;
+};
+
+App.db.getHighAvailabilityWizardRequestIds = function () {
+ App.db.data = localStorage.getObject('ambari');
+ return App.db.data.HighAvailabilityWizard.requestIds;
+};
+
module.exports = App.db;
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2ebffb16/ambari-web/app/views/main/admin/highAvailability/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/wizard_view.js
index 0852de1..998d79a 100644
--- a/ambari-web/app/views/main/admin/highAvailability/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/wizard_view.js
@@ -21,6 +21,13 @@ var App = require('app');
App.HighAvailabilityWizardView = Em.View.extend({
+ didInsertElement: function() {
+ var currentStep = this.get('controller.currentStep');
+ if (currentStep > 4) {
+ this.get('controller').setLowerStepsDisable(currentStep);
+ }
+ },
+
templateName: require('templates/main/admin/highAvailability/wizard'),
isStep1Disabled: function () {