summaryrefslogtreecommitdiffstats
path: root/glustolibs-misc
diff options
context:
space:
mode:
authorBala Konda Reddy M <bmekala@redhat.com>2019-08-09 15:48:45 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-09-04 09:46:10 +0000
commit875ba99936c2fb8947d3f35e08b412e2223a54a2 (patch)
treec2430e2dadb443d269a7a777c2b9fcaef211efc3 /glustolibs-misc
parente6bca2db2d21a0a570919a0a52f4c7ab839a6f57 (diff)
Added a library for daemon reload and fixing testcase
After changing the type of unit file from INFO to DEBUG. Performing daemon reload. Earlier using running commands continuosly to generated debug messages instead of running continuosly, restarted glusterd in one of the nodes so that while handshake the logs will be in Debug mode. After validating reverting back the unit file to INFO and daemon reload Change-Id: I8c99407eff2ea98a836f37fc2d89bb99f7eeccb7 Signed-off-by: Bala Konda Reddy M <bmekala@redhat.com>
Diffstat (limited to 'glustolibs-misc')
-rwxr-xr-xglustolibs-misc/glustolibs/misc/misc_libs.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/glustolibs-misc/glustolibs/misc/misc_libs.py b/glustolibs-misc/glustolibs/misc/misc_libs.py
index fb4bb49..ee6c74c 100755
--- a/glustolibs-misc/glustolibs/misc/misc_libs.py
+++ b/glustolibs-misc/glustolibs/misc/misc_libs.py
@@ -17,6 +17,7 @@
""" Description: Helper module for misc libs. """
from glusto.core import Glusto as g
+from glustolibs.gluster.lib_utils import is_rhel7
import os
import sys
import time
@@ -563,3 +564,29 @@ def drop_caches(hosts):
_rc = False
return _rc
+
+
+def daemon_reload(node):
+ """
+ Reloads the Daemons when unit files are changed
+
+ Args:
+ node : Node on which daemon has to be reloaded
+
+ Returns:
+ bool : True, On successful daemon reload
+ False, Otherwise
+ """
+ if is_rhel7([node]):
+ cmd = "systemctl daemon-reload"
+ ret, _, _ = g.run(node, cmd)
+ if ret != 0:
+ g.log.error("Failed to reload the daemon")
+ return False
+ else:
+ cmd = 'service glusterd reload'
+ ret, _, _ = g.run(node, cmd)
+ if ret != 0:
+ g.log.error("Failed to reload the daemon")
+ return False
+ return True