summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster
diff options
context:
space:
mode:
authorVinayak Papnoi <vpapnoi@redhat.com>2018-01-19 15:34:47 +0530
committerNigel Babu <nigelb@redhat.com>2018-05-16 09:19:39 +0000
commit90e8a2812263e3d6195fb5a4f0debd3c35ae5c57 (patch)
tree7c79b012ee703aa86bb713be2d21c1b62a526c07 /glustolibs-gluster
parent163e6d0dbfd9de07d70babf751989050931ad0e2 (diff)
Quota : function to check quota-deem-statfs
Adding a function to check if quota-deem-statfs is enabled or not. quota-deem-statfs should be enabled by default when quota is enabled. Resolved merge conflit. Addressed comments Change-Id: Ifbae5b123f42da3fff28299630373f4060520769 Signed-off-by: Vinayak Papnoi <vpapnoi@redhat.com>
Diffstat (limited to 'glustolibs-gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/quota_ops.py43
1 files changed, 41 insertions, 2 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/quota_ops.py b/glustolibs-gluster/glustolibs/gluster/quota_ops.py
index 3a6ca89..314d6de 100644
--- a/glustolibs-gluster/glustolibs/gluster/quota_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/quota_ops.py
@@ -21,6 +21,7 @@
from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError, ExecutionParseError
+from glustolibs.gluster.volume_ops import get_volume_options
try:
import xml.etree.cElementTree as etree
@@ -95,8 +96,6 @@ def is_quota_enabled(mnode, volname):
is_quota_enabled(mnode, testvol)
"""
- from glustolibs.gluster.volume_ops import get_volume_options
-
output = get_volume_options(mnode, volname, "features.quota")
if output is None:
return False
@@ -109,6 +108,46 @@ def is_quota_enabled(mnode, volname):
return True
+def check_quota_deem_statfs(mnode, volname):
+ """Checks if quota-deem-statfs is enabled
+ on given volume
+
+ Args:
+ mnode (str): Node on which cmd has to be executed.
+ volname (str): volume name
+
+ Returns:
+ bool: True, if quota-deem-statfs is enabled
+ False, if quota-deem-statfs is disabled
+
+ Example:
+ check_quota_deem_statfs(mnode, testvol)
+ """
+
+ output = get_volume_options(mnode, volname,
+ "features.quota-deem-statfs")
+ if not output:
+ g.log.error("Failed to get current status of "
+ "'features.quota-deem-statfs' option "
+ "for volume %s", volname)
+ return False
+
+ g.log.info("Quota deem-statfs status in volume %s: %s",
+ volname, output["features.quota-deem-statfs"])
+
+ if 'features.quota-deem-statfs' in output.keys():
+ if output['features.quota-deem-statfs'] == 'on':
+ g.log.info("Volume option 'features.quota-deem-statfs' "
+ "is currently enabled for volume %s", volname)
+ return True
+ g.log.info("Volume option 'features.quota-deem-statfs' "
+ "is not in enabled state for volume %s", volname)
+ return False
+ g.log.error("Failed to get status of 'features.quota-deem-statfs' "
+ "option for the volume %s", volname)
+ return False
+
+
def quota_list(mnode, volname, path=None):
"""Executes quota list command for given volume