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 2012/11/08 03:46:20 UTC

svn commit: r1406899 - in /incubator/ambari/branches/AMBARI-666: AMBARI-666-CHANGES.txt ambari-web/app/controllers/wizard/step5_controller.js ambari-web/app/controllers/wizard/step6_controller.js

Author: yusaku
Date: Thu Nov  8 02:46:20 2012
New Revision: 1406899

URL: http://svn.apache.org/viewvc?rev=1406899&view=rev
Log:
AMBARI-956. On unavailability of non-master components, host with least number of master components should install all slave and client components. (Jaimin Jetly via yusaku)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1406899&r1=1406898&r2=1406899&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Thu Nov  8 02:46:20 2012
@@ -388,6 +388,10 @@ AMBARI-666 branch (unreleased changes)
   AMBARI-676. Seperate directory for ambari-server. (jitendra)
 
   IMPROVEMENTS
+
+  AMBARI-956. On unavailability of non-master components, host with least
+  number of master components should install all slave and client components. 
+  (Jaimin Jetly via yusaku)
  
   AMBARI-990. Refactor App Browser. (yusaku)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js?rev=1406899&r1=1406898&r2=1406899&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js Thu Nov  8 02:46:20 2012
@@ -91,7 +91,7 @@ App.WizardStep5Controller = Em.Controlle
         componentInfo.forEach(function (_componentInfo) {
           console.log("TRACE: master component name is: " + _componentInfo.display_name);
           var componentObj = {};
-          componentObj.component_name =  _componentInfo.component_name;
+          componentObj.component_name = _componentInfo.component_name;
           componentObj.display_name = _componentInfo.display_name;
           componentObj.selectedHost = this.selectHost(_componentInfo.component_name);   // call the method that plays selectNode algorithm or fetches from server
           componentObj.availableHosts = [];
@@ -103,7 +103,7 @@ App.WizardStep5Controller = Em.Controlle
 
       masterHosts.forEach(function (_masterComponentHost) {
         var componentObj = {};
-        componentObj.component_name =  _masterComponentHost.component_name;
+        componentObj.component_name = _masterComponentHost.component;
         componentObj.display_name = _masterComponentHost.display_name;
         componentObj.selectedHost = _masterComponentHost.hostName;
         componentObj.availableHosts = [];
@@ -140,7 +140,7 @@ App.WizardStep5Controller = Em.Controlle
         zookeeperComponent.set('zId', this.get('zId'));
         zookeeperComponent.set("showRemoveControl", true);
         zookeeperComponent.set("availableHosts", this.get("hosts").slice(0));
-        this.get("selectedServicesMasters").pushObject(Ember.Object.create(zookeeperComponent));
+        this.get("selectedServicesMasters").pushObject(zookeeperComponent);
 
       } else {
         componentObj = Ember.Object.create(item);

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js?rev=1406899&r1=1406898&r2=1406899&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js Thu Nov  8 02:46:20 2012
@@ -82,15 +82,15 @@ App.WizardStep6Controller = Em.Controlle
    * Calculate this information on <code>content.services</code> variable
    * @return Boolean
    */
-	isMrSelected: function () {
+  isMrSelected: function () {
     return this.get('content.services').findProperty('serviceName', 'MAPREDUCE').get('isSelected');
-	}.property('content.services'),
+  }.property('content.services'),
 
   clearError: function () {
     if (this.get('isNoDataNodes') === false &&
-        (this.get('isNoTaskTrackers') === false || this.get('isMrSelected') === false) &&
-        (this.get('isNoRegionServers') === false || this.get('isHbSelected') === false) &&
-        this.get('isNoClients') === false) {
+      (this.get('isNoTaskTrackers') === false || this.get('isMrSelected') === false) &&
+      (this.get('isNoRegionServers') === false || this.get('isHbSelected') === false) &&
+      this.get('isNoClients') === false) {
       this.set('errorMessage', '');
     }
   }.observes('isNoDataNodes', 'isNoTaskTrackers', 'isNoRegionServers', 'isNoClients'),
@@ -168,6 +168,7 @@ App.WizardStep6Controller = Em.Controlle
   renderSlaveHosts: function () {
     var hostsObj = Em.Set.create();
     var allHosts = this.getHostNames();
+    var maxNoofHostComponents = 9;
     var slaveHosts = this.get('content.slaveComponentHosts');
 
     allHosts.forEach(function (_hostName) {
@@ -182,20 +183,38 @@ App.WizardStep6Controller = Em.Controlle
     });
 
     if (!slaveHosts) { // we are at this page for the first time
-
-      hostsObj.forEach(function (host) {
-        host.isMaster = this.hasMasterComponents(host.hostname);
-        host.isDataNode = host.isTaskTracker
+      if (allHosts.length > 3) {             //multiple nodes scenario
+        hostsObj.forEach(function (host) {
+          host.isMaster = this.hasMasterComponents(host.hostname);
+          host.isDataNode = host.isTaskTracker
             = host.isRegionServer = !host.isMaster;
-      }, this);
+        }, this);
+
+        if (hostsObj.someProperty('isDataNode', true)) {
+          hostsObj.findProperty('isDataNode', true).set('isClient', true);
+        }
+      } else {
+        var masterObj = {
+          host: null,
+          masterComponents: maxNoofHostComponents
+        };
+        hostsObj.forEach(function (host) {
+          host.isMaster = this.hasMasterComponents(host.hostname);
+          if (this.getMasterComponentsForHost(host.hostname).length <= masterObj.masterComponents) {
+            masterObj.masterComponents = this.getMasterComponentsForHost(host.hostname).length;
+            masterObj.host = host;
+          }
+        }, this);
+        masterObj.host.set('isClient', true);
+        masterObj.host.set('isDataNode', true);
+        masterObj.host.set('isTaskTracker', true);
+        masterObj.host.set('isRegionServer', true);
 
-      if (hostsObj.someProperty('isDataNode', true)) {
-        hostsObj.findProperty('isDataNode', true).set('isClient', true);
       }
 
     } else {
 
-			var dataNodes = slaveHosts.findProperty('componentName', 'DATANODE');
+      var dataNodes = slaveHosts.findProperty('componentName', 'DATANODE');
       dataNodes.hosts.forEach(function (_dataNode) {
         var dataNode = hostsObj.findProperty('hostname', _dataNode.hostname);
         if (dataNode) {
@@ -203,7 +222,7 @@ App.WizardStep6Controller = Em.Controlle
         }
       });
 
-      if(this.get('isMrSelected')) {
+      if (this.get('isMrSelected')) {
         var taskTrackers = slaveHosts.findProperty('componentName', 'TASKTRACKER');
         taskTrackers.hosts.forEach(function (_taskTracker) {
           var taskTracker = hostsObj.findProperty('hostname', _taskTracker.hostname);
@@ -214,7 +233,7 @@ App.WizardStep6Controller = Em.Controlle
       }
 
       if (this.get('isHbSelected')) {
-				var regionServers = slaveHosts.findProperty('componentName', 'HBASE_REGIONSERVER');
+        var regionServers = slaveHosts.findProperty('componentName', 'HBASE_REGIONSERVER');
         regionServers.hosts.forEach(function (_regionServer) {
           var regionServer = hostsObj.findProperty('hostname', _regionServer.hostname);
           if (regionServer) {
@@ -240,7 +259,7 @@ App.WizardStep6Controller = Em.Controlle
 
     }
 
-    hostsObj.forEach(function(host){
+    hostsObj.forEach(function (host) {
       this.get('hosts').pushObject(host);
     }, this);
   },
@@ -252,7 +271,7 @@ App.WizardStep6Controller = Em.Controlle
    */
   getMasterComponentsForHost: function (hostname) {
     var hostInfo = this.get('content.hostToMasterComponent').findProperty('hostname', hostname);
-    if(hostInfo){
+    if (hostInfo) {
       return hostInfo.components;
     }
 
@@ -265,11 +284,11 @@ App.WizardStep6Controller = Em.Controlle
    * @return {Boolean}
    */
   validate: function () {
-    var isError =  this.get('isNoDataNodes') || this.get('isNoClients')
+    var isError = this.get('isNoDataNodes') || this.get('isNoClients')
       || ( this.get('isMrSelected') && this.get('isNoTaskTrackers'))
-      || ( this.get('isHbSelected') &&this.get('isNoRegionServers'));
+      || ( this.get('isHbSelected') && this.get('isNoRegionServers'));
 
-    if(isError){
+    if (isError) {
       this.set('errorMessage', Ember.I18n.t('installer.step6.error.mustSelectOne'));
     }
     return !isError;