浏览代码

AMBARI-15256: User should be able to remove HAWQ Standby via UI (Alexander Denissov via mithmatt)

Matt 9 年之前
父节点
当前提交
f6ecddf69f
共有 28 个文件被更改,包括 937 次插入10 次删除
  1. 8 0
      ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
  2. 5 0
      ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
  3. 1 0
      ambari-web/app/assets/test/tests.js
  4. 4 0
      ambari-web/app/controllers.js
  5. 23 0
      ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step1_controller.js
  6. 46 0
      ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller.js
  7. 110 0
      ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step3_controller.js
  8. 128 0
      ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js
  9. 9 0
      ambari-web/app/controllers/main/admin/highAvailability_controller.js
  10. 5 0
      ambari-web/app/controllers/main/service/item.js
  11. 4 0
      ambari-web/app/data/controller_route.js
  12. 29 0
      ambari-web/app/messages.js
  13. 9 0
      ambari-web/app/models/host_component.js
  14. 2 0
      ambari-web/app/routes/main.js
  15. 190 0
      ambari-web/app/routes/remove_hawq_standby_routes.js
  16. 28 0
      ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step1.hbs
  17. 43 0
      ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step2.hbs
  18. 18 0
      ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step3.hbs
  19. 44 0
      ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/wizard.hbs
  20. 1 0
      ambari-web/app/utils/db.js
  21. 4 0
      ambari-web/app/views.js
  22. 26 0
      ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step1_view.js
  23. 26 0
      ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step2_view.js
  24. 36 0
      ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step3_view.js
  25. 74 0
      ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js
  26. 11 9
      ambari-web/app/views/main/host/details/host_component_view.js
  27. 1 1
      ambari-web/app/views/main/service/item.js
  28. 52 0
      ambari-web/test/controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller_test.js

+ 8 - 0
ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml

@@ -62,6 +62,14 @@
                 <timeout>1200</timeout>
               </commandScript>
             </customCommand>
+            <customCommand>
+              <name>REMOVE_HAWQ_STANDBY</name>
+              <commandScript>
+                <script>scripts/hawqmaster.py</script>
+                <scriptType>PYTHON</scriptType>
+                <timeout>1200</timeout>
+              </commandScript>
+            </customCommand>
           </customCommands>
           <dependencies>
             <dependency>

+ 5 - 0
ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py

@@ -28,6 +28,7 @@ except ImportError:
 import master_helper
 import common
 import hawq_constants
+import utils
 
 class HawqMaster(Script):
   """
@@ -73,5 +74,9 @@ class HawqMaster(Script):
             user=hawq_constants.hawq_user,
             timeout=hawq_constants.default_exec_timeout)
 
+  def remove_hawq_standby(self, env):
+    Logger.info("Removing HAWQ Standby Master ...")
+    utils.exec_hawq_operation(hawq_constants.INIT, "{0} -a -v -r".format(hawq_constants.STANDBY))
+
 if __name__ == "__main__":
   HawqMaster().execute()

+ 1 - 0
ambari-web/app/assets/test/tests.js

@@ -72,6 +72,7 @@ var files = [
   'test/controllers/main/admin/highAvailability/nameNode/step4_controller_test',
   'test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test',
   'test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test',
+  'test/controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller_test',
   'test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test',
   'test/controllers/main/dashboard/config_history_controller_test',
   'test/controllers/main/charts/heatmap_test',

+ 4 - 0
ambari-web/app/controllers.js

@@ -60,6 +60,10 @@ require('controllers/main/admin/highAvailability/hawq/addStandby/step1_controlle
 require('controllers/main/admin/highAvailability/hawq/addStandby/step2_controller');
 require('controllers/main/admin/highAvailability/hawq/addStandby/step3_controller');
 require('controllers/main/admin/highAvailability/hawq/addStandby/step4_controller');
+require('controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller');
+require('controllers/main/admin/highAvailability/hawq/removeStandby/step1_controller');
+require('controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller');
+require('controllers/main/admin/highAvailability/hawq/removeStandby/step3_controller');
 require('controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller');
 require('controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller');
 require('controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller');

+ 23 - 0
ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step1_controller.js

@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardStep1Controller = Em.Controller.extend({
+  name: "removeHawqStandbyWizardStep1Controller"
+});

+ 46 - 0
ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller.js

@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @typedef {object} hawqRemoveStandbyConfigDependencies
+ */
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardStep2Controller = Em.Controller.extend({
+  name: "removeHawqStandbyWizardStep2Controller",
+
+  selectedService: null,
+
+  versionLoaded: true,
+
+  hideDependenciesInfoBar: true,
+
+  isLoaded: true,
+
+  isSubmitDisabled: Em.computed.not('isLoaded'),
+
+  submit: function () {
+    if (!this.get('isSubmitDisabled')) {
+      App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
+        App.router.send("next");
+      });
+    }
+  }
+
+});

+ 110 - 0
ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/step3_controller.js

@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('controllers/main/admin/serviceAccounts_controller');
+
+App.RemoveHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
+
+  name: "removeHawqStandbyWizardStep3Controller",
+
+  clusterDeployState: 'REMOVE_HAWQ_STANDBY',
+
+  hawqRemoveStandbyCustomCommand: "REMOVE_HAWQ_STANDBY",
+
+  hawqServiceName: "HAWQ",
+
+  hawqMasterComponentName: "HAWQMASTER",
+
+  hawqStandbyComponentName: "HAWQSTANDBY",
+
+  commands: ['removeStandby', 'stopRequiredServices', 'reconfigureHAWQ', 'deleteHawqStandbyComponent', 'startRequiredServices'],
+
+  tasksMessagesPrefix: 'admin.removeHawqStandby.wizard.step',
+
+  removeStandby: function () {
+    App.ajax.send({
+      name : 'service.item.executeCustomCommand',
+      sender: this,
+      data : {
+        command : this.hawqRemoveStandbyCustomCommand,
+        context : Em.I18n.t('admin.removeHawqStandby.wizard.step3.removeHawqStandbyCommand.context'),
+        hosts : this.get('content.hawqHosts.hawqMaster'),
+        serviceName : this.hawqServiceName,
+        componentName : this.hawqMasterComponentName
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  stopRequiredServices: function () {
+    this.stopServices([this.hawqServiceName], true);
+  },
+
+  reconfigureHAWQ: function () {
+    App.ajax.send({
+      name: 'config.tags',
+      sender: this,
+      success: 'onLoadHawqConfigsTags',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadHawqConfigsTags: function (data) {
+    App.ajax.send({
+      name: 'reassign.load_configs',
+      sender: this,
+      data: {
+        urlParams: '(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')',
+        type: 'hawq-site'
+      },
+      success: 'onLoadConfigs',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadConfigs: function (data, opt, params) {
+    delete data.items[0].properties['hawq_standby_address_host'];
+
+    var configData = this.reconfigureSites([params.type], data, Em.I18n.t('admin.removeHawqStandby.wizard.step3.save.configuration.note').format(App.format.role('HAWQSTANDBY')));
+
+    App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      success: 'onSaveConfigs',
+      error: 'onTaskError'
+    });
+  },
+  onSaveConfigs: function () {
+    this.onTaskCompleted();
+  },
+
+  deleteHawqStandbyComponent: function () {
+    var hostName = this.get('content.hawqHosts.hawqStandby');
+    this.deleteComponent(this.hawqStandbyComponentName, hostName);
+  },
+
+  startRequiredServices: function () {
+    this.startServices(true, [this.hawqServiceName], true);
+  }
+
+});

+ 128 - 0
ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js

@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardController = App.WizardController.extend({
+
+  name: 'removeHawqStandbyWizardController',
+
+  totalSteps: 3,
+
+  /**
+   * @type {string}
+   */
+  displayName: Em.I18n.t('admin.removeHawqStandby.wizard.header'),
+
+  isFinished: false,
+
+  content: Em.Object.create({
+    controllerName: 'removeHawqStandbyWizardController'
+  }),
+
+  init: function () {
+    this._super();
+    this.clearStep();
+  },
+
+  clearStep: function () {
+    this.set('isFinished', false);
+  },
+
+  setCurrentStep: function (currentStep, completed) {
+    this._super(currentStep, completed);
+    App.clusterStatus.setClusterStatus({
+      clusterName: this.get('content.cluster.name'),
+      wizardControllerName: 'removeHawqStandbyWizardController',
+      localdb: App.db.data
+    });
+  },
+
+  /**
+   * Save hosts for Hawq Master and Hawq Standby to local db<code>controller.content</code>
+   * @param hawqHosts
+   */
+  saveHawqHosts: function (hawqHosts) {
+    this.set('content.hawqHosts', hawqHosts);
+    this.setDBProperty('hawqHosts', hawqHosts);
+  },
+
+  /**
+   * Load hosts for Hawq Master and Hawq Standby from local db to <code>controller.content</code>
+   */
+  loadHawqHosts: function() {
+    var hawqHosts = this.getDBProperty('hawqHosts');
+    this.set('content.hawqHosts', hawqHosts);
+  },
+
+  /**
+   * 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);
+  },
+
+  /**
+   * Load data for all steps until <code>current step</code>
+   */
+  loadAllPriorSteps: function () {
+    var step = this.get('currentStep');
+    switch (step) {
+      case '3':
+        this.loadTasksStatuses();
+        this.loadTasksRequestIds();
+        this.loadRequestIds();
+        this.loadConfigs();
+      case '2':
+        this.loadHawqHosts();
+        this.loadServicesFromServer();
+        this.loadMasterComponentHosts();
+      case '1':
+        this.load('cluster');
+    }
+  },
+
+  /**
+   * Remove all loaded data.
+   */
+  clearAllSteps: function () {
+    this.clearInstallOptions();
+    // clear temporary information stored during the install
+    this.set('content.cluster', this.getCluster());
+  },
+
+  /**
+   * Clear all temporary data
+   */
+  finish: function () {
+    this.resetDbNamespace();
+    App.router.get('updateController').updateAll();
+    this.set('isFinished', true);
+  }
+});

+ 9 - 0
ambari-web/app/controllers/main/admin/highAvailability_controller.js

@@ -89,6 +89,15 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
     return true;
   },
 
+  /**
+   * remove Hawq Standby
+   * @return {Boolean}
+   */
+  removeHawqStandby: function () {
+    App.router.transitionTo('main.services.removeHawqStandby');
+    return true;
+  },
+
   /**
    * activate Hawq Standby
    * @return {Boolean}

+ 5 - 0
ambari-web/app/controllers/main/service/item.js

@@ -882,6 +882,11 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     highAvailabilityController.addHawqStandby();
   },
 
+  removeHawqStandby: function() {
+    var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
+    highAvailabilityController.removeHawqStandby();
+  },
+
   activateHawqStandby: function() {
     var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
     highAvailabilityController.activateHawqStandby();

+ 4 - 0
ambari-web/app/data/controller_route.js

@@ -53,6 +53,10 @@ module.exports = [
     wizardControllerName: App.router.get('addHawqStandbyWizardController.name'),
     route: 'main.services.addHawqStandby'
   },
+  {
+    wizardControllerName: App.router.get('removeHawqStandbyWizardController.name'),
+    route: 'main.services.removeHawqStandby'
+  },
   {
     wizardControllerName: App.router.get('activateHawqStandbyWizardController.name'),
     route: 'main.services.activateHawqStandby'

+ 29 - 0
ambari-web/app/messages.js

@@ -2924,6 +2924,35 @@ Em.I18n.translations = {
   'admin.addHawqStandby.wizard.step4.task3.title': 'Start HAWQ Service',
   'admin.addHawqStandby.wizard.step4.notice.inProgress':'Please wait while HAWQ Standby Master is being deployed.',
   'admin.addHawqStandby.wizard.step4.notice.completed':'HAWQ Standby Master has been added successfully.',
+  'admin.removeHawqStandby.button.enable': 'Remove HAWQ Standby',
+  'admin.removeHawqStandby.wizard.header': 'Remove HAWQ Standby Wizard',
+  'admin.removeHawqStandby.wizard.step1.header': 'Get Started',
+  'admin.removeHawqStandby.wizard.step1.body':'This wizard walks you through the process of removing the HAWQ Standby Master ' +
+      'in the event of HAWQ Standby Master host failure or maintenance. After you remove the HAWQ Standby Master, the existing HAWQ Master will run in standalone mode without a backup.' +
+      '<br/><br/><b>This procedure stops and restarts the HAWQ service. Perform this procedure during a scheduled cluster ' +
+      'maintenance window, only when HAWQ Master is functioning properly.</b>' +
+      '<br/><br/>After you complete this wizard, the HAWQ cluster will no longer have a Standby Master. ' +
+      'As a best practice, use the “Add HAWQ Standby Master” service action to configure a new HAWQ Standby Master for the cluster.',
+  'admin.removeHawqStandby.wizard.step2.header': 'Review',
+  'admin.removeHawqStandby.wizard.step2.hawqStandby': '<b>Current HAWQ Standby:</b>',
+  'admin.removeHawqStandby.wizard.step2.confirm.config.body':'<div class="alert alert-info">' +
+      '<b>Review Configuration Changes.</b></br></br>After removing the HAWQ Standby Master, the Wizard removes the ' +
+      'hawq_standby_address_host property from hawq-site.xml. As a best practice, you should configure a new HAWQ Standby Master host after the Wizard completes.</div>',
+  'admin.removeHawqStandby.wizard.step2.confirm.host.body':'<b>Review HAWQ Standby Master role changes.</b>',
+  'admin.removeHawqStandby.wizard.step2.confirmPopup.body': 'Do you wish to continue with removing HAWQ Standby Master? Please confirm, before proceeding as you will not be able to rollback from Ambari.',
+  'admin.removeHawqStandby.wizard.step3.header': 'Finalize Setup',
+  'admin.removeHawqStandby.wizard.step3.task0.title': 'Remove HAWQ Standby',
+  'admin.removeHawqStandby.wizard.step3.task1.title': 'Stop HAWQ Service',
+  'admin.removeHawqStandby.wizard.step3.task2.title': 'Reconfigure HAWQ',
+  'admin.removeHawqStandby.wizard.step3.task3.title': 'Delete Role: HAWQ Standby',
+  'admin.removeHawqStandby.wizard.step3.task4.title': 'Start HAWQ Service',
+  'admin.removeHawqStandby.closePopup':'Remove HAWQ Standby Wizard is in progress. You must allow the wizard to' +
+      ' complete for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to' +
+      ' get back to a stable state. Are you sure you want to exit the wizard?',
+  'admin.removeHawqStandby.wizard.step3.notice.inProgress':'Please wait while HAWQ Standby is being removed',
+  'admin.removeHawqStandby.wizard.step3.notice.completed':'HAWQ Standby has been removed successfully.',
+  'admin.removeHawqStandby.wizard.step3.removeHawqStandbyCommand.context': 'Execute HAWQ Standby remove command',
+  'admin.removeHawqStandby.wizard.step3.save.configuration.note': 'This configuration was created by Remove HAWQ Standby wizard',
   'admin.activateHawqStandby.button.enable': 'Activate HAWQ Standby',
   'admin.activateHawqStandby.wizard.header': 'Activate HAWQ Standby Wizard',
   'admin.activateHawqStandby.wizard.step1.header': 'Get Started',

+ 9 - 0
ambari-web/app/models/host_component.js

@@ -418,6 +418,15 @@ App.HostComponentActionMap = {
         isHidden: App.get('isSingleNode') || HS,
         disabled: false
       },
+      REMOVE_HAWQ_STANDBY: {
+        action: 'removeHawqStandby',
+        context: Em.I18n.t('admin.removeHawqStandby.button.enable'),
+        label: Em.I18n.t('admin.removeHawqStandby.button.enable'),
+        cssClass: 'icon-minus',
+        isHidden: App.get('isSingleNode') || !HS,
+        disabled: !HM || HM.get('workStatus') != App.HostComponentStatus.started,
+        hideFromComponentView: true
+      },
       ACTIVATE_HAWQ_STANDBY: {
         action: 'activateHawqStandby',
         label: Em.I18n.t('admin.activateHawqStandby.button.enable'),

+ 2 - 0
ambari-web/app/routes/main.js

@@ -741,6 +741,8 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
 
     addHawqStandby: require('routes/add_hawq_standby_routes'),
 
+    removeHawqStandby: require('routes/remove_hawq_standby_routes'),
+
     activateHawqStandby: require('routes/activate_hawq_standby_routes'),
 
     rollbackHighAvailability: require('routes/rollbackHA_routes')

+ 190 - 0
ambari-web/app/routes/remove_hawq_standby_routes.js

@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+module.exports = App.WizardRoute.extend({
+  route: '/highAvailability/Hawq/remove',
+
+  enter: function (router, transition) {
+    var removeHawqStandbyWizardController = router.get('removeHawqStandbyWizardController');
+    removeHawqStandbyWizardController.dataLoading().done(function () {
+      App.router.set('mainServiceItemController.content', App.Service.find().findProperty('serviceName', 'HAWQ'));
+    });
+    Em.run.next(function() {
+      App.router.get('updateController').set('isWorking', false);
+      var popup = App.ModalPopup.show({
+        classNames: ['full-width-modal'],
+        header: Em.I18n.t('admin.removeHawqStandby.wizard.header'),
+        bodyClass: App.RemoveHawqStandbyWizardView.extend({
+          controller: removeHawqStandbyWizardController
+        }),
+        primary: Em.I18n.t('form.cancel'),
+        showFooter: false,
+        secondary: null,
+
+        onClose: function () {
+          var removeHawqStandbyWizardController = router.get('removeHawqStandbyWizardController'),
+              currStep = removeHawqStandbyWizardController.get('currentStep')
+          if (parseInt(currStep) === 3) {
+            App.showConfirmationPopup(function () {
+              var controller = router.get('removeHawqStandbyWizardController');
+              router.get('updateController').set('isWorking', true);
+              removeHawqStandbyWizardController.finish();
+              App.clusterStatus.setClusterStatus({
+                clusterName: App.router.getClusterName(),
+                clusterState: 'DEFAULT',
+                localdb: App.db.data
+              }, {
+                alwaysCallback: function () {
+                  controller.get('popup').hide();
+                  router.transitionTo('main.services.index');
+                  Em.run.next(function() {
+                    location.reload();
+                  });
+                }
+              });
+            }, Em.I18n.t('admin.removeHawqStandby.closePopup'));
+          } else {
+            var controller = router.get('removeHawqStandbyWizardController');
+            router.get('updateController').set('isWorking', true);
+            removeHawqStandbyWizardController.finish();
+            App.clusterStatus.setClusterStatus({
+              clusterName: App.router.getClusterName(),
+              clusterState: 'DEFAULT',
+              localdb: App.db.data
+            }, {
+              alwaysCallback: function () {
+                controller.get('popup').hide();
+                router.transitionTo('main.services.index');
+                Em.run.next(function() {
+                  location.reload();
+                });
+              }
+            });
+          }
+        },
+        didInsertElement: function () {
+          this.fitHeight();
+        }
+      });
+      removeHawqStandbyWizardController.set('popup', popup);
+      var currentClusterStatus = App.clusterStatus.get('value');
+      if (currentClusterStatus) {
+        switch (currentClusterStatus.clusterState) {
+          case 'REMOVE_HAWQ_STANDBY' :
+            removeHawqStandbyWizardController.setCurrentStep(currentClusterStatus.localdb.RemoveHawqStandbyWizard.currentStep);
+            break;
+          default:
+            var currStep = App.router.get('removeHawqStandbyWizardController.currentStep');
+            removeHawqStandbyWizardController.setCurrentStep(currStep);
+            break;
+        }
+      }
+      router.transitionTo('step' + removeHawqStandbyWizardController.get('currentStep'));
+    });
+  },
+
+  step1: Em.Route.extend({
+    route: '/step1',
+    connectOutlets: function (router) {
+      var controller = router.get('removeHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('1');
+        controller.connectOutlet('removeHawqStandbyWizardStep1', controller.get('content'));
+      })
+    },
+    unroutePath: function () {
+      return false;
+    },
+    next: function (router) {
+      var controller = router.get('removeHawqStandbyWizardController');
+      var hawqMaster = App.HostComponent.find().findProperty('componentName','HAWQMASTER').get('hostName');
+      var hawqStandby = App.HostComponent.find().findProperty('componentName','HAWQSTANDBY').get('hostName');
+      var hawqHosts = {
+        hawqMaster: hawqMaster,
+        hawqStandby: hawqStandby
+      };
+      controller.saveHawqHosts(hawqHosts);
+      router.transitionTo('step2');
+    }
+  }),
+
+  step2: Em.Route.extend({
+    route: '/step2',
+    connectOutlets: function (router) {
+      var controller = router.get('removeHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('2');
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('removeHawqStandbyWizardStep2', controller.get('content'));
+      })
+    },
+    unroutePath: function () {
+      return false;
+    },
+    next: function (router) {
+      App.showConfirmationPopup(function() {
+        var wizardController = router.get('removeHawqStandbyWizardController');
+        var stepController = router.get('removeHawqStandbyWizardStep2Controller');
+        var configs = stepController.get('selectedService.configs');
+        wizardController.saveConfigs(configs);
+        router.transitionTo('step3');
+      }, Em.I18n.t('admin.removeHawqStandby.wizard.step2.confirmPopup.body'));
+    },
+    back: Em.Router.transitionTo('step1')
+  }),
+  step3: Em.Route.extend({
+    route: '/step3',
+    connectOutlets: function (router) {
+      var controller = router.get('removeHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('3');
+        controller.setLowerStepsDisable(3);
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('removeHawqStandbyWizardStep3', controller.get('content'));
+      })
+    },
+    unroutePath: function (router, path) {
+      // allow user to leave route if wizard has finished
+      if (router.get('removeHawqStandbyWizardController').get('isFinished')) {
+        this._super(router, path);
+      } else {
+        return false;
+      }
+    },
+    next: function (router) {
+      var controller = router.get('removeHawqStandbyWizardController');
+      controller.finish();
+      App.clusterStatus.setClusterStatus({
+        clusterName: controller.get('content.cluster.name'),
+        clusterState: 'DEFAULT',
+        localdb: App.db.data
+      }, {
+        alwaysCallback: function () {
+          controller.get('popup').hide();
+          router.transitionTo('main.services.index');
+          Em.run.next(function () {
+            location.reload();
+          });
+        }
+      });
+    }
+  })
+
+});

+ 28 - 0
ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step1.hbs

@@ -0,0 +1,28 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+<div>
+  <h2>{{t admin.removeHawqStandby.wizard.step1.header}}</h2>
+
+  <div class="alert alert-info">
+    {{t admin.removeHawqStandby.wizard.step1.body}}
+  </div>
+
+  <div class="btn-area">
+    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
+  </div>
+</div>

+ 43 - 0
ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step2.hbs

@@ -0,0 +1,43 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+<h2>{{t admin.removeHawqStandby.wizard.step2.header}}</h2>
+
+<div class="alert alert-info">
+  {{t admin.removeHawqStandby.wizard.step2.confirm.host.body}}
+</div>
+
+<div id="remove-standby-step2-content" class="well pre-scrollable">
+    <div id="remove-standby-step2-info">
+        <table id="ha-step3-review-table">
+            <tr>
+                <td>{{t admin.removeHawqStandby.wizard.step2.hawqStandby}}</td>
+                <td>{{controller.content.hawqHosts.hawqStandby}}</td>
+		        <td><span class="to-be-disabled-red"><i class="icon-minus"></i>&nbsp;{{t admin.highAvailability.wizard.step3.toBeDeleted}}</span></td>
+            </tr>
+        </table>
+    </div>
+</div>
+
+<div id="serviceConfig">
+  {{{t admin.removeHawqStandby.wizard.step2.confirm.config.body}}}
+</div>
+
+<div class="btn-area">
+    <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
+    <a class="btn btn-success pull-right" {{action submit target="controller"}} {{bindAttr disabled="controller.isSubmitDisabled"}}>{{t common.next}} &rarr;</a>
+</div>

+ 18 - 0
ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/step3.hbs

@@ -0,0 +1,18 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+{{{template "templates/common/progress"}}}

+ 44 - 0
ambari-web/app/templates/main/admin/highAvailability/hawq/removeStandby/wizard.hbs

@@ -0,0 +1,44 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<div id="hawq-ha-wizard" class="wizard">
+  <div class="container">
+    <div class="container-fluid">
+      <div class="row-fluid">
+        <div class="span3">
+          <!--Sidebar content-->
+          <div class="well">
+            <ul class="nav nav-pills nav-stacked">
+              <li class="nav-header">{{t admin.removeHawqStandby.wizard.header}}</li>
+              <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep1 target="controller"}}>{{t admin.removeHawqStandby.wizard.step1.header}}</a></li>
+              <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep2 target="controller"}}>{{t admin.removeHawqStandby.wizard.step2.header}}</a></li>
+              <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep3 target="controller"}}>{{t admin.removeHawqStandby.wizard.step3.header}}</a></li>
+            </ul>
+          </div>
+        </div>
+          <div class="wizard-content well span9">
+            {{#if view.isLoaded}}
+              {{outlet}}
+            {{else}}
+                {{view App.SpinnerView}}
+            {{/if}}
+          </div>
+      </div>
+    </div>
+  </div>
+</div>

+ 1 - 0
ambari-web/app/utils/db.js

@@ -44,6 +44,7 @@ var InitialData = {
   'HighAvailabilityWizard': {},
   'RMHighAvailabilityWizard': {},
   'AddHawqStandbyWizard': {},
+  'RemoveHawqStandbyWizard': {},
   'ActivateHawqStandbyWizard': {},
   'RAHighAvailabilityWizard': {},
   'RollbackHighAvailabilityWizard': {},

+ 4 - 0
ambari-web/app/views.js

@@ -170,6 +170,10 @@ require('views/main/admin/highAvailability/hawq/addStandby/step1_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step2_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step3_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step4_view');
+require('views/main/admin/highAvailability/hawq/removeStandby/wizard_view');
+require('views/main/admin/highAvailability/hawq/removeStandby/step1_view');
+require('views/main/admin/highAvailability/hawq/removeStandby/step2_view');
+require('views/main/admin/highAvailability/hawq/removeStandby/step3_view');
 require('views/main/admin/highAvailability/hawq/activateStandby/wizard_view');
 require('views/main/admin/highAvailability/hawq/activateStandby/step1_view');
 require('views/main/admin/highAvailability/hawq/activateStandby/step2_view');

+ 26 - 0
ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step1_view.js

@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardStep1View = Em.View.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/step1')
+
+});

+ 26 - 0
ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step2_view.js

@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardStep2View = Em.View.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/step2')
+
+});

+ 36 - 0
ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/step3_view.js

@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardStep3View = App.HighAvailabilityProgressPageView.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/step3'),
+
+  headerTitle: Em.I18n.t('admin.removeHawqStandby.wizard.step3.header'),
+
+  noticeInProgress: Em.I18n.t('admin.removeHawqStandby.wizard.step3.notice.inProgress'),
+
+  noticeCompleted: Em.I18n.t('admin.removeHawqStandby.wizard.step3.notice.completed'),
+
+  submitButtonText: Em.I18n.t('common.complete'),
+
+  labelWidth: 'span5'
+
+});

+ 74 - 0
ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js

@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.RemoveHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
+
+  didInsertElement: function() {
+    var currentStep = this.get('controller.currentStep');
+    if (currentStep > 3) {
+      this.get('controller').setLowerStepsDisable(currentStep);
+    }
+  },
+
+  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/wizard'),
+
+  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);
+  }
+});

+ 11 - 9
ambari-web/app/views/main/host/details/host_component_view.js

@@ -312,15 +312,17 @@ App.HostComponentView = Em.View.extend({
       }
 
       var commandMap = App.HostComponentActionMap.getMap(self)[command];
-      customCommands.push({
-        label: self.getCustomCommandLabel(command),
-        service: component.get('serviceName'),
-        hosts: hostComponent.get('hostName'),
-        context: (!!commandMap && !!commandMap.context) ? commandMap.context : null,
-        component: component.get('componentName'),
-        command: command,
-        disabled: !!commandMap ? !!commandMap.disabled : false
-      });
+      if (!commandMap.hideFromComponentView) {
+        customCommands.push({
+          label: self.getCustomCommandLabel(command),
+          service: component.get('serviceName'),
+          hosts: hostComponent.get('hostName'),
+          context: (!!commandMap && !!commandMap.context) ? commandMap.context : null,
+          component: component.get('componentName'),
+          command: command,
+          disabled: !!commandMap ? !!commandMap.disabled : false
+        });
+      }
     });
 
     return customCommands;

+ 1 - 1
ambari-web/app/views/main/service/item.js

@@ -35,7 +35,7 @@ App.MainServiceItemView = Em.View.extend({
     'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'],
     'HBASE_MASTER': ['DECOMMISSION'],
     'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
-    'HAWQMASTER': ['IMMEDIATE_STOP_HAWQ_SERVICE', 'RUN_HAWQ_CHECK', 'HAWQ_CLEAR_CACHE'],
+    'HAWQMASTER': ['IMMEDIATE_STOP_HAWQ_SERVICE', 'RUN_HAWQ_CHECK', 'HAWQ_CLEAR_CACHE', 'REMOVE_HAWQ_STANDBY'],
     'HAWQSEGMENT': ['IMMEDIATE_STOP_HAWQ_SEGMENT'],
     'HAWQSTANDBY' : ['RESYNC_HAWQ_STANDBY','ACTIVATE_HAWQ_STANDBY']
   },

+ 52 - 0
ambari-web/test/controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller_test.js

@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('controllers/main/admin/highAvailability/hawq/removeStandby/step2_controller');
+
+describe('App.RemoveHawqStandbyWizardStep2Controller', function () {
+
+  describe('#isSubmitDisabled', function () {
+
+    var controller = App.RemoveHawqStandbyWizardStep2Controller.create({
+        content: Em.Object.create({})
+      }),
+      cases = [
+        {
+          isLoaded: false,
+          isSubmitDisabled: true,
+          title: 'wizard step content not loaded'
+        },
+        {
+          isLoaded: true,
+          isSubmitDisabled: false,
+          title: 'wizard step content loaded'
+        }
+      ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        controller.set('isLoaded', item.isLoaded);
+        expect(controller.get('isSubmitDisabled')).to.equal(item.isSubmitDisabled);
+      });
+    });
+
+  });
+
+
+});