summaryrefslogtreecommitdiffstats
path: root/libs/utils/rbutils.py
blob: 0b6777764c4fd212814373d8978a9f5e2821d9a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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