summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/volume_libs.py
diff options
context:
space:
mode:
authorShwethaHP <spandura@redhat.com>2017-12-15 14:58:06 +0530
committerJonathan Holloway <jholloway@redhat.com>2018-01-11 06:47:49 +0000
commitfaf5077586ab5c631524a434533da4e46f25abae (patch)
treee7c77a998aa2656f0728acffc4d20d4e313b1834 /glustolibs-gluster/glustolibs/gluster/volume_libs.py
parentd6d816ef4013f754c75c29158b46644823daec4f (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/volume_libs.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/volume_libs.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py
index c62839778..5b668350e 100644
--- a/glustolibs-gluster/glustolibs/gluster/volume_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/volume_libs.py
@@ -37,7 +37,9 @@ from glustolibs.gluster.quota_ops import (enable_quota, set_quota_limit_usage,
is_quota_enabled)
from glustolibs.gluster.uss_ops import enable_uss, is_uss_enabled
from glustolibs.gluster.snap_ops import snap_delete_by_volumename
-from glustolibs.gluster.heal_libs import are_all_self_heal_daemons_are_online
+from glustolibs.gluster.heal_libs import (
+ are_all_self_heal_daemons_are_online,
+ wait_for_self_heal_daemons_to_be_online)
from glustolibs.gluster.brick_ops import add_brick, remove_brick, replace_brick
@@ -1827,3 +1829,43 @@ def get_client_quorum_info(mnode, volname):
['quorum_count']) = quorum_count
return client_quorum_dict
+
+
+def wait_for_volume_process_to_be_online(mnode, volname, timeout=300):
+ """Waits for the volume's processes 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 all volume
+ processes to be online.
+
+ Returns:
+ True if the volume's processes are online within timeout,
+ False otherwise
+ """
+ # Adding import here to avoid cyclic imports
+ from glustolibs.gluster.brick_libs import wait_for_bricks_to_be_online
+
+ # Wait for bricks to be online
+ bricks_online_status = wait_for_bricks_to_be_online(mnode, volname,
+ timeout)
+ if bricks_online_status is False:
+ g.log.error("Failed to wait for the volume '%s' processes "
+ "to be online", volname)
+ return False
+
+ # Wait for self-heal-daemons to be online
+ self_heal_daemon_online_status = (
+ wait_for_self_heal_daemons_to_be_online(mnode, volname, timeout))
+ if self_heal_daemon_online_status is False:
+ g.log.error("Failed to wait for the volume '%s' processes "
+ "to be online", volname)
+ return False
+
+ # TODO: Add any process checks here
+
+ g.log.info("Volume '%s' processes are all online", volname)
+ return True