[ambari] branch trunk updated: AMBARI-23166. NN Federation Wizard: implement step4 (akovalenko)

2018-03-11 Thread akovalenko
This is an automated email from the ASF dual-hosted git repository.

akovalenko pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 35fe83c  AMBARI-23166. NN Federation Wizard: implement step4 
(akovalenko)
35fe83c is described below

commit 35fe83c4f720348dee3d00af53ce263686fd792e
Author: Aleksandr Kovalenko 
AuthorDate: Wed Mar 7 18:17:36 2018 +0200

AMBARI-23166. NN Federation Wizard: implement step4 (akovalenko)
---
 .../main/admin/federation/step3_controller.js  |   9 +-
 .../main/admin/federation/step4_controller.js  | 101 -
 .../main/admin/federation/wizard_controller.js |  18 
 .../data/configs/wizards/federation_properties.js  |  52 ++-
 ambari-web/app/messages.js |  15 +++
 .../app/routes/namenode_federation_routes.js   |   7 --
 .../app/templates/main/admin/federation/step4.hbs  |   7 +-
 ambari-web/app/utils/ajax/ajax.js  |  59 
 .../app/views/main/admin/federation/step4_view.js  |  13 ++-
 9 files changed, 241 insertions(+), 40 deletions(-)

diff --git 
a/ambari-web/app/controllers/main/admin/federation/step3_controller.js 
b/ambari-web/app/controllers/main/admin/federation/step3_controller.js
index d48043b..993cecc 100644
--- a/ambari-web/app/controllers/main/admin/federation/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/federation/step3_controller.js
@@ -81,13 +81,14 @@ App.NameNodeFederationWizardStep3Controller = 
Em.Controller.extend(App.Blueprint
 var ret = {};
 var configsFromServer = this.get('serverConfigData.items');
 var journalNodes = 
App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE');
+var nameNodes = 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE');
 // todo: replace with real data
 ret.nameservice1 = 'ns1';
 ret.nameservice2 = this.get('content.nameServiceId');
-ret.namenode1 = this.get('content.selectedHosts.currentNN')[0];
-ret.namenode2 = this.get('content.selectedHosts.currentNN')[1];
-ret.namenode3 = this.get('content.selectedHosts.additionalNN')[0];
-ret.namenode4 = this.get('content.selectedHosts.additionalNN')[1];
+ret.namenode1 = 
nameNodes.filterProperty('isInstalled').mapProperty('hostName')[0];
+ret.namenode2 = 
nameNodes.filterProperty('isInstalled').mapProperty('hostName')[1];
+ret.namenode3 = nameNodes.filterProperty('isInstalled', 
false).mapProperty('hostName')[0];
+ret.namenode4 = nameNodes.filterProperty('isInstalled', 
false).mapProperty('hostName')[1];
 ret.journalnodes = journalNodes.map(function (c) {
   return c.get('hostName') + ':8485'
 }).join(';');
diff --git 
a/ambari-web/app/controllers/main/admin/federation/step4_controller.js 
b/ambari-web/app/controllers/main/admin/federation/step4_controller.js
index 2a293a3..fd3a6f3 100644
--- a/ambari-web/app/controllers/main/admin/federation/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/federation/step4_controller.js
@@ -20,5 +20,104 @@ var App = require('app');
 
 App.NameNodeFederationWizardStep4Controller = 
App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
 
-  name: "nameNodeFederationWizardStep4Controller"
+  name: "nameNodeFederationWizardStep4Controller",
+
+  commands: ['stopAllServices', 'reconfigureHDFS', 'installNameNode', 
'installZKFC', 'formatNameNode', 'formatZKFC', 'startZKFC', 'startNameNode', 
'bootstrapNameNode', 'startZKFC2', 'startNameNode2', 'startAllServices'],
+
+  tasksMessagesPrefix: 'admin.nameNodeFederation.wizard.step',
+
+  newNameNodeHosts: function () {
+return 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE').filterProperty('isInstalled', false).mapProperty('hostName');
+  }.property('content.masterComponentHosts.@each.hostName'),
+
+  reconfigureHDFS: function () {
+var data = this.get('content.serviceConfigProperties');
+var note = 
Em.I18n.t('admin.nameNodeFederation.wizard,step4.save.configuration.note');
+var configData = this.reconfigureSites(['hdfs-site'], data, note);
+return App.ajax.send({
+  name: 'common.service.configurations',
+  sender: this,
+  data: {
+desired_config: configData
+  },
+  error: 'onTaskError',
+  success: 'installHDFSClients'
+});
+  },
+
+  installHDFSClients: function () {
+var nnHostNames = 
this.get('content.masterComponentHosts').filterProperty('component', 
'NAMENODE').mapProperty('hostName');
+var jnHostNames = App.HostComponent.find().filterProperty('componentName', 
'JOURNALNODE').mapProperty('hostName');
+var hostNames = nnHostNames.concat(jnHostNames).uniq();
+this.createInstallComponentTask('HDFS_CLIENT', hostNames, 'HDFS');
+  },
+
+  stopAllServices: function () {
+this.stopServices([], true, 

[ambari] branch trunk updated: AMBARI-23182. Infra Solr - add custom Ambari commands for backup/migrate/restore index. (#596)

2018-03-11 Thread oleewere
This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8adcdd8  AMBARI-23182. Infra Solr - add custom Ambari commands for 
backup/migrate/restore index. (#596)
8adcdd8 is described below

commit 8adcdd89c1c3757ea16ce03ef18f1b6b091262e6
Author: Olivér Szabó 
AuthorDate: Sun Mar 11 23:23:57 2018 +0100

AMBARI-23182. Infra Solr - add custom Ambari commands for 
backup/migrate/restore index. (#596)
---
 .../src/main/resources/solrIndexHelper.sh  |  5 ++
 .../AMBARI_INFRA_SOLR/0.1.0/metainfo.xml   | 35 +
 .../0.1.0/package/scripts/collection.py| 75 +++
 .../0.1.0/package/scripts/command_commons.py   | 84 ++
 .../0.1.0/package/scripts/infra_solr.py| 15 +++-
 .../0.1.0/package/scripts/migrate.py   | 55 ++
 6 files changed, 268 insertions(+), 1 deletion(-)

diff --git 
a/ambari-infra/ambari-infra-solr-client/src/main/resources/solrIndexHelper.sh 
b/ambari-infra/ambari-infra-solr-client/src/main/resources/solrIndexHelper.sh
index d47f071..4ba342a 100755
--- 
a/ambari-infra/ambari-infra-solr-client/src/main/resources/solrIndexHelper.sh
+++ 
b/ambari-infra/ambari-infra-solr-client/src/main/resources/solrIndexHelper.sh
@@ -68,6 +68,11 @@ function upgrade_core() {
 verbose="-verbose"
   fi
 
+  if [[ -f "$INDEX_DIR/write.lock" ]]; then
+echo "Deleting $INDEX_DIR/write.lock file..."
+rm "$INDEX_DIR/write.lock"
+  fi
+
   for coll in $SOLR_CORE_FILTER_ARR; do
 if [[ "$1" == *"$coll"* ]]; then
   echo "$core_str '$1' dir name contains $coll (core filter)'";
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/metainfo.xml
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/metainfo.xml
index 68787bf..f5d58f7 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/metainfo.xml
@@ -42,6 +42,41 @@
   true
 
   
+  
+
+  BACKUP
+  
+scripts/infra_solr.py
+PYTHON
+1200
+  
+
+
+  RESTORE
+  
+scripts/infra_solr.py
+PYTHON
+1200
+  
+
+
+  MIGRATE
+  
+scripts/infra_solr.py
+PYTHON
+36000
+true
+  
+
+
+  DELETE
+  
+scripts/infra_solr.py
+PYTHON
+600
+  
+
+  
   
 
   AMBARI_INFRA_SOLR/INFRA_SOLR_CLIENT
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
new file mode 100644
index 000..0abcbc9
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
@@ -0,0 +1,75 @@
+"""
+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.
+
+"""
+
+from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Directory, Execute, File
+from resource_management.libraries.functions.format import format
+
+def backup_collection(env):
+"""
+Backup collections using replication API (as Solr Cloud Backup API is not 
available in Solr 5)
+"""
+import params, command_commons
+env.set_params(command_commons)
+
+Logger.info(format("Backup Solr Collection {collection} to 
{index_location}"))
+
+solr_request_path = 
format("{collection}/replication?command=BACKUP={index_location}={backup_name}=json")
+backup_api_cmd = 
command_commons.create_solr_api_request_command(solr_request_path)
+
+