distaflibs.gluster.quota_ops module¶
Description: Library for gluster quota operations.
-
distaflibs.gluster.quota_ops.enable_quota(volname, mnode=None)¶ Enables quota 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
enable_quota(testvol)
-
distaflibs.gluster.quota_ops.disable_quota(volname, mnode=None)¶ Disables quota 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
disable_quota(testvol)
-
distaflibs.gluster.quota_ops.is_quota_enabled(volname, mnode=None)¶ Checks if quota is enabled 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: True, if quota is enabled False, if quota is disabled Return type: bool Example
is_quota_enabled(testvol)
-
distaflibs.gluster.quota_ops.quota_list(volname, mnode=None)¶ Executes quota list command for 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
quota_list(testvol)
-
distaflibs.gluster.quota_ops.set_quota_limit_usage(volname, path='/', limit='100GB', soft_limit='', mnode=None)¶ - Sets limit-usage on the path of the specified volume to
- specified limit
Parameters: volname (str) – volume name - Kwargs:
- path (str): path to which quota limit usage is set.
- Defaults to /.
limit (str): quota limit usage. defaults to 100GB soft_limit (str): quota soft limit to be set mnode (str): Node on which command 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 Examples
>>> set_quota_limit_usage("testvol")
-
distaflibs.gluster.quota_ops.get_quota_list(volname, mnode=None)¶ Parse the output of ‘gluster quota list’ 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_quota_list("testvol", mnode = 'abc.lab.eng.xyz.com') {'/': {'used_space': '0', 'hl_exceeded': 'No', 'soft_limit_percent': '60%', 'avail_space': '2147483648', 'soft_limit_value': '1288490188', 'sl_exceeded': 'No', 'hard_limit': '2147483648'}}
-
distaflibs.gluster.quota_ops.set_quota_limit_objects(volname, path='/', limit='10', soft_limit='', mnode=None)¶ - Sets limit-objects on the path of the specified volume to
- specified limit
Parameters: volname (str) – volume name - Kwargs:
- path (str): path to which quota limit usage is set.
- Defaults to /.
limit (str): quota limit objects. defaults to 10. soft_limit (str): quota soft limit to be set mnode (str): Node on which command 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 Examples
>>> set_quota_limit_objects("testvol")
-
distaflibs.gluster.quota_ops.quota_list_objects(volname, mnode=None)¶ Executes quota list command for 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
quota_list_objects(testvol)
-
distaflibs.gluster.quota_ops.get_quota_list_objects(volname, mnode=None)¶ Parse the output of ‘gluster quota list-objects’ 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 of dict on success. Return type: NoneType Examples
>>> get_quota_list_objects("testvol", mnode = 'abc.lab.eng.xyz.com') {'/': {'available': '7', 'hl_exceeded': 'No', 'soft_limit_percent': '80%', 'soft_limit_value': '8', 'dir_count': '3', 'sl_exceeded': 'No', 'file_count': '0', 'hard_limit': '10'}}
-
distaflibs.gluster.quota_ops.set_quota_alert_time(volname, time, mnode=None)¶ Sets quota alert time
Parameters: volname (str) – volume name - Kwargs:
time (str): quota limit usage. defaults to 100GB mnode (str): Node on which command 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 Examples
>>> set_quota_alert_time("testvol", <alert time>)
-
distaflibs.gluster.quota_ops.set_quota_soft_timeout(volname, timeout, mnode=None)¶ Sets quota soft timeout
Parameters: volname (str) – volume name - Kwargs:
timeout (str): quota soft limit timeout value mnode (str): Node on which command 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 Examples
>>> set_quota_soft_timeout("testvol", <timeout-value>)
-
distaflibs.gluster.quota_ops.set_quota_hard_timeout(volname, timeout, mnode=None)¶ Sets quota hard timeout
Parameters: - volname (str) – volume name
- timeout (str) – quota hard limit timeout value
- Kwargs:
- mnode (str): Node on which command 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 Examples
>>> set_quota_hard_timeout("testvol", <timeout-value>)
-
distaflibs.gluster.quota_ops.set_quota_default_soft_limit(volname, timeout, mnode=None)¶ Sets quota default soft limit
Parameters: - volname (str) – volume name
- timeout (str) – quota soft limit timeout value
- Kwargs:
- mnode (str): Node on which command 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 Examples
>>> set_quota_default_soft_limit("testvol", <timeout-value>)
-
distaflibs.gluster.quota_ops.remove_quota(volname, path, mnode=None)¶ Removes quota for the given path
Parameters: - volname (str) – volume name
- path (str) – path to which quota limit usage is set. Defaults to /.
- Kwargs:
- mnode (str): Node on which command 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 Examples
>>> remove_quota("testvol", <path>)
-
distaflibs.gluster.quota_ops.remove_quota_objects(volname, path, mnode=None)¶ Removes quota objects for the given path
Parameters: - volname (str) – volume name
- path (str) – path to which quota limit usage is set. Defaults to /.
- Kwargs:
- mnode (str): Node on which command 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 Examples
>>> remove_quota_objects("testvol", <path>)