summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/gluster_init.py
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-06-16 11:50:05 +0530
committerArthy Loganathan <aloganat@redhat.com>2020-06-16 07:33:12 +0000
commitecd9b4527880e7b4035867eade53b0008cc7e30f (patch)
tree30d3f0fe294aaaf75dc13815c1298428aa7c39d4 /glustolibs-gluster/glustolibs/gluster/gluster_init.py
parent0c51170b87c6d13d82f802e4174520f20064c49a (diff)
[Lib] Add library for reset-failed
Adding library function reset_failed_glusterd() and modifying scratch_cleanup() to use reset_failed_glusterd(). This is needed because of patch [1] and [2] sent to glusterfs where changes are made to glusterd.service.in to not allow glusterd restart for more than 6 times within an hour. Links: [1] https://review.gluster.org/#/c/glusterfs/+/23751/ [2] https://review.gluster.org/#/c/glusterfs/+/23970/ Change-Id: I25f982517420f20f11a610e8a68afc71f3b7f2a9 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/gluster_init.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_init.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_init.py b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
index 29059e6a1..6e6b5aaf7 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_init.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2015-2020 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 Red Hat, Inc. <http://www.redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -110,6 +110,30 @@ def restart_glusterd(servers):
return True
+def reset_failed_glusterd(servers):
+ """Reset-failed glusterd on specified servers.
+
+ Args:
+ servers (str|list): A server|List of server hosts on which glusterd
+ has to be reset-failed.
+
+ Returns:
+ bool : True if reset-failed glusterd is successful on all servers.
+ False otherwise.
+ """
+ if not isinstance(servers, list):
+ servers = [servers]
+
+ cmd = "systemctl reset-failed glusterd"
+ results = g.run_parallel(servers, cmd)
+
+ for server, (retcode, _, _) in results.items():
+ if retcode:
+ g.log.error("Unable to reset glusterd on server %s", server)
+ return False
+ return True
+
+
def is_glusterd_running(servers):
"""Checks the glusterd status on specified servers.