distaflibs.gluster.rebalance_ops module¶
Description: Library for gluster rebalance operations.
-
distaflibs.gluster.rebalance_ops.rebalance_start(volname, mnode=None, fix_layout=False, force=False)¶ Starts rebalance on the given volume.
Example
rebalance_start(testvol)
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to nodes[0].
- fix_layout (bool) : If this option is set to True, then rebalance
- start will get execute with fix-layout option. If set to False, then rebalance start will get executed without fix-layout option
- force (bool): If this option is set to True, then rebalance
- start will get execute with force option. If it is set to False, then rebalance start will get executed without force option
Returns: 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.
Return type: tuple
-
distaflibs.gluster.rebalance_ops.rebalance_stop(volname, mnode=None)¶ Stops rebalance on the given volume.
Example
rebalance_stop(testvol)
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to nodes[0].
Returns: 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.
Return type: tuple
-
distaflibs.gluster.rebalance_ops.rebalance_status(volname, mnode=None)¶ Executes rebalance status on the given volume.
Example
rebalance_status(testvol)
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to nodes[0].
Returns: 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.
Return type: tuple
-
distaflibs.gluster.rebalance_ops.get_rebalance_status(volname, mnode=None)¶ - Parse the output of ‘gluster vol rebalance status’ command
- for the given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to nodes[0].
Returns: None if command execution fails, parse errors. dict: dict on success. rebalance status will be in dict formatReturn type: NoneType Examples
>>> get_rebalance_status(testvol, mnode = 'abc.lab.eng.xyz.com') {'node': [{'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '1', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', 'id': 'a2b88b10-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'in progress', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.152', 'failures': '0', 'runtime': '0.00', 'id': 'b15b8337-9f8e-4ec3-8bdb-200d6a67ae12', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.46.52', 'failures': '0', 'runtime': '0.00', 'id': '77dc299a-32f7-43d8-9977-7345a344c398', 'statusStr': 'completed', 'size': '0'}], 'task-id': 'a16f99d1-e165-40e7-9960-30508506529b', 'aggregate': {'files': '0', 'status': '1', 'lookups': '0', 'skipped': '0', 'failures': '0', 'runtime': '0.00', 'statusStr': 'in progress', 'size': '0'}, 'nodeCount': '4', 'op': '3'}
-
distaflibs.gluster.rebalance_ops.rebalance_stop_and_get_status(volname, mnode=None)¶ - Parse the output of ‘gluster vol rebalance stop’ command
- for the given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to nodes[0].
Returns: None if command execution fails, parse errors. dict: dict on success. rebalance status will be in dict formatReturn type: NoneType Examples
>>> rebalance_stop_and_get_status(testvol, mnode = 'abc.xyz.com') {'node': [{'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '1', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', 'id': 'a2b88b10-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'in progress', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.152', 'failures': '0', 'runtime': '0.00', 'id': 'b15b8337-9f8e-4ec3-8bdb-200d6a67ae12', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.46.52', 'failures': '0', 'runtime': '0.00', 'id': '77dc299a-32f7-43d8-9977-7345a344c398', 'statusStr': 'completed', 'size': '0'}], 'task-id': 'a16f99d1-e165-40e7-9960-30508506529b', 'aggregate': {'files': '0', 'status': '1', 'lookups': '0', 'skipped': '0', 'failures': '0', 'runtime': '0.00', 'statusStr': 'in progress', 'size': '0'}, 'nodeCount': '4', 'op': '3'}
-
distaflibs.gluster.rebalance_ops.wait_for_rebalance_to_complete(volname, mnode=None, timeout=300)¶ Waits for the rebalance to complete
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to nodes[0].
- timeout (int): timeout value in seconds to wait for rebalance
- to complete
Returns: True on success, False otherwise Examples
>>> wait_for_rebalance_to_complete("testvol")