You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/07/23 18:59:19 UTC

git commit: AMBARI-6583. RM HA: Create Step4. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 4986296a3 -> e72900f57


AMBARI-6583. RM HA: Create Step4. (akovalenko)


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

Branch: refs/heads/trunk
Commit: e72900f57814b16ae540777de63d8455688b1e9d
Parents: 4986296
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Jul 23 19:57:12 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Jul 23 19:58:15 2014 +0300

----------------------------------------------------------------------
 .../highAvailability/progress_controller.js     | 10 +-
 .../resourceManager/step4_controller.js         | 99 +++++++++++++++++++-
 .../resourceManager/wizard_controller.js        | 51 ++++++++++
 ambari-web/app/messages.js                      |  6 ++
 .../app/routes/rm_high_availability_routes.js   |  7 +-
 .../main/admin/highAvailability/progress.hbs    |  2 +-
 .../highAvailability/resourceManager/step4.hbs  |  8 +-
 .../resourceManager/step4_view.js               | 12 ++-
 .../resourceManager/wizard_view.js              | 45 ++++++++-
 9 files changed, 220 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/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 19b421e..8f4e087 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -33,6 +33,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   POLL_INTERVAL: 4000,
   isSubmitDisabled: true,
   isRollback: false,
+  tasksMessagesPrefix: 'admin.highAvailability.wizard.step',
 
   loadStep: function () {
     console.warn('func: loadStep');
@@ -53,17 +54,18 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   initializeTasks: function () {
     console.warn('func: initializeTasks');
     var commands = this.get('commands');
-    var currentStep = App.router.get('highAvailabilityWizardController.currentStep');
+    var currentStep = App.router.get(this.get('content.controllerName') + '.currentStep');
+    var tasksMessagesPrefix = this.get('tasksMessagesPrefix');
     for (var i = 0; i < commands.length; i++) {
       this.get('tasks').pushObject(Ember.Object.create({
-        title: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
+        title: Em.I18n.t(tasksMessagesPrefix + currentStep + '.task' + i + '.title'),
         status: 'PENDING',
         id: i,
         command: commands[i],
         showRetry: false,
         showRollback: false,
-        name: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
-        displayName: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
+        name: Em.I18n.t(tasksMessagesPrefix + currentStep + '.task' + i + '.title'),
+        displayName: Em.I18n.t(tasksMessagesPrefix + currentStep + '.task' + i + '.title'),
         progress: 0,
         isRunning: false,
         requestIds: []

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
index 07353b4..5e0e97c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
@@ -20,7 +20,102 @@ var App = require('app');
 
 require('controllers/main/admin/misc_controller');
 
-App.RMHighAvailabilityWizardStep4Controller = Em.Controller.extend({
-  name:"rMHighAvailabilityWizardStep4Controller"
+App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageController.extend({
+
+  name: "rMHighAvailabilityWizardStep4Controller",
+
+  isRMHA: true,
+
+  clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
+
+  commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'startAllServices'],
+
+  tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
+
+  stopRequiredServices: function () {
+    var list = App.Service.find().mapProperty("serviceName").without("HDFS").join(',');
+    App.ajax.send({
+      name: 'common.services.update',
+      sender: this,
+      data: {
+        "context": "Stop without HDFS",
+        "ServiceInfo": {
+          "state": "INSTALLED"
+        },
+        urlParams: "ServiceInfo/service_name.in(" + list + ")"},
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  installResourceManager: function () {
+    var hostName = this.get('content.rmHosts.additionalRM');
+    this.createComponent('RESOURCEMANAGER', hostName, "YARN");
+  },
+
+  reconfigureYARN: function () {
+    this.loadConfigsTags();
+  },
+
+  loadConfigsTags: function () {
+    App.ajax.send({
+      name: 'config.tags',
+      sender: this,
+      success: 'onLoadConfigsTags',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadConfigsTags: function (data) {
+    App.ajax.send({
+      name: 'reassign.load_configs',
+      sender: this,
+      data: {
+        urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')'
+      },
+      success: 'onLoadConfigs',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadConfigs: function (data) {
+    var propertiesToAdd = this.get('content.configs');
+    var configs = data.items[0].properties;
+
+    propertiesToAdd.forEach(function (property) {
+      configs[property.name] = property.value;
+    });
+
+    App.ajax.send({
+      name: 'reassign.save_configs',
+      sender: this,
+      data: {
+        siteName: 'yarn-site',
+        properties: configs
+      },
+      success: 'onSaveConfigs',
+      error: 'onTaskError'
+    });
+  },
+
+  onSaveConfigs: function () {
+    this.onTaskCompleted();
+  },
+
+  startAllServices: function () {
+    App.ajax.send({
+      name: 'common.services.update',
+      sender: this,
+      data: {
+        "context": "Start all services",
+        "ServiceInfo": {
+          "state": "STARTED"
+        },
+        urlParams: "params/run_smoke_test=true"
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  }
 });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
index af7e871..89d64e8 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
@@ -57,12 +57,63 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({
   },
 
   /**
+   * Save configs to load and apply them on Configure Components step
+   * @param configs
+   */
+  saveConfigs: function (configs) {
+    this.set('content.configs', configs);
+    this.setDBProperty('configs', configs);
+  },
+
+  /**
+   * Load configs to apply them on Configure Components step
+   */
+  loadConfigs: function() {
+    var configs = this.getDBProperty('configs');
+    this.set('content.configs', configs);
+  },
+
+  saveTasksStatuses: function (tasksStatuses) {
+    this.set('content.tasksStatuses', tasksStatuses);
+    this.setDBProperty('tasksStatuses', tasksStatuses);
+  },
+
+  loadTasksStatuses: function() {
+    var tasksStatuses = this.getDBProperty('tasksStatuses');
+    this.set('content.tasksStatuses', tasksStatuses);
+  },
+
+  saveTasksRequestIds: function (tasksRequestIds) {
+    this.set('content.tasksRequestIds', tasksRequestIds);
+    this.setDBProperty('tasksRequestIds', tasksRequestIds);
+  },
+
+  loadTasksRequestIds: function() {
+    var tasksRequestIds = this.getDBProperty('tasksRequestIds');
+    this.set('content.tasksRequestIds', tasksRequestIds);
+  },
+
+  saveRequestIds: function (requestIds) {
+    this.set('content.requestIds', requestIds);
+    this.setDBProperty('requestIds', requestIds);
+  },
+
+  loadRequestIds: function() {
+    var requestIds = this.getDBProperty('requestIds');
+    this.set('content.requestIds', requestIds);
+  },
+
+  /**
    * Load data for all steps until <code>current step</code>
    */
   loadAllPriorSteps: function () {
     var step = this.get('currentStep');
     switch (step) {
       case '4':
+        this.loadTasksStatuses();
+        this.loadTasksRequestIds();
+        this.loadRequestIds();
+        this.loadConfigs();
       case '3':
         this.loadRmHosts();
       case '2':

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 537b5f5..20cceee 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -994,6 +994,12 @@ Em.I18n.translations = {
   'admin.rm_highAvailability.wizard.step3.currentRM': 'Current ResourceManager',
   'admin.rm_highAvailability.wizard.step3.additionalRM': 'Additional ResourceManager',
   'admin.rm_highAvailability.wizard.step4.header': 'Configure Components',
+  'admin.rm_highAvailability.wizard.step4.task0.title': 'Stop Required Services',
+  'admin.rm_highAvailability.wizard.step4.task1.title': 'Install Additional ResourceManager',
+  'admin.rm_highAvailability.wizard.step4.task2.title': 'Reconfigure YARN',
+  'admin.rm_highAvailability.wizard.step4.task3.title': 'Start All Services',
+  'admin.rm_highAvailability.wizard.step4.notice.inProgress':'Please wait while ResourceManager HA is being deployed.',
+  'admin.rm_highAvailability.wizard.step4.notice.completed':'NameNode HA has been enabled successfully.',
 
   'admin.security.title':'Kerberos security has not been enabled',
   'admin.security.enabled': 'Kerberos security is enabled',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/routes/rm_high_availability_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/rm_high_availability_routes.js b/ambari-web/app/routes/rm_high_availability_routes.js
index 5bf45a5..a84c1f5 100644
--- a/ambari-web/app/routes/rm_high_availability_routes.js
+++ b/ambari-web/app/routes/rm_high_availability_routes.js
@@ -131,18 +131,23 @@ module.exports = App.WizardRoute.extend({
       return false;
     },
     next: function (router) {
+      var wizardController = router.get('rMHighAvailabilityWizardController');
+      var stepController = router.get('rMHighAvailabilityWizardStep3Controller');
+      var configs = stepController.get('selectedService.configs');
+      wizardController.saveConfigs(configs);
       router.transitionTo('step4');
     },
     back: Em.Router.transitionTo('step2')
   }),
 
   step4: Em.Route.extend({
-    route: '/step9',
+    route: '/step4',
     connectOutlets: function (router) {
       var controller = router.get('rMHighAvailabilityWizardController');
       controller.setCurrentStep('4');
       controller.setLowerStepsDisable(4);
       controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
         controller.connectOutlet('rMHighAvailabilityWizardStep4',  controller.get('content'));
       })
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/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 18297f5..980511a 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
@@ -22,7 +22,7 @@
   {{#each task in controller.tasks}}
   {{#view view.taskView contentBinding="task"}}
     <div class="item">
-      <div {{bindAttr class=":pull-left view.linkClass controller.isHA:span4 controller.isRollback:span3 controller.isReassign:span5"}}>
+      <div {{bindAttr class=":pull-left view.linkClass controller.isHA:span4 controller.isRMHA:span5 controller.isRollback:span3 controller.isReassign:span5"}}>
         <i {{bindAttr class="view.icon view.iconColor"}}></i>
         <a {{action "showHostProgressPopup" task target="controller"}} >{{task.title}}</a>
       </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step4.hbs b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step4.hbs
index 38bc9e2..defea53 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step4.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step4.hbs
@@ -15,10 +15,4 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div>
-  <h2>{{t admin.rm_highAvailability.wizard.step4.header}}</h2>
-
-  <div class="btn-area">
-    <a class="btn btn-success pull-right" {{action next}}>{{t common.complete}}</a>
-  </div>
-</div>
+{{template "templates/main/admin/highAvailability/progress"}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/views/main/admin/highAvailability/resourceManager/step4_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/resourceManager/step4_view.js b/ambari-web/app/views/main/admin/highAvailability/resourceManager/step4_view.js
index 04dc9da..a2f8b2b 100644
--- a/ambari-web/app/views/main/admin/highAvailability/resourceManager/step4_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/resourceManager/step4_view.js
@@ -19,8 +19,16 @@
 
 var App = require('app');
 
-App.RMHighAvailabilityWizardStep4View = Em.View.extend({
+App.RMHighAvailabilityWizardStep4View = App.HighAvailabilityProgressPageView.extend({
 
-  templateName: require('templates/main/admin/highAvailability/resourceManager/step4')
+  templateName: require('templates/main/admin/highAvailability/resourceManager/step4'),
+
+  headerTitle: Em.I18n.t('admin.rm_highAvailability.wizard.step4.header'),
+
+  noticeInProgress: Em.I18n.t('admin.rm_highAvailability.wizard.step4.notice.inProgress'),
+
+  noticeCompleted: Em.I18n.t('admin.rm_highAvailability.wizard.step4.notice.completed'),
+
+  submitButtonText: Em.I18n.t('common.complete')
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/e72900f5/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
index 7dc4afe..bfc1fb1 100644
--- a/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
@@ -21,8 +21,6 @@ var App = require('app');
 
 App.RMHighAvailabilityWizardView = Em.View.extend({
 
-  isLoaded: true,
-
   didInsertElement: function() {
     var currentStep = this.get('controller.currentStep');
     if (currentStep > 3) {
@@ -50,6 +48,47 @@ App.RMHighAvailabilityWizardView = Em.View.extend({
 
   isStepDisabled: function (index) {
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
-  }
+  },
+
+  isLoaded: false,
+
+  willInsertElement: function() {
+    this.set('isLoaded', false);
+    this.loadHosts();
+  },
 
+  /**
+   * load hosts from server
+   */
+  loadHosts: function () {
+    App.ajax.send({
+      name: 'hosts.high_availability.wizard',
+      data: {},
+      sender: this,
+      success: 'loadHostsSuccessCallback',
+      error: 'loadHostsErrorCallback'
+    });
+  },
+
+  loadHostsSuccessCallback: function (data, opt, params) {
+    var hosts = {};
+
+    data.items.forEach(function (item) {
+      hosts[item.Hosts.host_name] = {
+        name: item.Hosts.host_name,
+        cpu: item.Hosts.cpu_count,
+        memory: item.Hosts.total_mem,
+        disk_info: item.Hosts.disk_info,
+        bootStatus: "REGISTERED",
+        isInstalled: true
+      };
+    });
+    App.db.setHosts(hosts);
+    this.set('controller.content.hosts', hosts);
+    this.set('isLoaded', true);
+  },
+
+  loadHostsErrorCallback: function(){
+    this.set('isLoaded', true);
+  }
 });