path: root/glustolibs-gluster/glustolibs/gluster/
diff options
authorkshithijiyer <>2020-06-17 13:37:38 +0530
committerkshithijiyer <>2020-06-17 17:52:10 +0530
commit7a33280b5ef65edb8845a19332938c69e1fea003 (patch)
tree8f6641182e9649d8efc6c56d93220995987183dc /glustolibs-gluster/glustolibs/gluster/
parentd5e3ddbb0b16e4143d6b2cb772d485bb044abfcd (diff)
[Libfix] Add retry logic to restart_glusterd()
Problem: Patch [1] and [2] sent to glusterfs where changes are made to to not allow glusterd restart for more than 6 times within an hour, due this glusterd restarts present in testcases may fail as there is no way to figure out when we reach the 6 restart limit. Fix: Add code to check if glusterd restart has failed if true then call reset_failed_glusterd(), and redo the restart. Links: [1] [2] Change-Id: I041a019f9a8757d8fead00302e6bbcd6563dc74e Signed-off-by: kshithijiyer <>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/')
1 files changed, 11 insertions, 5 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/ b/glustolibs-gluster/glustolibs/gluster/
index 6e6b5aaf7..fd8f174ed 100644
--- a/glustolibs-gluster/glustolibs/gluster/
+++ b/glustolibs-gluster/glustolibs/gluster/
@@ -81,13 +81,17 @@ def stop_glusterd(servers):
return True
-def restart_glusterd(servers):
+def restart_glusterd(servers, enable_retry=True):
"""Restart the glusterd on specified servers.
servers (str|list): A server|List of server hosts on which glusterd
has to be restarted.
+ Kwargs:
+ enable_retry(Bool): If set to True than runs reset-failed else
+ do nothing.
bool : True if restarting glusterd is successful on all servers.
False otherwise.
@@ -104,10 +108,12 @@ def restart_glusterd(servers):
if retcode != 0:
g.log.error("Unable to restart glusterd on server %s", server)
_rc = False
- if not _rc:
- return False
- return True
+ if not _rc and enable_retry:
+ ret = reset_failed_glusterd(servers)
+ if ret:
+ ret = restart_glusterd(servers)
+ return ret
+ return _rc
def reset_failed_glusterd(servers):