ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-15632: Move wizard failed on Delete component operation if component is in MM (akovalenko)
Date Wed, 30 Mar 2016 18:50:10 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk dfa4454e7 -> d41203d72


AMBARI-15632: Move wizard failed on Delete component operation if component is in MM (akovalenko)


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

Branch: refs/heads/trunk
Commit: d41203d729d98506b390859df2e5d3100d97f7e5
Parents: dfa4454
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Mar 30 20:14:51 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Mar 30 21:49:28 2016 +0300

----------------------------------------------------------------------
 .../main/service/reassign/step4_controller.js   | 37 +++++++++++++++-----
 .../main/service/reassign/step6_controller.js   | 16 ++++++---
 .../main/service/reassign/step7_controller.js   |  8 ++++-
 .../main/service/reassign_controller.js         | 15 +++++++-
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/routes/reassign_master_routes.js | 13 ++-----
 .../service/reassign/step4_controller_test.js   | 27 ++++----------
 7 files changed, 72 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index f27b4f5..a20aa82 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -39,6 +39,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     'installHostComponents',
     'startZooKeeperServers',
     'startNameNode',
+    'stopHostComponentsInMaintenanceMode',
     'deleteHostComponents',
     'configureMySqlServer',
     'startMySqlServer',
@@ -57,6 +58,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     'cleanMySqlServer',
     'putHostComponentsInMaintenanceMode',
     'reconfigure',
+    'stopHostComponentsInMaintenanceMode',
     'deleteHostComponents',
     'configureMySqlServer',
     'startRequiredServices'
@@ -386,9 +388,9 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     if (this.get('content.hasManualSteps')) {
       if (componentName === 'NAMENODE' && App.get('isHaEnabled')) {
         // Only for reassign NameNode with HA enabled
-        this.removeTasks(['deleteHostComponents', 'startRequiredServices']);
+        this.removeTasks(['stopHostComponentsInMaintenanceMode', 'deleteHostComponents',
'startRequiredServices']);
       } else {
-        this.removeTasks(['startZooKeeperServers', 'startNameNode', 'deleteHostComponents',
'startRequiredServices']);
+        this.removeTasks(['startZooKeeperServers', 'startNameNode', 'stopHostComponentsInMaintenanceMode',
'deleteHostComponents', 'startRequiredServices']);
       }
     } else {
       this.removeTasks(['startZooKeeperServers', 'startNameNode']);
@@ -397,6 +399,10 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     if (this.get('componentsWithoutReconfiguration').contains(componentName)) {
       this.removeTasks(['reconfigure']);
     }
+
+    if (!this.get('content.reassignComponentsInMM.length')) {
+      this.removeTasks(['stopHostComponentsInMaintenanceMode']);
+    }
   },
 
   /**
@@ -460,8 +466,8 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   }.observes('tasks.@each.showRollback'),
 
   onComponentsTasksSuccess: function () {
-    this.incrementProperty('multiTaskCounter');
-    if (this.get('multiTaskCounter') >= this.get('hostComponents').length) {
+    this.decrementProperty('multiTaskCounter');
+    if (this.get('multiTaskCounter') <= 0) {
       this.onTaskCompleted();
     }
   },
@@ -474,9 +480,9 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   },
 
   createHostComponents: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.target');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       this.createComponent(hostComponents[i], hostName, this.get('content.reassign.service_id'));
     }
@@ -487,9 +493,9 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   },
 
   putHostComponentsInMaintenanceMode: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.source');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       App.ajax.send({
         name: 'common.host.host_component.passive',
@@ -506,9 +512,9 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   },
 
   installHostComponents: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.target');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       this.updateComponent(hostComponents[i], hostName, this.get('content.reassign.service_id'),
"Install", hostComponents.length);
     }
@@ -926,9 +932,9 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
    * make DELETE call for each host component on host
    */
   deleteHostComponents: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.source');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       App.ajax.send({
         name: 'common.delete.host_component',
@@ -1244,6 +1250,21 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
 
   saveServiceProperties: function(configs) {
     App.router.get(this.get('content.controllerName')).saveServiceProperties(configs);
+  },
+
+  stopHostComponentsInMaintenanceMode: function () {
+    var hostComponentsInMM = this.get('content.reassignComponentsInMM');
+    var hostName = this.get('content.reassignHosts.source');
+    var serviceName = this.get('content.reassign.service_id');
+    hostComponentsInMM = hostComponentsInMM.map(function(componentName){
+      return {
+        hostName: hostName,
+        serviceName: serviceName,
+        componentName: componentName
+      };
+    });
+    this.set('multiTaskCounter', hostComponentsInMM.length);
+    this.updateComponentsState(hostComponentsInMM, 'INSTALLED');
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/controllers/main/service/reassign/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step6_controller.js b/ambari-web/app/controllers/main/service/reassign/step6_controller.js
index 5eb8051..f718d46 100644
--- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step6_controller.js
@@ -22,7 +22,13 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
 
   name: "reassignMasterWizardStep6Controller",
 
-  commands: ['stopMysqlService', 'putHostComponentsInMaintenanceMode', 'stopHostComponentsInMaintenanceMode',
'deleteHostComponents', 'startAllServices'],
+  commands: [
+    'stopMysqlService',
+    'putHostComponentsInMaintenanceMode',
+    'stopHostComponentsInMaintenanceMode',
+    'deleteHostComponents',
+    'startAllServices'
+  ],
 
   clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
 
@@ -69,10 +75,12 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
   },
 
   removeUnneededTasks: function () {
-    if ( this.get('content.reassign.component_name') !== 'MYSQL_SERVER' ) {
+    if (this.get('content.reassign.component_name') !== 'MYSQL_SERVER') {
       this.removeTasks(['putHostComponentsInMaintenanceMode', 'stopMysqlService']);
-    }
-    if (!this.get('content.reassignComponentsInMM.length')) {
+      if (!this.get('content.reassignComponentsInMM.length')) {
+        this.removeTasks(['stopHostComponentsInMaintenanceMode']);
+      }
+    } else {
       this.removeTasks(['stopHostComponentsInMaintenanceMode']);
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/controllers/main/service/reassign/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step7_controller.js b/ambari-web/app/controllers/main/service/reassign/step7_controller.js
index 9451cd9..b36f17c 100644
--- a/ambari-web/app/controllers/main/service/reassign/step7_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step7_controller.js
@@ -20,7 +20,13 @@ var App = require('app');
 
 App.ReassignMasterWizardStep7Controller = App.ReassignMasterWizardStep4Controller.extend({
   name: 'reassignMasterWizardStep7Controller',
-  commands: ['putHostComponentsInMaintenanceMode', 'deleteHostComponents', 'cleanMySqlServer',
'configureMySqlServer', 'startServices'],
+  commands: [
+    'putHostComponentsInMaintenanceMode',
+    'deleteHostComponents',
+    'cleanMySqlServer',
+    'configureMySqlServer',
+    'startServices'
+  ],
   clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
   multiTaskCounter: 0,
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/controllers/main/service/reassign_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js
index 9dcf778..da4f65a 100644
--- a/ambari-web/app/controllers/main/service/reassign_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign_controller.js
@@ -264,7 +264,6 @@ App.ReassignMasterController = App.WizardController.extend({
     switch (step) {
       case '7':
       case '6':
-        this.loadReassignComponentsInMM();
       case '5':
         this.loadSecureConfigs();
         this.loadComponentDir();
@@ -272,6 +271,7 @@ App.ReassignMasterController = App.WizardController.extend({
         this.loadTasksStatuses();
         this.loadTasksRequestIds();
         this.loadRequestIds();
+        this.loadReassignComponentsInMM();
       case '3':
         this.loadReassignHosts();
       case '2':
@@ -305,6 +305,19 @@ App.ReassignMasterController = App.WizardController.extend({
     });
   },
 
+  getReassignComponentsInMM: function () {
+    var hostComponentsInMM = [];
+    var sourceHostComponents = App.HostComponent.find().filterProperty('hostName', this.get('content.reassignHosts.source'));
+    var reassignComponents = this.get('content.reassign.component_name') === 'NAMENODE' &&
App.get('isHaEnabled') ? ['NAMENODE', 'ZKFC'] : [this.get('content.reassign.component_name')];
+    reassignComponents.forEach(function(hostComponent){
+      var componentToReassign = sourceHostComponents.findProperty('componentName', hostComponent);
+      if (componentToReassign && !componentToReassign.get('isActive') &&
componentToReassign.get('workStatus') === 'STARTED') {
+        hostComponentsInMM.push(hostComponent);
+      }
+    });
+    return hostComponentsInMM;
+  },
+
   /**
    * Clear all temporary data
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5343bf1..15dbb7e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2050,6 +2050,7 @@ Em.I18n.translations = {
   'services.reassign.step4.tasks.installHostComponents.title':'Install {0}',
   'services.reassign.step4.tasks.startZooKeeperServers.title':'Start ZooKeeper Servers',
   'services.reassign.step4.tasks.startNameNode.title':'Start NameNode',
+  'services.reassign.step4.tasks.stopHostComponentsInMaintenanceMode.title':'Stop {0}',
   'services.reassign.step4.tasks.deleteHostComponents.title':'Delete disabled {0}',
   'services.reassign.step4.tasks.startRequiredServices.title':'Start Required Services',
   'services.reassign.step4.tasks.cleanMySqlServer.title':'Clean MYSQL Server',

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index 794573e..c8cff6b 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -190,6 +190,7 @@ module.exports = App.WizardRoute.extend({
     },
     back: Em.Router.transitionTo('step2'),
     next: function (router) {
+      var controller = router.get('reassignMasterController');
       App.db.setReassignTasksStatuses(undefined);
       App.db.setReassignTasksRequestIds(undefined);
       App.clusterStatus.setClusterStatus({
@@ -198,6 +199,7 @@ module.exports = App.WizardRoute.extend({
         wizardControllerName: 'reassignMasterController',
         localdb: App.db.data
       });
+      controller.saveReassignComponentsInMM(controller.getReassignComponentsInMM());
       router.transitionTo('step4');
     },
 
@@ -274,17 +276,8 @@ module.exports = App.WizardRoute.extend({
     },
     next: function (router) {
       App.showConfirmationPopup(function () {
-        var hostComponentsInMM = [];
         var controller = router.get('reassignMasterController');
-        var sourceHostComponents = App.HostComponent.find().filterProperty('hostName', controller.get('content.reassignHosts.source'));
-        var reassignComponents = controller.get('content.reassign.component_name') === 'NAMENODE'
&& App.get('isHaEnabled') ? ['NAMENODE', 'ZKFC'] : [controller.get('content.reassign.component_name')];
-        reassignComponents.forEach(function(hostComponent){
-          var componentToReassign = sourceHostComponents.findProperty('componentName', hostComponent);
-          if (componentToReassign && !componentToReassign.get('isActive') &&
componentToReassign.get('workStatus') === 'STARTED') {
-            hostComponentsInMM.push(hostComponent);
-          }
-        });
-        controller.saveReassignComponentsInMM(hostComponentsInMM);
+        controller.saveReassignComponentsInMM(controller.getReassignComponentsInMM());
         router.transitionTo('step6');
       }, Em.I18n.t('services.reassign.step5.confirmPopup.body'));
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/d41203d7/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index cccd7d1..460726b 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -390,24 +390,17 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       controller.onTaskCompleted.restore();
     });
 
-    it('No host-components', function () {
-      controller.set('multiTaskCounter', 0);
-      controller.set('hostComponents', []);
-      controller.onComponentsTasksSuccess();
-      expect(controller.get('multiTaskCounter')).to.equal(1);
-      expect(controller.onTaskCompleted.calledOnce).to.be.true;
-    });
     it('One host-component', function () {
-      controller.set('multiTaskCounter', 0);
+      controller.set('multiTaskCounter', 1);
       controller.set('hostComponents', [
         {}
       ]);
       controller.onComponentsTasksSuccess();
-      expect(controller.get('multiTaskCounter')).to.equal(1);
+      expect(controller.get('multiTaskCounter')).to.equal(0);
       expect(controller.onTaskCompleted.calledOnce).to.be.true;
     });
     it('two host-components', function () {
-      controller.set('multiTaskCounter', 0);
+      controller.set('multiTaskCounter', 2);
       controller.set('hostComponents', [
         {},
         {}
@@ -434,14 +427,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       controller.createComponent.restore();
     });
 
-    it('No host-components', function () {
-      controller.set('hostComponents', []);
-
-      controller.createHostComponents();
-
-      expect(controller.get('multiTaskCounter')).to.equal(0);
-      expect(controller.createComponent.called).to.be.false;
-    });
     it('One host-component', function () {
       controller.set('hostComponents', ['COMP1']);
       controller.set('content.reassignHosts.target', 'host1');
@@ -449,7 +434,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
 
       controller.createHostComponents();
 
-      expect(controller.get('multiTaskCounter')).to.equal(0);
+      expect(controller.get('multiTaskCounter')).to.equal(1);
       expect(controller.createComponent.calledWith('COMP1', 'host1', 'SERVICE1')).to.be.true;
     });
   });
@@ -490,7 +475,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       controller.putHostComponentsInMaintenanceMode();
       var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
       expect(args).exists;
-      expect(controller.get('multiTaskCounter')).to.equal(0);
+      expect(controller.get('multiTaskCounter')).to.equal(1);
     });
   });
 
@@ -517,7 +502,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
 
       controller.installHostComponents();
 
-      expect(controller.get('multiTaskCounter')).to.equal(0);
+      expect(controller.get('multiTaskCounter')).to.equal(1);
       expect(controller.updateComponent.calledWith('COMP1', 'host1', 'SERVICE1', 'Install',
1)).to.be.true;
     });
   });


Mime
View raw message