Updated Branches: refs/heads/trunk d1299d1fe -> bb0c427b9
AMBARI-2856. NameNode HA Wizard: E2E integration for progress page after Create Checkpoint page. (Alexandr 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/bb0c427b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/bb0c427b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/bb0c427b Branch: refs/heads/trunk Commit: bb0c427b9abf3d71839f582843f8e65eb907445c Parents: d1299d1 Author: Yusaku Sako <[email protected]> Authored: Tue Aug 13 15:55:58 2013 -0700 Committer: Yusaku Sako <[email protected]> Committed: Tue Aug 13 15:55:58 2013 -0700 ---------------------------------------------------------------------- .../highAvailability/progress_controller.js | 26 ++++-- .../admin/highAvailability/step5_controller.js | 93 +++++++++++++++++++- ambari-web/app/styles/application.less | 6 ++ .../main/admin/highAvailability/progress.hbs | 6 ++ ambari-web/app/utils/ajax.js | 53 ++++++++++- 5 files changed, 175 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bb0c427b/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 d5a79d7..3bf3c94 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js @@ -39,6 +39,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ this.set('isSubmitDisabled', true); this.set('tasks', []); this.set('logs', []); + this.set('currentRequestIds', []); var commands = this.get('commands'); var currentStep = App.router.get('highAvailabilityWizardController.currentStep'); for (var i = 0; i < commands.length; i++) { @@ -46,7 +47,8 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ title: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'), status: 'PENDING', id: i, - command: commands[i] + command: commands[i], + showRetry: false })); } }, @@ -60,7 +62,13 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ }, showRetry: function (taskId) { - //show retry button for selected task + this.get('tasks').findProperty('id', taskId).set('showRetry', true); + }, + + retryTask: function () { + var task = this.get('tasks').findProperty('status', 'FAILED'); + task.set('showRetry', false); + task.set('status', 'PENDING'); }, onTaskStatusChange: function () { @@ -96,7 +104,10 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ if (!(hostName instanceof Array)) { hostName = [hostName]; } + var hostComponents = []; for (var i = 0; i < hostName.length; i++) { + hostComponents = App.HostComponent.find().filterProperty('componentName', componentName); + if (!hostComponents.length || !hostComponents.mapProperty('host.hostName').contains(hostName[i])) { App.ajax.send({ name: 'admin.high_availability.create_component', sender: this, @@ -108,16 +119,21 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ success: 'onCreateComponent', error: 'onTaskError' }); + } else { + var taskNum = hostName.length; + this.installComponent(componentName, hostName[i], taskNum); + } } }, onCreateComponent: function () { var hostName = arguments[2].hostName; var componentName = arguments[2].componentName; - this.installComponent(componentName, hostName); + var taskNum = arguments[2].taskNum; + this.installComponent(componentName, hostName, taskNum); }, - installComponent: function (componentName, hostName) { + installComponent: function (componentName, hostName, taskNum) { if (!(hostName instanceof Array)) { hostName = [hostName]; } @@ -129,7 +145,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ hostName: hostName[i], componentName: componentName, displayName: App.format.role(componentName), - taskNum: hostName.length + taskNum: taskNum || hostName.length }, success: 'startPolling', error: 'onTaskError' http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bb0c427b/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js index ffb4fe1..1e3c212 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js @@ -37,6 +37,15 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont }, installJournalNodes: function () { + App.ajax.send({ + name: 'admin.high_availability.create_journalnode', + sender: this, + success: 'onJournalNodeCreate', + error: 'onJournalNodeCreate' + }); + }, + + onJournalNodeCreate: function () { var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName'); this.createComponent('JOURNALNODE', hostNames); }, @@ -61,8 +70,90 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont }, reconfigureHDFS: function () { + this.loadConfigsTags(); + }, + + loadConfigsTags: function () { + App.ajax.send({ + name: 'config.tags', + sender: this, + success: 'onLoadConfigsTags', + error: 'onTaskError' + }); + }, + + onLoadConfigsTags: function (data) { + var hdfsSiteTag = data.Clusters.desired_configs['hdfs-site'].tag; + var coreSiteTag = data.Clusters.desired_configs['core-site'].tag; + App.ajax.send({ + name: 'admin.high_availability.load_configs', + sender: this, + data: { + hdfsSiteTag: hdfsSiteTag, + coreSiteTag: coreSiteTag + }, + success: 'onLoadConfigs', + error: 'onTaskError' + }); + }, + + onLoadConfigs: function (data) { + var hdfsSiteProperties = data.items.findProperty('type', 'hdfs-site').properties; + var coreSiteProperties = data.items.findProperty('type', 'core-site').properties; + + var currentNameNodeHost = this.get('content.masterComponentHosts').findProperty('isCurNameNode').hostName; + var newNameNodeHost = this.get('content.masterComponentHosts').findProperty('isAddNameNode').hostName; + var journalNodeHosts = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName'); + var zooKeeperHosts = this.get('content.masterComponentHosts').filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName'); + + //hdfs-site configs changes + hdfsSiteProperties['dfs.nameservices'] = 'mycluster'; + hdfsSiteProperties['dfs.ha.namenodes.mycluster'] = 'nn1,nn2'; + hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn1'] = currentNameNodeHost + ':8020'; + hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn2'] = newNameNodeHost + ':8020'; + hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn1'] = currentNameNodeHost + ':50070'; + hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn2'] = newNameNodeHost + ':50070'; + hdfsSiteProperties['dfs.namenode.shared.edits.dir'] = 'qjournal://' + journalNodeHosts[0] + ':8485:' + journalNodeHosts[1] + ':8485:' + journalNodeHosts[2] + ':8485:/mycluster'; + hdfsSiteProperties['dfs.client.failover.proxy.provider.mycluster'] = 'org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'; + hdfsSiteProperties['dfs.ha.fencing.methods'] = 'shell(/bin/true)'; + hdfsSiteProperties['dfs.journalnode.edits.dir'] = '/grid/0/hdfs/journal'; + hdfsSiteProperties['dfs.ha.automatic-failover.enabled'] = 'true'; + + //core-site configs changes + coreSiteProperties['ha.zookeeper.quorum'] = zooKeeperHosts[0] + ':2181,' + zooKeeperHosts[1] + ':2181,' + zooKeeperHosts[2] + ':2181'; + coreSiteProperties['fs.defaultFS'] = 'hdfs://mycluster'; + this.set('configsSaved', false); + App.ajax.send({ + name: 'admin.high_availability.save_configs', + sender: this, + data: { + siteName: 'hdfs-site', + properties: hdfsSiteProperties + }, + success: 'installHDFSClients', + error: 'onTaskError' + }); + App.ajax.send({ + name: 'admin.high_availability.save_configs', + sender: this, + data: { + siteName: 'core-site', + properties: coreSiteProperties + }, + success: 'installHDFSClients', + error: 'onTaskError' + }); + }, + + configsSaved: false, + + installHDFSClients: function () { + if (!this.get('configsSaved')) { + this.set('configsSaved', true); + return; + } var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName'); - this.installComponent('HDFS_CLIENT', hostNames); + this.createComponent('HDFS_CLIENT', hostNames); } }); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bb0c427b/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 27441ec..90dbd5b 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -456,6 +456,12 @@ h1 { .row { margin-left: 0; } + .retry { + margin-left: 15px; + i { + font-size: 14px; + } + } } } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bb0c427b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs index 5858c58..48c8f02 100644 --- a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs +++ b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs @@ -24,6 +24,12 @@ <div class="item"> <i {{bindAttr class="view.icon view.iconColor"}}></i> <a href="javascript:void(0)">{{task.title}}</a> + {{#if task.showRetry}} + <a {{action retryTask target="controller"}} class="btn btn-primary retry"> + <i class="icon-repeat icon-white"></i> + {{t common.retry}} + </a> + {{/if}} </div> <div {{bindAttr class="view.showProgressBar::hide :row :span12" }}> <div class="progress-bar span4"> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bb0c427b/ambari-web/app/utils/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js index 3e6d42c..5f55d9c 100644 --- a/ambari-web/app/utils/ajax.js +++ b/ambari-web/app/utils/ajax.js @@ -565,6 +565,7 @@ var urls = { }, 'admin.high_availability.stop_all_services': { 'real': '/clusters/{clusterName}/services?ServiceInfo/state=STARTED', + 'mock': '', 'format': function (data, opt) { return { type: 'PUT', @@ -583,6 +584,7 @@ var urls = { }, 'admin.high_availability.start_all_services': { 'real': '/clusters/{clusterName}/services?ServiceInfo/state=INSTALLED', + 'mock': '', 'format': function (data, opt) { return { type: 'PUT', @@ -622,8 +624,27 @@ var urls = { } } }, + 'admin.high_availability.create_journalnode': { + 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=HDFS', + 'mock': '', + 'type': 'POST', + 'format': function (data) { + return { + data: JSON.stringify({ + "components": [ + { + "ServiceComponentInfo": { + "component_name": "JOURNALNODE" + } + } + ] + }) + } + } + }, 'admin.high_availability.install_component': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'mock': '', 'type': 'PUT', 'format': function (data) { return { @@ -641,16 +662,17 @@ var urls = { } }, 'admin.high_availability.start_component': { - 'real': '/clusters/{clusterName}/services/{serviceName}', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'mock': '', 'type': 'PUT', 'format': function (data) { return { data: JSON.stringify({ RequestInfo: { - "context": "Start service " + data.displayName + "context": "Start " + data.displayName }, Body: { - ServiceInfo: { + "HostRoles": { "state": "STARTED" } } @@ -660,6 +682,7 @@ var urls = { }, 'admin.high_availability.maintenance_mode': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'mock': '', 'type': 'PUT', 'format': function () { return { @@ -671,6 +694,30 @@ var urls = { } } }, + 'admin.high_availability.load_configs': { + 'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})', + 'mock': '', + 'type': 'GET' + }, + 'admin.high_availability.save_configs': { + 'real': '/clusters/{clusterName}', + 'mock': '', + 'type': 'PUT', + 'format': function (data) { + return { + async: false, + data: JSON.stringify({ + Clusters: { + desired_config: { + "type": data.siteName, + "tag": 'version' + (new Date).getTime(), + "properties": data.properties + } + } + }) + } + } + }, 'admin.security.cluster_configs': { 'real': '/clusters/{clusterName}', 'format': function (data, opt) {
