diff options
author | ShwethaHP <spandura@redhat.com> | 2017-12-15 14:58:06 +0530 |
---|---|---|
committer | Jonathan Holloway <jholloway@redhat.com> | 2018-01-11 06:47:49 +0000 |
commit | faf5077586ab5c631524a434533da4e46f25abae (patch) | |
tree | e7c77a998aa2656f0728acffc4d20d4e313b1834 /glustolibs-gluster/glustolibs/gluster/heal_libs.py | |
parent | d6d816ef4013f754c75c29158b46644823daec4f (diff) |
Adding functions for:
1. Waiting for all bricks to be online
2. Waiting for all self-heal-daemons to be online
3. Waiting for all volume processes to be online
Change-Id: I01a8711838227eb167e69710ecbd3abd0fecb9e6
Signed-off-by: ShwethaHP <spandura@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/heal_libs.py')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/heal_libs.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/heal_libs.py b/glustolibs-gluster/glustolibs/gluster/heal_libs.py index 10707df63..5ccb4b2b4 100644 --- a/glustolibs-gluster/glustolibs/gluster/heal_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/heal_libs.py @@ -269,3 +269,39 @@ def get_unhealed_entries_info(volname, mnode=''): False otherwise """ return True + + +def wait_for_self_heal_daemons_to_be_online(mnode, volname, timeout=300): + """Waits for the volume self-heal-daemons to be online until timeout + + Args: + mnode (str): Node on which commands will be executed. + volname (str): Name of the volume. + + Kwargs: + timeout (int): timeout value in seconds to wait for self-heal-daemons + to be online. + + Returns: + True if all self-heal-daemons are online within timeout, + False otherwise + """ + counter = 0 + flag = 0 + while counter < timeout: + status = are_all_self_heal_daemons_are_online(mnode, volname) + if status: + flag = 1 + break + if not status: + time.sleep(10) + counter = counter + 10 + + if not flag: + g.log.error("All self-heal-daemons of the volume '%s' are not online " + "even after %d minutes", (volname, timeout/60.0)) + return False + else: + g.log.info("All self-heal-daemons of the volume '%s' are online ", + volname) + return True |