summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/utils/rbutils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/utils/rbutils.py b/libs/utils/rbutils.py
new file mode 100644
index 0000000..0b67777
--- /dev/null
+++ b/libs/utils/rbutils.py
@@ -0,0 +1,27 @@
+""" Utilities for Replace Brick Testing
+"""
+import time
+import atfutils
+import glusterutils
+
+def wait_till_rb_completes(timeout, serverkey, from_brick, to_brick,
+ expected_message="migration complete"):
+ """
+ Description: Wait till the replace brick operation completes.
+ Parameters:
+ timeout: The wait period to check the status of replace brick.
+ serverkey : server on which the replace brick status has to be checked.
+ from_brick : replace brick operation on from_brick
+ to_brick : replace brick operation on to_brick
+ """
+ operation = "status"
+ time.sleep(timeout)
+ output = glusterutils.volume_replacebrick(serverkey, from_brick,
+ to_brick, operation)
+ validation_status = atfutils.validate_output(output, 0, expected_message)
+ if validation_status is not 0:
+ rb_completion_status = 1
+ else:
+ rb_completion_status = 0
+
+ return rb_completion_status