ソースを参照

AMBARI-4330. Strange behaviour of moving NameNode after enabling HA. (alexantonenko)

Alex Antonenko 11 年 前
コミット
2e22a2c338

+ 9 - 2
ambari-web/app/controllers/main/service/reassign/step2_controller.js

@@ -21,10 +21,17 @@ var App = require('app');
 App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
 App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
 
 
   currentHostId: null,
   currentHostId: null,
+  showCurrentHost: true,
 
 
   loadStep: function() {
   loadStep: function() {
     this._super();
     this._super();
-    this.rebalanceComponentHosts(this.get('content.reassign.component_name'));
+    if(this.get('content.reassign.component_name') == "NAMENODE" && !this.get('content.masterComponentHosts').findProperty('component', "SECONDARY_NAMENODE")){
+      this.set('showCurrentHost', false);
+      this.rebalanceComponentHosts('NAMENODE');
+    }else{
+      this.set('showCurrentHost', true);
+      this.rebalanceSingleComponentHosts(this.get('content.reassign.component_name'));
+    }
   },
   },
 
 
   loadComponents: function () {
   loadComponents: function () {
@@ -52,7 +59,7 @@ App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
     return result;
     return result;
   },
   },
 
 
-  rebalanceComponentHosts:function (componentName) {
+  rebalanceSingleComponentHosts:function (componentName) {
     var currentComponents = this.get("selectedServicesMasters").filterProperty("component_name", componentName),
     var currentComponents = this.get("selectedServicesMasters").filterProperty("component_name", componentName),
       componentHosts = currentComponents.mapProperty("selectedHost"),
       componentHosts = currentComponents.mapProperty("selectedHost"),
       availableComponentHosts = [],
       availableComponentHosts = [],

+ 2 - 9
ambari-web/app/controllers/wizard/step5_controller.js

@@ -643,15 +643,8 @@ App.WizardStep5Controller = Em.Controller.extend({
 
 
     currentComponents.forEach(function (item) {
     currentComponents.forEach(function (item) {
       preparedAvailableHosts = availableComponentHosts.slice(0);
       preparedAvailableHosts = availableComponentHosts.slice(0);
-      if (this.get('content.controllerName') != 'reassignMasterController') {
-        preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")));
-      } else {
-        if(item.get("host_name") != this.get('content.currentHostId')) {
-          preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("host_name")));
-        }
-        item.set("selectedHost", preparedAvailableHosts.objectAt(0).host_name);
-      }
-      preparedAvailableHosts.sort(this.sortHostsByName, this);
+      preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")))
+      preparedAvailableHosts.sort(this.sortHostsByConfig, this);
       item.set("availableHosts", preparedAvailableHosts);
       item.set("availableHosts", preparedAvailableHosts);
     }, this);
     }, this);
   },
   },

+ 1 - 1
ambari-web/app/templates/wizard/step5.hbs

@@ -27,7 +27,7 @@
 <div class="assign-masters row-fluid">
 <div class="assign-masters row-fluid">
   <div class="select-hosts span7">
   <div class="select-hosts span7">
     <div class="row-fluid">
     <div class="row-fluid">
-      {{#if currentHostId}}
+      {{#if showCurrentHost}}
         <div class="span12 control-group mlc">
         <div class="span12 control-group mlc">
           <div class="row-fluid">
           <div class="row-fluid">
             <div class="span4"><span class="pull-right control-label">{{t services.reassign.step2.currentHost}}</span></div>
             <div class="span4"><span class="pull-right control-label">{{t services.reassign.step2.currentHost}}</span></div>