summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/heal_libs.py
diff options
context:
space:
mode:
authorBala Konda Reddy M <bala12352@gmail.com>2020-08-21 16:06:46 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-08-21 11:25:23 +0000
commit7a7fb5b820d7d418384fb1af5ead3d7b3d31535d (patch)
treefa6defa9e24660aa3152bfa881ae0126bacb67ad /glustolibs-gluster/glustolibs/gluster/heal_libs.py
parent2fc4502768e25ff1248f5c1f2217bea201bdae95 (diff)
[Libfix] Add interval_check for monitor_heal_completion
Adding a parameter `interval_check` will ease the user and help in the reducing the waiting time for heal in scenarios. By default, ls -l <brickpath> | grep -ve "xattrop-" | wc -l is checked for every 2 minutes. Problem: I have 100 files that needs to be healed, after 2 minutes. suppose there are only 2/3 files that needs to be healed. With the existing approach the next check will wait for whole 2 minutes even though the files would have healed by 10 seconds after previouscheck. Solution: Giving an option for the user to check at which interval to check for the files that needs to healed, we can reduce the unnecssary waiting time. It won't affect the existing cases as the interval_check is defaults to 120. Change-Id: Ib288c75549644b6f6c94b5288f1c07cce7933915 Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/heal_libs.py')
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/heal_libs.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/heal_libs.py b/glustolibs-gluster/glustolibs/gluster/heal_libs.py
index 6c4ff709f..91d720e41 100755
--- a/glustolibs-gluster/glustolibs/gluster/heal_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/heal_libs.py
@@ -135,7 +135,8 @@ def are_all_self_heal_daemons_are_online(mnode, volname):
return False
-def monitor_heal_completion(mnode, volname, timeout_period=1200, bricks=None):
+def monitor_heal_completion(mnode, volname, timeout_period=1200,
+ bricks=None, interval_check=120):
"""Monitors heal completion by looking into .glusterfs/indices/xattrop
directory of every brick for certain time. When there are no entries
in all the brick directories then heal is successful. Otherwise heal is
@@ -150,6 +151,8 @@ def monitor_heal_completion(mnode, volname, timeout_period=1200, bricks=None):
Kwargs:
bricks : list of bricks to monitor heal, if not provided
heal will be monitored on all bricks of volume
+ interval_check : Time in seconds, for every given interval checks
+ the heal info, defaults to 120.
Return:
bool: True if heal is complete within timeout_period. False otherwise
@@ -181,8 +184,8 @@ def monitor_heal_completion(mnode, volname, timeout_period=1200, bricks=None):
if heal_complete:
break
else:
- time.sleep(120)
- time_counter = time_counter - 120
+ time.sleep(interval_check)
+ time_counter = time_counter - interval_check
if heal_complete and bricks:
# In EC volumes, check heal completion only on online bricks