path: root/glustolibs-gluster/glustolibs/gluster/
diff options
authorsrijan-sivakumar <>2020-11-26 11:05:46 +0530
committerArthy Loganathan <>2020-11-27 05:06:33 +0000
commitc5934fee66faa516ba495c32f7ec62d10b9301fd (patch)
tree4526917563c508e50f1d531d8c4aa3060e46a8b7 /glustolibs-gluster/glustolibs/gluster/
parent286512294dd2b1829743b718dd5db671342ba06e (diff)
[LibFix] Adding retry for start_glusterd
Issue: Glusterd start fails after repeated start and stop. ( Due to the cap on maximum of 6 starts of the service within an hour ) Fix: Hence it is prudent to add the retry option similar to that of restart_glusterd so as to run `systemctl reset-failed glusterd` on the servers. Change-Id: Ic0378934623dfa6dc5ab265246c746269f6995bc Signed-off-by: srijan-sivakumar <>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/')
1 files changed, 11 insertions, 4 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/ b/glustolibs-gluster/glustolibs/gluster/
index d6740b773..6a49ffc8b 100644
--- a/glustolibs-gluster/glustolibs/gluster/
+++ b/glustolibs-gluster/glustolibs/gluster/
@@ -23,13 +23,17 @@ from time import sleep
from glusto.core import Glusto as g
-def start_glusterd(servers):
+def start_glusterd(servers, enable_retry=True):
"""Starts glusterd on specified servers if they are not running.
servers (str|list): A server|List of server hosts on which glusterd
has to be started.
+ Kwargs:
+ enable_retry(Bool): If set to True then runs reset-failed else
+ do nothing.
bool : True if starting glusterd is successful on all servers.
False otherwise.
@@ -46,10 +50,13 @@ def start_glusterd(servers):
if retcode != 0:
g.log.error("Unable to start glusterd on server %s", server)
_rc = False
- if not _rc:
- return False
+ if not _rc and enable_retry:
+ ret = reset_failed_glusterd(servers)
+ if ret:
+ ret = start_glusterd(servers)
+ return ret
- return True
+ return _rc
def stop_glusterd(servers):