You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/08/01 09:46:25 UTC
ambari git commit: AMBARI-21614. Restart NFSGateway fails after
ResourceManager move to another host (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk c7b350b67 -> 11aadf532
AMBARI-21614. Restart NFSGateway fails after ResourceManager move to another host (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/11aadf53
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/11aadf53
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/11aadf53
Branch: refs/heads/trunk
Commit: 11aadf532f3ecdfcfed727346ea4f3418aa1deb2
Parents: c7b350b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Aug 1 12:45:49 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Aug 1 12:45:49 2017 +0300
----------------------------------------------------------------------
.../HDFS/2.1.0.2.0/package/scripts/utils.py | 15 ++++++++++++++-
.../HDFS/3.0.0.3.0/package/scripts/utils.py | 16 +++++++++++++++-
.../test/python/stacks/2.0.6/HDFS/test_namenode.py | 2 +-
3 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/11aadf53/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
index 2535f60..f178d23 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
@@ -19,6 +19,7 @@ limitations under the License.
import os
import re
import urllib2
+import subprocess
import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set.
from resource_management.core.resources.system import Directory, File, Execute
@@ -283,7 +284,19 @@ def service(action=None, name=None, user=None, options="", create_pid_dir=False,
show_logs(log_dir, user)
raise
- wait_process_stopped(pid_file)
+ # Wait until stop actually happens
+ process_id_does_not_exist_command = format("! ( {process_id_exists_command} )")
+ code, out = shell.call(process_id_does_not_exist_command,
+ env=hadoop_env_exports,
+ tries = 6,
+ try_sleep = 10,
+ )
+
+ # If stop didn't happen, kill it forcefully
+ if code != 0:
+ code, out, err = shell.checked_call(("cat", pid_file), sudo=True, env=hadoop_env_exports, stderr=subprocess.PIPE)
+ pid = out
+ Execute(("kill", "-9", pid), sudo=True)
File(pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/11aadf53/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
index 0c28a00..11fde02 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
@@ -279,7 +279,21 @@ def service(action=None, name=None, user=None, options="", create_pid_dir=False,
except:
show_logs(log_dir, user)
raise
- wait_process_stopped(pid_file)
+
+ # Wait until stop actually happens
+ process_id_does_not_exist_command = format("! ( {process_id_exists_command} )")
+ code, out = shell.call(process_id_does_not_exist_command,
+ env=hadoop_env_exports,
+ tries = 6,
+ try_sleep = 10,
+ )
+
+ # If stop didn't happen, kill it forcefully
+ if code != 0:
+ code, out, err = shell.checked_call(("cat", pid_file), sudo=True, env=hadoop_env_exports, stderr=subprocess.PIPE)
+ pid = out
+ Execute(("kill", "-9", pid), sudo=True)
+
File(pid_file, action="delete")
def get_jmx_data(nn_address, modeler_type, metric, encrypted=False, security_enabled=False):
http://git-wip-us.apache.org/repos/asf/ambari/blob/11aadf53/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
index e6503a2..eb595c1 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
@@ -1351,7 +1351,7 @@ class TestNamenode(RMFTestCase):
config_file = "nn_eu_standby.json",
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
+ call_mocks = [(0, None), (0, None, ''), (0, None)] ,
mocks_dict=mocks_dict)
calls = mocks_dict['call'].call_args_list