From 4d4559b77e83397f320a37164c9c2277a36db36a Mon Sep 17 00:00:00 2001 From: sayaleeraut Date: Tue, 9 Jun 2020 19:32:55 +0530 Subject: [Lib] Add method set_rebalance_throttle() The method takes mnode, volname and throttle-type as parameters. It sets the rebal-throttle for the volume as per the mentioned throttle-type. Change-Id: I9eb14e39f87158c9ae7581636c2cad1333fd573c Signed-off-by: sayaleeraut --- .../glustolibs/gluster/rebalance_ops.py | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'glustolibs-gluster/glustolibs/gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py b/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py index d74a04629..1011c89c6 100644 --- a/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py @@ -444,3 +444,33 @@ def wait_for_remove_brick_to_complete(mnode, volname, bricks_list, g.log.error("Remove brick operation has not completed. " "Wait timeout is %s" % count) return False + + +def set_rebalance_throttle(mnode, volname, throttle_type='normal'): + """Sets rebalance throttle + + Args: + mnode (str): Node on which cmd has to be executed. + volname (str): volume name + + Kwargs: + throttle_type (str): throttling type (lazy|normal|aggressive) + Defaults to 'normal' + + Returns: + tuple: Tuple containing three elements (ret, out, err). + The first element 'ret' is of type 'int' and is the return value + of command execution. + + The second element 'out' is of type 'str' and is the stdout value + of the command execution. + + The third element 'err' is of type 'str' and is the stderr value + of the command execution. + + Example: + set_rebalance_throttle(mnode, testvol, throttle_type='aggressive') + """ + cmd = ("gluster volume set {} rebal-throttle {}".format + (volname, throttle_type)) + return g.run(mnode, cmd) -- cgit