Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 1bcfb5527 -> 02d041a92


AMBARI-17743. Storm service check failed during Express Upgrade due to Nimbus 
going down after restart with CNF IClusterReporter (ncole)


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

Branch: refs/heads/branch-2.4
Commit: 02d041a9246f7d1fe85c339acfa21d83a46c2c11
Parents: 1bcfb55
Author: Nate Cole <[email protected]>
Authored: Fri Jul 15 17:08:21 2016 -0400
Committer: Nate Cole <[email protected]>
Committed: Fri Jul 15 17:08:21 2016 -0400

----------------------------------------------------------------------
 .../libraries/functions/constants.py            |  1 +
 .../STORM/0.9.1/package/scripts/params_linux.py |  2 +-
 .../STORM/0.9.1/package/scripts/storm.py        |  6 +--
 .../HDP/2.0.6/properties/stack_features.json    |  5 +++
 .../stacks/2.1/STORM/test_storm_nimbus.py       | 42 ++++++++++++++++++++
 5 files changed, 52 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/02d041a9/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 5b9e900..42ecf6a 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -94,3 +94,4 @@ class StackFeature:
   RANGER_PID_SUPPORT = "ranger_pid_support"
   RANGER_KMS_PID_SUPPORT = "ranger_kms_pid_support"
   RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change"
+  STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes"

http://git-wip-us.apache.org/repos/asf/ambari/blob/02d041a9/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
index c8664b0..591e548 100644
--- 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
@@ -49,7 +49,7 @@ sudo = AMBARI_SUDO_BINARY
 cluster_name = config['clusterName']
 
 stack_name = status_params.stack_name
-upgrade_direction = default("/commandParams/upgrade_direction", 
Direction.UPGRADE)
+upgrade_direction = default("/commandParams/upgrade_direction", None)
 version = default("/commandParams/version", None)
 
 agent_stack_retry_on_unavailability = 
config['hostLevelParams']['agent_stack_retry_on_unavailability']

http://git-wip-us.apache.org/repos/asf/ambari/blob/02d041a9/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
index dfd55dc..d765ca3 100644
--- 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
+++ 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
@@ -117,10 +117,10 @@ def storm(name=None):
     # On old HDP 2.1 versions, this symlink may also exist and break EU to 
newer versions
     Link("/usr/lib/storm/lib/ambari-metrics-storm-sink.jar", action="delete")
 
-    if params.availableServices.has_key("STORM") and 
params.availableServices.get("STORM").startswith("0"):
-      sink_jar = params.metric_collector_legacy_sink_jar
-    else:
+    if check_stack_feature(StackFeature.STORM_METRICS_APACHE_CLASSES, 
params.version_for_stack_feature_checks):
       sink_jar = params.metric_collector_sink_jar
+    else:
+      sink_jar = params.metric_collector_legacy_sink_jar
 
     Execute(format("{sudo} ln -s {sink_jar} 
{storm_lib_dir}/ambari-metrics-storm-sink.jar"),
             not_if=format("ls {storm_lib_dir}/ambari-metrics-storm-sink.jar"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/02d041a9/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index 7f69fcd..6d26052 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -271,6 +271,11 @@
       "name": "ranger_admin_password_change",
       "description": "Allow ranger admin credentials to be specified during 
cluster creation (AMBARI-17000)",
       "min_version": "2.5.0.0"
+    },
+    {
+      "name": "storm_metrics_apache_classes",
+      "description": "Metrics sink for Storm that uses Apache class names",
+      "min_version": "2.5.0.0"
     }
   ]
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/02d041a9/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py 
b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
index 04ed17b..40972f9 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
@@ -101,6 +101,48 @@ class TestStormNimbus(TestStormBase):
     )
     self.assertNoMoreResources()
 
+  def test_start_with_metrics_collector_modern(self):
+    config_file = self.get_src_folder() + 
"/test/python/stacks/2.1/configs/default.json"
+    with open(config_file, "r") as f:
+      json_content = json.load(f)
+    json_content["commandParams"]["version"] = "2.5.0.0-1234"
+    json_content["clusterHostInfo"]["metrics_collector_hosts"] = ["host1", 
"host2"]
+
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/nimbus.py",
+                       classname = "Nimbus",
+                       command = "start",
+                       config_dict = json_content,
+                       stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES
+                       )
+    self.assert_configure_default()
+
+    self.assertResourceCalled('File', 
'/etc/storm/conf/storm-metrics2.properties',
+                              content = 
Template('storm-metrics2.properties.j2'),
+                              owner = 'storm',
+                              group = 'hadoop',
+                              )
+    self.assertResourceCalled('Link', 
'/usr/lib/storm/lib//ambari-metrics-storm-sink.jar',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Link', 
'/usr/lib/storm/lib/ambari-metrics-storm-sink.jar',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Execute', 'ambari-sudo.sh ln -s 
/usr/lib/storm/lib/ambari-metrics-storm-sink-with-common-*.jar 
/usr/lib/storm/lib//ambari-metrics-storm-sink.jar',
+                              not_if = 'ls 
/usr/lib/storm/lib//ambari-metrics-storm-sink.jar',
+                              only_if = 'ls 
/usr/lib/storm/lib/ambari-metrics-storm-sink-with-common-*.jar',
+                              )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh 
; export PATH=$JAVA_HOME/bin:$PATH ; storm nimbus > /var/log/storm/nimbus.out 
2>&1 &\n echo $! > /var/run/storm/nimbus.pid',
+        path = ['/usr/bin'],
+        user = 'storm',
+        not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c 
'[RMF_EXPORT_PLACEHOLDER]ls /var/run/storm/nimbus.pid >/dev/null 2>&1 && ps -p 
`cat /var/run/storm/nimbus.pid` >/dev/null 2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/nimbus.pid',
+        owner = 'storm',
+        group = 'hadoop',
+    )
+    self.assertNoMoreResources()
+
   @patch("os.path.exists")
   def test_stop_default(self, path_exists_mock):
     # Bool for the pid file

Reply via email to