You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/05 22:56:19 UTC
[04/40] ambari git commit: AMBARI-14820: Implement Activate HAWQ
Standby wizard to allow doing failover in HA mode (bhuvnesh2703 via jaoki)
AMBARI-14820: Implement Activate HAWQ Standby wizard to allow doing failover in HA mode (bhuvnesh2703 via jaoki)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/65558a5a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/65558a5a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/65558a5a
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 65558a5a660062ebb1c9380e4a7101ce45ad4fe2
Parents: ad67efd
Author: Jun Aoki <ja...@apache.org>
Authored: Wed Feb 3 15:27:26 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Wed Feb 3 15:27:26 2016 -0800
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
ambari-web/app/controllers.js | 4 +
.../hawq/activateStandby/step1_controller.js | 23 +++
.../hawq/activateStandby/step2_controller.js | 105 +++++++++++
.../hawq/activateStandby/step3_controller.js | 126 +++++++++++++
.../hawq/activateStandby/wizard_controller.js | 128 +++++++++++++
.../main/admin/highAvailability_controller.js | 9 +
ambari-web/app/controllers/main/service/item.js | 5 +
.../HDP2.3/hawq_activate_standby_properties.js | 43 +++++
ambari-web/app/data/controller_route.js | 4 +
ambari-web/app/messages.js | 37 +++-
.../wizard/wizardProgressPageController.js | 30 ++++
ambari-web/app/models/host_component.js | 9 +-
.../app/routes/activate_hawq_standby_routes.js | 179 +++++++++++++++++++
ambari-web/app/routes/main.js | 2 +
.../hawq/activateStandby/step1.hbs | 28 +++
.../hawq/activateStandby/step2.hbs | 53 ++++++
.../hawq/activateStandby/step3.hbs | 18 ++
.../hawq/activateStandby/wizard.hbs | 44 +++++
.../hawq_activate_standby_config_initializer.js | 53 ++++++
.../utils/configs/hawq_ha_config_initializer.js | 2 +-
ambari-web/app/utils/db.js | 1 +
ambari-web/app/views.js | 4 +
.../hawq/activateStandby/step1_view.js | 26 +++
.../hawq/activateStandby/step2_view.js | 29 +++
.../hawq/activateStandby/step3_view.js | 36 ++++
.../hawq/activateStandby/wizard_view.js | 74 ++++++++
ambari-web/app/views/main/service/item.js | 2 +
.../activateStandby/step2_controller_test.js | 88 +++++++++
29 files changed, 1160 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 215a754..85c814d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -71,6 +71,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/activateStandby/step2_controller_test',
'test/controllers/main/dashboard/config_history_controller_test',
'test/controllers/main/charts/heatmap_test',
'test/controllers/main/charts/heatmap_metrics/heatmap_metric_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index eed54dc..8fa9e6b 100644
--- a/ambari-web/app/controllers.js
+++ b/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/activateStandby/wizard_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller');
require('controllers/main/admin/highAvailability/rangerAdmin/wizard_controller');
require('controllers/main/admin/highAvailability/rangerAdmin/step1_controller');
require('controllers/main/admin/highAvailability/rangerAdmin/step2_controller');
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js
new file mode 100644
index 0000000..5652a2f
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/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.ActivateHawqStandbyWizardStep1Controller = Em.Controller.extend({
+ name: "activateHawqStandbyWizardStep1Controller"
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
new file mode 100644
index 0000000..a14817a
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
@@ -0,0 +1,105 @@
+/**
+ * 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} hawqActivateStandbyConfigDependencies
+ */
+
+var App = require('app');
+require('utils/configs/hawq_activate_standby_config_initializer');
+
+App.ActivateHawqStandbyWizardStep2Controller = Em.Controller.extend({
+ name: "activateHawqStandbyWizardStep2Controller",
+
+ selectedService: null,
+
+ versionLoaded: true,
+
+ hideDependenciesInfoBar: true,
+
+ isLoaded: false,
+
+ isSubmitDisabled: Em.computed.not('isLoaded'),
+
+ loadStep: function () {
+ this.renderConfigs();
+ },
+
+ /**
+ * Render configs to show them in <code>App.ServiceConfigView</code>
+ */
+ renderConfigs: function () {
+ newHawqMaster = App.HostComponent.find().findProperty('componentName','HAWQSTANDBY').get('hostName');
+
+ var configs = require('data/HDP2.3/hawq_activate_standby_properties').haConfig;
+
+ var serviceConfig = App.ServiceConfig.create({
+ serviceName: configs.serviceName,
+ displayName: configs.displayName,
+ configCategories: [],
+ showConfig: true,
+ configs: []
+ });
+
+ configs.configCategories.forEach(function (configCategory) {
+ if (App.Service.find().someProperty('serviceName', configCategory.name)) {
+ serviceConfig.configCategories.pushObject(configCategory);
+ }
+ }, this);
+
+ this.renderConfigProperties(configs, serviceConfig);
+ this.setDynamicConfigValues(serviceConfig);
+ this.setProperties({
+ selectedService: serviceConfig,
+ isLoaded: true
+ });
+ },
+
+
+ setDynamicConfigValues: function (configs) {
+ var topologyLocalDB = this.get('content').getProperties(['masterComponentHosts']);
+ configs.configs.forEach(function (config) {
+ App.HawqActivateStandbyConfigInitializer.initialValue(config, topologyLocalDB);
+ });
+ App.HawqActivateStandbyConfigInitializer.cleanup();
+ return configs;
+ },
+
+ /**
+ * Load child components to service config object
+ * @param _componentConfig
+ * @param componentConfig
+ */
+ renderConfigProperties: function (_componentConfig, componentConfig) {
+ _componentConfig.configs.forEach(function (_serviceConfigProperty) {
+ var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+ componentConfig.configs.pushObject(serviceConfigProperty);
+ serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
+ serviceConfigProperty.validate();
+ }, this);
+ },
+
+ submit: function () {
+ if (!this.get('isSubmitDisabled')) {
+ App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
+ App.router.send("next");
+ });
+ }
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
new file mode 100644
index 0000000..55da44e
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
@@ -0,0 +1,126 @@
+/**
+ * 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.ActivateHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
+
+ name: "activateHawqStandbyWizardStep3Controller",
+
+ clusterDeployState: 'ACTIVATE_HAWQ_STANDBY',
+
+ hawqActivateStandbyCustomCommand: "ACTIVATE_STANDBY",
+
+ hawqServiceName: "HAWQ",
+
+ hawqStandbyComponentName: "HAWQSTANDBY",
+
+ hawqMasterComponentName: "HAWQMASTER",
+
+ commands: ['activateStandby', 'stopRequiredServices', 'reconfigureHAWQ', 'installHawqMaster', 'deleteOldHawqMaster',
+ 'deleteHawqStandby', 'startRequiredServices'],
+
+ tasksMessagesPrefix: 'admin.activateHawqStandby.wizard.step',
+
+ activateStandby: function () {
+ App.ajax.send({
+ name : 'service.item.executeCustomCommand',
+ sender: this,
+ data : {
+ command : this.hawqActivateStandbyCustomCommand,
+ context : Em.I18n.t('admin.activateHawqStandby.wizard.step3.activateHawqStandbyCommand.context'),
+ hosts : this.get('content.hawqHosts.hawqStandby'),
+ serviceName : this.hawqServiceName,
+ componentName : this.hawqStandbyComponentName
+ },
+ 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 propertiesToAdd = this.get('content.configs').filterProperty('filename', params.type);
+ propertiesToAdd.forEach(function (property) {
+ data.items[0].properties[property.name] = property.value;
+ });
+
+ var configData = this.reconfigureSites([params.type], data, Em.I18n.t('admin.addHawqStandby.step4.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();
+ },
+
+ installHawqMaster: function () {
+ var hostName = this.get('content.hawqHosts.hawqStandby');
+ this.createComponent(this.hawqMasterComponentName, hostName, this.hawqServiceName);
+ },
+
+ deleteOldHawqMaster: function () {
+ var hostName = this.get('content.hawqHosts.hawqMaster');
+ this.deleteComponent(this.hawqMasterComponentName, hostName);
+ },
+
+ deleteHawqStandby: function () {
+ var hostName = this.get('content.hawqHosts.hawqStandby');
+ this.deleteComponent(this.hawqStandbyComponentName, hostName);
+ },
+
+ startRequiredServices: function () {
+ this.startServices(true, [this.hawqServiceName], true);
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js
new file mode 100644
index 0000000..aa50b76
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/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.ActivateHawqStandbyWizardController = App.WizardController.extend({
+
+ name: 'activateHawqStandbyWizardController',
+
+ totalSteps: 3,
+
+ /**
+ * @type {string}
+ */
+ displayName: Em.I18n.t('admin.activateHawqStandby.wizard.header'),
+
+ isFinished: false,
+
+ content: Em.Object.create({
+ controllerName: 'activateHawqStandbyWizardController'
+ }),
+
+ 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: this.name,
+ localdb: App.db.data
+ });
+ },
+
+ /**
+ * Save hosts for Hawq Master and Hawq Standby<code>controller.content</code>
+ * @param hawqHosts
+ */
+ saveHawqHosts: function (hawqHosts) {
+ this.set('content.hawqHosts', hawqHosts);
+ this.setDBProperty('hawqHosts', hawqHosts);
+ },
+
+ /**
+ * Load hosts for additional and current ResourceManagers 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);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability_controller.js b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
index 29ce167..710e4d0 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
@@ -87,6 +87,15 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
},
/**
+ * activate Hawq Standby
+ * @return {Boolean}
+ */
+ activateHawqStandby: function () {
+ App.router.transitionTo('main.services.activateHawqStandby');
+ return true;
+ },
+
+ /**
* enable Ranger Admin High Availability
* @return {Boolean}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 4678c64..a26c820 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -905,6 +905,11 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
highAvailabilityController.addHawqStandby();
},
+ activateHawqStandby: function() {
+ var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
+ highAvailabilityController.activateHawqStandby();
+ },
+
enableRAHighAvailability: function() {
var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
highAvailabilityController.enableRAHighAvailability();
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js b/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
new file mode 100644
index 0000000..a06009f
--- /dev/null
+++ b/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
@@ -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.
+ */
+
+module.exports =
+{
+ "haConfig": {
+ serviceName: 'MISC',
+ displayName: 'MISC',
+ configCategories: [
+ App.ServiceConfigCategory.create({name: 'HAWQ', displayName: 'HAWQ'}),
+ ],
+ sites: ['hawq-site'],
+ configs: [
+ /**********************************************HAWQ***************************************/
+ {
+ "name": "hawq_master_address_host",
+ "displayName": "HAWQ Master Host",
+ "isReconfigurable": false,
+ "recommendedValue": "",
+ "isOverridable": false,
+ "value": "",
+ "category": "HAWQ",
+ "filename": "hawq-site",
+ serviceName: 'MISC'
+ }
+ ]
+ }
+};
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/data/controller_route.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/controller_route.js b/ambari-web/app/data/controller_route.js
index 15e89a6..d254edb 100644
--- a/ambari-web/app/data/controller_route.js
+++ b/ambari-web/app/data/controller_route.js
@@ -54,6 +54,10 @@ module.exports = [
route: 'main.services.addHawqStandby'
},
{
+ wizardControllerName: App.router.get('activateHawqStandbyWizardController.name'),
+ route: 'main.services.activateHawqStandby'
+ },
+ {
wizardControllerName: App.router.get('rAHighAvailabilityWizardController.name'),
route: 'main.services.enableRAHighAvailability'
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8861b2a..a5421ea 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2902,5 +2902,40 @@ Em.I18n.translations = {
'admin.addHawqStandby.wizard.step4.task2.title': 'Reconfigure HAWQ',
'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 enabled successfully.'
+ 'admin.addHawqStandby.wizard.step4.notice.completed':'HAWQ Standby Master has been added successfully.',
+ 'admin.activateHawqStandby.button.enable': 'Activate HAWQ Standby',
+ 'admin.activateHawqStandby.wizard.header': 'Activate HAWQ Standby Wizard',
+ 'admin.activateHawqStandby.wizard.step1.header': 'Get Started',
+ 'admin.activateHawqStandby.wizard.step1.body':'This wizard will walk you through activating HAWQ Standby.' +
+ '<br/>Once activated, HAWQ Standby will become HAWQ Master, and the previous HAWQ master will be removed. ' +
+ 'Users will be able to connect to HAWQ database using the new HAWQ Master.' +
+ '<br/><br/><b>You should plan a cluster maintenance window and prepare for cluster downtime when ' +
+ 'activating HAWQ Standby. During this operation, HAWQ service will be stopped and started.</b>' +
+ '<br/><br/>Note: In order to add standby for HAWQ service, you can use the "Add HAWQ Standby"</b> wizard.',
+ 'admin.activateHawqStandby.wizard.step2.header': 'Review',
+ 'admin.highAvailability.wizard.step2.toBeDeleted': 'TO BE DELETED',
+ 'admin.activateHawqStandby.wizard.step2.hawqMaster': '<b>Current HAWQ Master:</b>',
+ 'admin.activateHawqStandby.wizard.step2.hawqStandby': '<b>New HAWQ Master:</b>',
+ 'admin.activateHawqStandby.wizard.step2.toBeActivated': 'STANDBY TO BE ACTIVATED',
+ 'admin.activateHawqStandby.wizard.step2.confirm.config.body':'<div class="alert alert-info">' +
+ '<b>Review Configuration Changes.</b></br>The following lists the configuration changes that will be ' +
+ 'made by the Wizard to activate HAWQ Standby Master. This information is for <b> review only </b> and is not' +
+ ' editable.<br/><br/><b>Note:</b> hawq_standby_address_host property will be removed from hawq-site.xml as ' +
+ 'HAWQ Standby will be activated to HAWQ Master.</div>',
+ 'admin.activateHawqStandby.wizard.step2.confirm.host.body':'<b>Review HAWQ Master & Standby role changes.</b>',
+ 'admin.activateHawqStandby.wizard.step2.confirmPopup.body': 'Do you wish to continue with activating HAWQ Standy? Please confirm, before proceeding as you will not be able to rollback from Ambari.',
+ 'admin.activateHawqStandby.wizard.step3.header': 'Finalize Setup',
+ 'admin.activateHawqStandby.wizard.step3.task0.title': 'Activate HAWQ Standby',
+ 'admin.activateHawqStandby.wizard.step3.task1.title': 'Stop HAWQ Service',
+ 'admin.activateHawqStandby.wizard.step3.task2.title': 'Reconfigure HAWQ',
+ 'admin.activateHawqStandby.wizard.step3.task3.title': 'Install Role: New HAWQ Master',
+ 'admin.activateHawqStandby.wizard.step3.task4.title': 'Delete Role: Old HAWQ Master',
+ 'admin.activateHawqStandby.wizard.step3.task5.title': 'Delete Role: Old HAWQ Standby',
+ 'admin.activateHawqStandby.wizard.step3.task6.title': 'Start HAWQ Service',
+ 'admin.activateHawqStandby.closePopup':'Activate 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.activateHawqStandby.wizard.step3.notice.inProgress':'Please wait while HAWQ Standby is being activated',
+ 'admin.activateHawqStandby.wizard.step3.notice.completed':'HAWQ Standby has been activated successfully.',
+ 'admin.activateHawqStandby.wizard.step3.activateHawqStandbyCommand.context': "Execute HAWQ Standby activate command"
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index 02cd36a..88b7f87 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -695,6 +695,36 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, {
this.removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
App.router.send('back');
}
+ },
+
+ /**
+ * Delete component on single hosts.
+ *
+ * @method deleteComponent
+ * @param {string} componentName - name of the component
+ * @param {string} hostName - host from where components should be deleted
+ */
+ deleteComponent: function (componentName, hostName) {
+ App.ajax.send({
+ name: 'common.delete.host_component',
+ sender: this,
+ data: {
+ componentName: componentName,
+ hostName: hostName
+ },
+ success: 'onTaskCompleted',
+ error: 'onDeleteHostComponentsError'
+ });
+ },
+
+ onDeleteHostComponentsError: function (error) {
+ // If the component does not exist on the host, NoSuchResourceException is thrown.
+ // If NoSuchResourceException is thrown, there is no action required and operation should continue.
+ if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.NoSuchResourceException') !== -1) {
+ this.onTaskCompleted();
+ } else {
+ this.onTaskError();
+ }
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index b205d38..a081d62 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -405,7 +405,14 @@ App.HostComponentActionMap = {
cssClass: 'icon-plus',
isHidden: App.get('isSingleNode') || HS,
disabled: false
- }
+ },
+ TOGGLE_ACTIVATE_HAWQ_STANDBY: {
+ action: 'activateHawqStandby',
+ label: Em.I18n.t('admin.activateHawqStandby.button.enable'),
+ cssClass: 'icon-arrow-up',
+ isHidden: App.get('isSingleNode') || !HS,
+ disabled: false
+ }
};
}
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/routes/activate_hawq_standby_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/activate_hawq_standby_routes.js b/ambari-web/app/routes/activate_hawq_standby_routes.js
new file mode 100644
index 0000000..c7631ca
--- /dev/null
+++ b/ambari-web/app/routes/activate_hawq_standby_routes.js
@@ -0,0 +1,179 @@
+/**
+ * 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/activate',
+
+ enter: function (router, transition) {
+ var activateHawqStandbyWizardController = router.get('activateHawqStandbyWizardController');
+ activateHawqStandbyWizardController.dataLoading().done(function () {
+ App.router.set('mainServiceItemController.content', App.Service.find().findProperty('serviceName', 'HAWQ'));
+ App.router.get('updateController').set('isWorking', false);
+ var popup = App.ModalPopup.show({
+ classNames: ['full-width-modal'],
+ header: Em.I18n.t('admin.activateHawqStandby.wizard.header'),
+ bodyClass: App.ActivateHawqStandbyWizardView.extend({
+ controller: activateHawqStandbyWizardController
+ }),
+ primary: Em.I18n.t('form.cancel'),
+ showFooter: false,
+ secondary: null,
+ updateClusterStatus: function() {
+ var controller = router.get('activateHawqStandbyWizardController');
+ router.get('updateController').set('isWorking', true);
+ activateHawqStandbyWizardController.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();
+ });
+ }
+ });
+ },
+
+ onClose: function () {
+ var activateHawqStandbyWizardController = router.get('activateHawqStandbyWizardController'),
+ currStep = activateHawqStandbyWizardController.get('currentStep')
+ if (parseInt(currStep) === 3) {
+ App.showConfirmationPopup(function () {
+ popup.updateClusterStatus();
+ }, Em.I18n.t('admin.activateHawqStandby.closePopup'));
+ } else {
+ popup.updateClusterStatus();
+ }
+ },
+ didInsertElement: function () {
+ this.fitHeight();
+ }
+ });
+ activateHawqStandbyWizardController.set('popup', popup);
+ var currentClusterStatus = App.clusterStatus.get('value');
+ if (currentClusterStatus) {
+ switch (currentClusterStatus.clusterState) {
+ case 'ACTIVATE_HAWQ_STANDBY' :
+ activateHawqStandbyWizardController.setCurrentStep(currentClusterStatus.localdb.ActivateHawqStandbyWizard.currentStep);
+ break;
+ default:
+ var currStep = App.router.get('activateHawqStandbyWizardController.currentStep');
+ activateHawqStandbyWizardController.setCurrentStep(currStep);
+ break;
+ }
+ }
+ Em.run.next(function () {
+ App.router.get('wizardWatcherController').setUser(activateHawqStandbyWizardController.get('name'));
+ router.transitionTo('step' + activateHawqStandbyWizardController.get('currentStep'));
+ });
+ });
+ },
+
+ step1: Em.Route.extend({
+ route: '/step1',
+ connectOutlets: function (router) {
+ var controller = router.get('activateHawqStandbyWizardController');
+ controller.dataLoading().done(function () {
+ controller.setCurrentStep('1');
+ controller.connectOutlet('activateHawqStandbyWizardStep1', controller.get('content'));
+ })
+ },
+ unroutePath: function () {
+ return false;
+ },
+ next: function (router) {
+ var controller = router.get('activateHawqStandbyWizardController');
+ 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('activateHawqStandbyWizardController');
+ controller.dataLoading().done(function () {
+ controller.setCurrentStep('2');
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('activateHawqStandbyWizardStep2', controller.get('content'));
+ })
+ },
+ unroutePath: function () {
+ return false;
+ },
+ next: function (router) {
+ App.showConfirmationPopup(function() {
+ var wizardController = router.get('activateHawqStandbyWizardController');
+ var stepController = router.get('activateHawqStandbyWizardStep2Controller');
+ var configs = stepController.get('selectedService.configs');
+ wizardController.saveConfigs(configs);
+ router.transitionTo('step3');
+ }, Em.I18n.t('admin.activateHawqStandby.wizard.step2.confirmPopup.body'));
+ },
+ back: Em.Router.transitionTo('step1')
+ }),
+ step3: Em.Route.extend({
+ route: '/step3',
+ connectOutlets: function (router) {
+ var controller = router.get('activateHawqStandbyWizardController');
+ controller.dataLoading().done(function () {
+ controller.setCurrentStep('3');
+ controller.setLowerStepsDisable(3);
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('activateHawqStandbyWizardStep3', controller.get('content'));
+ })
+ },
+ unroutePath: function (router, path) {
+ // allow user to leave route if wizard has finished
+ if (router.get('activateHawqStandbyWizardController').get('isFinished')) {
+ this._super(router, path);
+ } else {
+ return false;
+ }
+ },
+ next: function (router) {
+ var controller = router.get('activateHawqStandbyWizardController');
+ 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();
+ });
+ }
+ });
+ }
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 48c9b91..bd66945 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -719,6 +719,8 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
addHawqStandby: require('routes/add_hawq_standby_routes'),
+ activateHawqStandby: require('routes/activate_hawq_standby_routes'),
+
rollbackHighAvailability: require('routes/rollbackHA_routes')
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs
new file mode 100644
index 0000000..47f9dc2
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/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.activateHawqStandby.wizard.step1.header}}</h2>
+
+ <div class="alert alert-info">
+ {{t admin.activateHawqStandby.wizard.step1.body}}
+ </div>
+
+ <div class="btn-area">
+ <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} →</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
new file mode 100644
index 0000000..02083f4
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
@@ -0,0 +1,53 @@
+{{!
+* 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.activateHawqStandby.wizard.step2.header}}</h2>
+
+<div class="alert alert-info">
+ {{t admin.activateHawqStandby.wizard.step2.confirm.host.body}}
+</div>
+
+<div id="activate-standby-step2-content" class="well pre-scrollable">
+ <div id="activate-standby-step2-info">
+ <table id="ha-step3-review-table">
+ <tr>
+ <td>{{t admin.activateHawqStandby.wizard.step2.hawqMaster}}</td>
+ <td>{{controller.content.hawqHosts.hawqMaster}}</td>
+ <td><span class="to-be-disabled-red"><i class="icon-minus"></i> {{t admin.highAvailability.wizard.step3.toBeDeleted}}</span></td>
+ </tr>
+ <tr>
+ <td>{{t admin.activateHawqStandby.wizard.step2.hawqStandby}}</td>
+ <td>{{controller.content.hawqHosts.hawqStandby}}</td>
+ <td><span class="to-be-installed-green"><i class="icon-arrow-up"></i> {{t admin.activateHawqStandby.wizard.step2.toBeActivated}}</span></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+{{#if controller.isLoaded}}
+ <div id="serviceConfig">
+ {{{t admin.activateHawqStandby.wizard.step2.confirm.config.body}}}
+ {{view App.ServiceConfigView}}
+ </div>
+{{else}}
+ {{view App.SpinnerView}}
+{{/if}}
+
+<div class="btn-area">
+ <a class="btn" {{action back}}>← {{t common.back}}</a>
+ <a class="btn btn-success pull-right" {{action submit target="controller"}} {{bindAttr disabled="controller.isSubmitDisabled"}}>{{t common.next}} →</a>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs
new file mode 100644
index 0000000..6b4923a
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/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"}}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs
new file mode 100644
index 0000000..3518122
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/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.activateHawqStandby.wizard.header}}</li>
+ <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t admin.activateHawqStandby.wizard.step1.header}}</a></li>
+ <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t admin.activateHawqStandby.wizard.step2.header}}</a></li>
+ <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t admin.activateHawqStandby.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>
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js b/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
new file mode 100644
index 0000000..84e39ff
--- /dev/null
+++ b/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
@@ -0,0 +1,53 @@
+/**
+ * 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('utils/configs/config_initializer_class');
+require('utils/configs/hosts_based_initializer_mixin');
+
+/**
+ * Initializer for configs that are updated when Hawq Standby is added
+ *
+ * @class {HawqActivateStandbyConfigInitializer}
+ */
+App.HawqActivateStandbyConfigInitializer = App.HaConfigInitializerClass.create(App.HostsBasedInitializerMixin, {
+
+ initializers: function () {
+ return {
+ 'hawq_master_address_host': this.getHostWithPortConfig('HAWQSTANDBY', true, '', '', '')
+ };
+ }.property(),
+
+
+ /**
+ * @override
+ * @param {object} settings
+ */
+ setup: function (settings) {
+ this._updateInitializers(settings);
+ },
+
+ /**
+ * @override
+ */
+ cleanup: function () {
+ this._restoreInitializers();
+ }
+
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js b/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
index 1de2551..3977d53 100644
--- a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
@@ -21,7 +21,7 @@ require('utils/configs/config_initializer_class');
require('utils/configs/hosts_based_initializer_mixin');
/**
- * Initializer for configs that are updated when Hawq Standby is activated
+ * Initializer for configs that are updated when Hawq Standby is added
*
* @class {HawqHaConfigInitializer}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 598910a..34d90bf 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -44,6 +44,7 @@ var InitialData = {
'HighAvailabilityWizard': {},
'RMHighAvailabilityWizard': {},
'AddHawqStandbyWizard': {},
+ 'ActivateHawqStandbyWizard': {},
'RAHighAvailabilityWizard': {},
'RollbackHighAvailabilityWizard': {},
'MainAdminStackAndUpgrade': {},
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d3c7fdc..afb12e1 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -163,6 +163,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/activateStandby/wizard_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step1_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step2_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step3_view');
require('views/main/admin/highAvailability/rangerAdmin/wizard_view');
require('views/main/admin/highAvailability/rangerAdmin/step1_view');
require('views/main/admin/highAvailability/rangerAdmin/step2_view');
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js
new file mode 100644
index 0000000..5f76565
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/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.ActivateHawqStandbyWizardStep1View = Em.View.extend({
+
+ templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step1')
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
new file mode 100644
index 0000000..93b11b6
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
@@ -0,0 +1,29 @@
+/**
+ * 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.ActivateHawqStandbyWizardStep2View = Em.View.extend({
+
+ templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step2'),
+
+ didInsertElement: function () {
+ this.get('controller').loadStep();
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js
new file mode 100644
index 0000000..184e4b9
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/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.ActivateHawqStandbyWizardStep3View = App.HighAvailabilityProgressPageView.extend({
+
+ templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step3'),
+
+ headerTitle: Em.I18n.t('admin.activateHawqStandby.wizard.step3.header'),
+
+ noticeInProgress: Em.I18n.t('admin.activateHawqStandby.wizard.step3.notice.inProgress'),
+
+ noticeCompleted: Em.I18n.t('admin.activateHawqStandby.wizard.step3.notice.completed'),
+
+ submitButtonText: Em.I18n.t('common.complete'),
+
+ labelWidth: 'span5'
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
new file mode 100644
index 0000000..068e78a
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/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.ActivateHawqStandbyWizardView = 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/activateStandby/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);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 048c163..d5d65e4 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -36,6 +36,7 @@ App.MainServiceItemView = Em.View.extend({
'HBASE_MASTER': ['DECOMMISSION'],
'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER'],
+ 'HAWQSTANDBY': ['ACTIVATE_STANDBY'],
'HAWQSEGMENT': ['IMMEDIATE_STOP']
},
@@ -171,6 +172,7 @@ App.MainServiceItemView = Em.View.extend({
break;
case 'HAWQ':
options.push(actionMap.TOGGLE_ADD_HAWQ_STANDBY);
+ options.push(actionMap.TOGGLE_ACTIVATE_HAWQ_STANDBY);
break;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
new file mode 100644
index 0000000..e702892
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
@@ -0,0 +1,88 @@
+/**
+ * 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/activateStandby/step2_controller');
+var testHelpers = require('test/helpers');
+
+describe('App.ActivateHawqStandbyWizardStep2Controller', function () {
+
+ describe('#isSubmitDisabled', function () {
+
+ var controller = App.ActivateHawqStandbyWizardStep2Controller.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);
+ });
+ });
+
+ });
+
+
+ describe('#setDynamicConfigValues', function () {
+
+ var controller = App.ActivateHawqStandbyWizardStep2Controller.create({
+ content: Em.Object.create({
+ masterComponentHosts: [
+ {component: 'HAWQMASTER', hostName: 'h0', isInstalled: true},
+ {component: 'HAWQSTANDBY', hostName: 'h1', isInstalled: true}
+ ],
+ hawqHost: {
+ hawqMaster: 'h0',
+ hawqStandby: 'h1'
+ }
+ })
+ }),
+ configs = {
+ configs: [
+ Em.Object.create({
+ name: 'hawq_master_address_host'
+ })
+ ]
+ };
+
+
+ beforeEach(function () {
+ controller.setDynamicConfigValues(configs);
+ });
+
+ it('hawq_master_address_host value', function () {
+ expect(configs.configs.findProperty('name', 'hawq_master_address_host').get('value')).to.equal('h1');
+ });
+ it('hawq_master_address_host recommendedValue', function () {
+ expect(configs.configs.findProperty('name', 'hawq_master_address_host').get('recommendedValue')).to.equal('h1');
+ });
+ });
+
+});