Browse Source

AMBARI-2011. Add Hosts gets stuck at 33% (some hosts in the cluster were down). (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1471772 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
2965debae2

+ 3 - 0
CHANGES.txt

@@ -789,6 +789,9 @@ Trunk (unreleased changes):
 
 
  BUG FIXES
  BUG FIXES
 
 
+ AMBARI-2011. Add Hosts gets stuck at 33% (some hosts in the cluster were
+ down). (yusaku)
+
  AMBARI-2014. Install Wizard/Add Host Wizard Review page: local repo option
  AMBARI-2014. Install Wizard/Add Host Wizard Review page: local repo option
  is always displayed as "No", even when it is enabled. (yusaku)
  is always displayed as "No", even when it is enabled. (yusaku)
 
 

+ 16 - 1
ambari-web/app/controllers/wizard.js

@@ -259,13 +259,28 @@ App.WizardController = Em.Controller.extend({
 
 
     switch (this.get('content.controllerName')) {
     switch (this.get('content.controllerName')) {
       case 'addHostController':
       case 'addHostController':
+
+        var hostnames = [];
+        for (var hostname in App.db.getHosts()) {
+          hostnames.push(hostname);
+        }
+
         if (isRetry) {
         if (isRetry) {
           name = 'wizard.install_services.add_host_controller.is_retry';
           name = 'wizard.install_services.add_host_controller.is_retry';
         }
         }
         else {
         else {
           name = 'wizard.install_services.add_host_controller.not_is_retry';
           name = 'wizard.install_services.add_host_controller.not_is_retry';
         }
         }
-        data = '{"RequestInfo": {"context" :"'+ Em.I18n.t('requestInfo.installComponents') +'"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}';
+        data = {
+          "RequestInfo": {
+            "context": Em.I18n.t('requestInfo.installComponents'),
+            "query": "HostRoles/host_name.in(" + hostnames.join(',') + ")"
+          },
+          "Body": {
+            "HostRoles": {"state": "INSTALLED"}
+          }
+        };
+        data = JSON.stringify(data);
         break;
         break;
       case 'installerController':
       case 'installerController':
       default:
       default:

+ 23 - 2
ambari-web/app/controllers/wizard/step9_controller.js

@@ -332,12 +332,33 @@ App.WizardStep9Controller = Em.Controller.extend({
    * run start/check services after installation phase
    * run start/check services after installation phase
    */
    */
   launchStartServices: function () {
   launchStartServices: function () {
-    var data = '{"RequestInfo": {"context": "'+Em.I18n.t("requestInfo.startServices")+'"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}';
+    var data = {
+      "RequestInfo": {
+        "context": Em.I18n.t("requestInfo.startServices")
+      },
+      "Body": {
+        "ServiceInfo": { "state": "STARTED" }
+      }
+    };
     var name = 'wizard.step9.installer.launch_start_services';
     var name = 'wizard.step9.installer.launch_start_services';
+
     if (this.get('content.controllerName') === 'addHostController') {
     if (this.get('content.controllerName') === 'addHostController') {
-      data = '{"RequestInfo": {"context": "'+Em.I18n.t("requestInfo.startHostComponents")+'"}, "Body": {"HostRoles": {"state": "STARTED"}}}';
+      var hostnames = [];
+      for (var hostname in App.db.getHosts()) {
+        hostnames.push(hostname);
+      }
+      data = {
+        "RequestInfo": {
+          "context": Em.I18n.t("requestInfo.startHostComponents"),
+          "query": "HostRoles/component_name.in(GANGLIA_MONITOR,HBASE_REGIONSERVER,DATANODE,TASKTRACKER)&HostRoles/state=INSTALLED&HostRoles/host_name.in(" + hostnames.join(',') + ")"
+        },
+        "Body": {
+          "HostRoles": { "state": "STARTED" }
+        }
+      };
       name = 'wizard.step9.add_host.launch_start_services';
       name = 'wizard.step9.add_host.launch_start_services';
     }
     }
+    data = JSON.stringify(data);
     if (App.testMode) {
     if (App.testMode) {
       this.numPolls = 6;
       this.numPolls = 6;
     }
     }

+ 4 - 4
ambari-web/app/utils/ajax.js

@@ -536,7 +536,7 @@ var urls = {
     }
     }
   },
   },
   'wizard.install_services.add_host_controller.is_retry': {
   'wizard.install_services.add_host_controller.is_retry': {
-    'real': '/clusters/{cluster}/host_components?HostRoles/state=INSTALLED',
+    'real': '/clusters/{cluster}/host_components',
     'format': function (data, opt) {
     'format': function (data, opt) {
       return {
       return {
         type: 'PUT',
         type: 'PUT',
@@ -546,7 +546,7 @@ var urls = {
     }
     }
   },
   },
   'wizard.install_services.add_host_controller.not_is_retry': {
   'wizard.install_services.add_host_controller.not_is_retry': {
-    'real': '/clusters/{cluster}/host_components?HostRoles/state=INIT',
+    'real': '/clusters/{cluster}/host_components',
     'format': function (data, opt) {
     'format': function (data, opt) {
       return {
       return {
         type: 'PUT',
         type: 'PUT',
@@ -556,7 +556,7 @@ var urls = {
     }
     }
   },
   },
   'wizard.install_services.installer_controller.is_retry': {
   'wizard.install_services.installer_controller.is_retry': {
-    'real': '/clusters/{cluster}/host_components?HostRoles/state!=INSTALLED',
+    'real': '/clusters/{cluster}/host_components?HostRoles/state=INSTALLED',
     'mock': '/data/wizard/deploy/2_hosts/poll_1.json',
     'mock': '/data/wizard/deploy/2_hosts/poll_1.json',
     'format': function (data, opt) {
     'format': function (data, opt) {
       return {
       return {
@@ -602,7 +602,7 @@ var urls = {
     }
     }
   },
   },
   'wizard.step9.add_host.launch_start_services': {
   'wizard.step9.add_host.launch_start_services': {
-    'real': '/clusters/{cluster}/host_components?(HostRoles/component_name=GANGLIA_MONITOR|HostRoles/component_name=HBASE_REGIONSERVER|HostRoles/component_name=DATANODE|HostRoles/component_name=TASKTRACKER)&(HostRoles/state=INSTALLED)',
+    'real': '/clusters/{cluster}/host_components',
     'mock': '/data/wizard/deploy/5_hosts/poll_6.json',
     'mock': '/data/wizard/deploy/5_hosts/poll_6.json',
     'format': function (data, opt) {
     'format': function (data, opt) {
       return {
       return {