summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorsayaleeraut <saraut@redhat.com>2020-06-09 19:32:55 +0530
committerSayalee Raut <saraut@redhat.com>2020-06-09 17:25:28 +0000
commit4d4559b77e83397f320a37164c9c2277a36db36a (patch)
tree3f33b31d966472477bd2d4622dd1174992165cad /glustolibs-gluster/glustolibs/gluster
parent1fe33a91d801208218bd64123390213a28b8876c (diff)
[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 <saraut@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/rebalance_ops.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py b/glustolibs-gluster/glustolibs/gluster/rebalance_ops.py
index d74a046..1011c89 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)