From faf5077586ab5c631524a434533da4e46f25abae Mon Sep 17 00:00:00 2001 From: ShwethaHP Date: Fri, 15 Dec 2017 14:58:06 +0530 Subject: 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 --- glustolibs-gluster/glustolibs/gluster/heal_libs.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'glustolibs-gluster/glustolibs/gluster/heal_libs.py') 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 -- cgit