summaryrefslogtreecommitdiffstats
path: root/glusternagios
diff options
context:
space:
mode:
Diffstat (limited to 'glusternagios')
-rwxr-xr-xglusternagios/glustercli.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/glusternagios/glustercli.py b/glusternagios/glustercli.py
index 0a126e7..03ea806 100755
--- a/glusternagios/glustercli.py
+++ b/glusternagios/glustercli.py
@@ -82,6 +82,12 @@ class VolumeStatus:
OFFLINE = 'OFFLINE'
+class VolumeQuotaStatus:
+ DISABLED = 'DISABLED'
+ OK = 'OK'
+ EXCEEDED = 'EXCEEDED'
+
+
class TransportType:
TCP = 'TCP'
RDMA = 'RDMA'
@@ -432,6 +438,30 @@ def volumeInfo(volumeName=None, remoteServer=None):
raise GlusterCmdFailedException(err=[etree.tostring(xmltree)])
+def _parseVolumeQuotaStatus(out):
+ for line in out:
+ if line.startswith('quota: No quota') or line.find('not enabled') > -1:
+ return VolumeQuotaStatus.DISABLED
+ if line.find('Yes') > -1:
+ return VolumeQuotaStatus.EXCEEDED
+ return VolumeQuotaStatus.OK
+
+
+def volumeQuotaStatus(volumeName, remoteServer=None):
+ """
+ Returns:
+ STATUS
+ """
+ command = _getGlusterVolCmd() + ["quota", volumeName, "list"]
+ if remoteServer:
+ command += ['--remote-host=%s' % remoteServer]
+
+ rc, out, err = _execGluster(command)
+ if rc == 0:
+ return _parseVolumeQuotaStatus(out)
+ raise GlusterCmdFailedException(rc, err)
+
+
def _parsePeerStatus(tree, gHostName, gUuid, gStatus):
hostList = [{'hostname': gHostName,
'uuid': gUuid,