distaflibs.gluster.tiering_ops module¶
Description: Library for gluster tiering operations.
-
distaflibs.gluster.tiering_ops.add_peer_nodes_to_cluster(peers, mnode=None)¶ Adds the given peer nodes to cluster
Parameters: peers (list) – list of peer nodes to be attached to cluster - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[0].
Returns: True, if peer nodes are attached to cluster False, otherwise Return type: bool Example
add_peer_nodes_to_cluster([‘peer_node1’,’peer_node2’])
-
distaflibs.gluster.tiering_ops.tier_attach(volname, num_bricks_to_add, peers, replica=1, force=False, mnode=None)¶ Attaches tier to the volume
Parameters: - volname (str) – volume name
- num_bricks_to_add (str) – number of bricks to be added as hot tier
- peers (list) – from these servers, hot tier will be added to volume
- Kwargs:
replica (str): replica count of the hot tier force (bool): If this option is set to True, then attach tier
will get executed with force option. If it is set to False, then attach tier will get executed without force option- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_attach(testvol, ‘2’, [‘peer_node1’,’peer_node2’])
-
distaflibs.gluster.tiering_ops.tier_start(volname, force=False, mnode=None)¶ Starts the tier volume
Parameters: volname (str) – volume name - Kwargs:
- force (bool): If this option is set to True, then attach tier
- will get executed with force option. If it is set to False, then attach tier will get executed without force option
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_start(testvol)
-
distaflibs.gluster.tiering_ops.tier_status(volname, mnode=None)¶ executes tier status command
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_status(testvol)
-
distaflibs.gluster.tiering_ops.get_tier_status(volname, mnode=None)¶ Parse the output of ‘gluster tier status’ command.
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to servers[0].
Returns: None if command execution fails, parse errors. dict: dict on success. Return type: NoneType Examples
>>> get_tier_status(mnode = 'abc.lab.eng.xyz.com') {'node': [{'promotedFiles': '0', 'demotedFiles': '0', 'nodeName': 'localhost', 'statusStr': 'in progress'}, {'promotedFiles': '0', 'demotedFiles': '0', 'nodeName': '10.70.47.16', 'statusStr': 'in progress'}], 'task-id': '2ed28cbd-4246-493a-87b8-1fdcce313b34', 'nodeCount': '4', 'op': '7'}
-
distaflibs.gluster.tiering_ops.tier_detach_start(volname, mnode=None)¶ starts detaching tier on given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_detach_start(testvol)
-
distaflibs.gluster.tiering_ops.tier_detach_status(volname, mnode=None)¶ executes detach tier status on given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_detach_status(testvol)
-
distaflibs.gluster.tiering_ops.tier_detach_stop(volname, mnode=None)¶ stops detaching tier on given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_detach_stop(testvol)
-
distaflibs.gluster.tiering_ops.tier_detach_commit(volname, mnode=None)¶ commits detach tier on given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_detach_commit(testvol)
-
distaflibs.gluster.tiering_ops.tier_detach_force(volname, mnode=None)¶ detaches tier forcefully on given volume
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which cmd has to be executed.
- If None, defaults to servers[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 Example
tier_detach_force(testvol)
-
distaflibs.gluster.tiering_ops.get_detach_tier_status(volname, mnode=None)¶ Parse the output of ‘gluster volume tier detach status’ command.
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to servers[0].
Returns: None if command execution fails, parse errors. dict: dict on success. Return type: NoneType Examples
>>> get_detach_tier_status("testvol", mnode = 'abc.lab.eng.xyz.com') {'node': [{'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', 'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', 'id': 'a2b88b10-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'completed', 'size': '0'}], 'nodeCount': '4', 'aggregate': {'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', 'failures': '0', 'runtime': '0.0', 'statusStr': 'completed', 'size': '0'}}
-
distaflibs.gluster.tiering_ops.tier_detach_start_and_get_taskid(volname, mnode=None)¶ Parse the output of ‘gluster volume tier detach start’ command.
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to servers[0].
Returns: None if command execution fails, parse errors. dict: dict on success. Return type: NoneType Examples
>>> tier_detach_start_and_get_taskid("testvol", mnode = 'abc.lab.eng.xyz.com') {'task-id': '8020835c-ff0d-4ea1-9f07-62dd067e92d4'}
-
distaflibs.gluster.tiering_ops.tier_detach_stop_and_get_status(volname, mnode=None)¶ Parse the output of ‘gluster volume tier detach stop’ command.
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to servers[0].
Returns: None if command execution fails, parse errors. dict: dict on success. Return type: NoneType Examples
>>> tier_detach_stop_and_get_status("testvol", mnode = 'abc.lab.eng.xyz.com') {'node': [{'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', 'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', 'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', 'id': 'a2b88b12-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'completed', 'size': '0'}], 'nodeCount': '4', 'aggregate': {'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', 'failures': '0', 'runtime': '0.0', 'statusStr': 'completed', 'size': '0'}}
-
distaflibs.gluster.tiering_ops.wait_for_detach_tier_to_complete(volname, mnode=None, timeout=300)¶ Waits for the detach tier to complete
Parameters: volname (str) – volume name - Kwargs:
- mnode (str): Node on which command has to be executed.
- If None, defaults to servers[0].
timeout (int): timeout value to wait for detach tier to complete
Returns: True on success, False otherwise Examples
>>> wait_for_detach_tier_to_complete("testvol")
-
distaflibs.gluster.tiering_ops.get_files_from_hot_tier(volname)¶ Lists files from hot tier for the given volume
Parameters: volname (str) – volume name Returns: if there are no files in hot tier. list: list of files in hot tier on success. Return type: Emptylist Examples
>>>get_files_from_hot_tier(“testvol”)
-
distaflibs.gluster.tiering_ops.get_files_from_cold_tier(volname)¶ Lists files from cold tier for the given volume
Parameters: volname (str) – volume name Returns: if there are no files in cold tier. list: list of files in cold tier on success. Return type: Emptylist Examples
>>>get_files_from_hot_tier(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_promote_frequency(volname)¶ Gets tier promote frequency value for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: promote frequency value on success. Return type: NoneType Examples
>>>get_tier_promote_frequency(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_demote_frequency(volname)¶ Gets tier demote frequency value for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: demote frequency value on success. Return type: NoneType Examples
>>>get_tier_demote_frequency(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_mode(volname)¶ Gets tier mode for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: tier mode on success. Return type: NoneType Examples
>>>get_tier_mode(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_max_mb(volname)¶ Gets tier max mb for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: tier max mb on success. Return type: NoneType Examples
>>>get_tier_max_mb(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_max_files(volname)¶ Gets tier max files for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: tier max files on success. Return type: NoneType Examples
>>>get_tier_max_files(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_watermark_high_limit(volname)¶ Gets tier watermark high limit for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: tier watermark high limit on success. Return type: NoneType Examples
>>>get_tier_watermark_high_limit(“testvol”)
-
distaflibs.gluster.tiering_ops.get_tier_watermark_low_limit(volname)¶ Gets tier watermark low limit for given volume.
Parameters: volname (str) – volume name Returns: None if command execution fails, parse errors. str: tier watermark low limit on success. Return type: NoneType Examples
>>>get_tier_watermark_low_limit(“testvol”)
-
distaflibs.gluster.tiering_ops.set_tier_promote_frequency(volname, value)¶ Sets tier promote frequency value for given volume.
Parameters: - volname (str) – volume name
- value (str) – promote frequency value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_promote_frequency(“testvol”, ‘1000’)
-
distaflibs.gluster.tiering_ops.set_tier_demote_frequency(volname, value)¶ Sets tier demote frequency value for given volume.
Parameters: - volname (str) – volume name
- value (str) – demote frequency value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_demote_frequency(“testvol”, “500”)
-
distaflibs.gluster.tiering_ops.set_tier_mode(volname, value)¶ Sets tier mode for given volume.
Parameters: - volname (str) – volume name
- value (str) – tier mode value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_mode(“testvol”, “cache”)
-
distaflibs.gluster.tiering_ops.set_tier_max_mb(volname, value)¶ Sets tier max mb for given volume.
Parameters: - volname (str) – volume name
- value (str) – tier mode value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_max_mb(“testvol”, “50”)
-
distaflibs.gluster.tiering_ops.set_tier_max_files(volname, value)¶ Sets tier max files for given volume.
Parameters: - volname (str) – volume name
- value (str) – tier mode value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_max_files(“testvol”, “10”)
-
distaflibs.gluster.tiering_ops.set_tier_watermark_high_limit(volname, value)¶ Sets tier watermark high limit for given volume.
Parameters: - volname (str) – volume name
- value (str) – tier mode value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_watermark_high_limit(“testvol”, “95”)
-
distaflibs.gluster.tiering_ops.set_tier_watermark_low_limit(volname, value)¶ Sets tier watermark low limit for given volume.
Parameters: - volname (str) – volume name
- value (str) – tier mode value
Returns: True on success, False Otherwise
Return type: bool
Examples
>>>set_tier_watermark_low_limit(“testvol”, “40”)
-
distaflibs.gluster.tiering_ops.get_tier_pid(volname, mnode)¶ Gets tier pid for given volume.
Parameters: - volname (str) – volume name
- mnode (str) – Node on which command has to be executed.
Returns: None if command execution fails, parse errors. str: pid of tier process on success.
Return type: NoneType
Examples
>>>get_tier_pid(“testvol”, “abc.xyz.com”)
-
distaflibs.gluster.tiering_ops.is_tier_process_running(volname, mnode)¶ Checks whether tier process is running
Parameters: - volname (str) – volume name
- mnode (str) – Node on which command has to be executed.
Returns: True on success, False otherwise
Examples
>>>is_tier_process_running(“testvol”, “abc.xyz.com”)