diff options
author | Vijay Avuthu <vavuthu@redhat.com> | 2018-01-27 16:04:43 +0530 |
---|---|---|
committer | Vijay Avuthu <vavuthu@redhat.com> | 2018-01-29 16:40:26 +0000 |
commit | a817dfa6522ee29397fbc950b06ed11bbc57d469 (patch) | |
tree | c86a6fb778e90e65a55be79a9dd36445ade2f5ec /glustolibs-gluster | |
parent | 3c1f3aa63bb4cb36e63a8258d742d95b650d4c5b (diff) |
Adding function bring_self_heal_daemon_process_offline to heal_libs
Description:
Bring the self-heal daemon process offline for the nodes
Change-Id: I55301fb86a97147920991aa4455e8e5d80b1c5c3
Signed-off-by: Vijay Avuthu <vavuthu@redhat.com>
Diffstat (limited to 'glustolibs-gluster')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/heal_libs.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/heal_libs.py b/glustolibs-gluster/glustolibs/gluster/heal_libs.py index b782caf86..3da020380 100644 --- a/glustolibs-gluster/glustolibs/gluster/heal_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/heal_libs.py @@ -455,3 +455,47 @@ def is_shd_daemonized(nodes, timeout=120): g.log.info("Single self heal daemon process on all nodes %s", nodes) return True + + +def bring_self_heal_daemon_process_offline(nodes): + """ + Bring the self-heal daemon process offline for the nodes + + Args: + nodes ( str|list ) : Node/Nodes of the cluster to bring + self-heal daemon process offline + + Returns: + bool : True on successfully bringing self-heal daemon process offline. + False otherwise + """ + if isinstance(nodes, str): + nodes = [nodes] + + failed_nodes = [] + _rc = True + + g.log.info("Starting to get self heal daemon process on nodes %s" % nodes) + ret, pids = get_self_heal_daemon_pid(nodes) + if not ret: + g.log.error("Either no self heal daemon process found or more than" + " one self heal daemon process found : %s" % pids) + return False + g.log.info("Successful in getting single self heal daemon process" + " on all nodes %s", nodes) + + for node in pids: + pid = pids[node][0] + kill_cmd = "kill -SIGKILL %s" % pid + ret, _, _ = g.run(node, kill_cmd) + if ret != 0: + g.log.error("Unable to kill the self heal daemon " + "process on %s" % node) + failed_nodes.append(node) + + if failed_nodes: + g.log.info("Unable to kill the self heal daemon " + "process on nodes %s" % nodes) + _rc = False + + return _rc |