Quota Functions

The quota module provides methods which allow users to determine and manipulate the quotas on a GPFS Filesystem.

CLib’s File Functions provide faster operation than the equivalent ArcaPix GPFS Python API Quota and Quotas methods.


Most methods require root permission


get_quota fields

The get_quota() function returns a dict with the following fields

blockUsage       # current block count in 1 KB units
blockHardLimit   # absolute limit on disk blocks allocated
blockSoftLimit   # preferred limit on disk blocks
blockInDoubt     # distributed shares + "lost" usage for blocks
inodeUsage       # current number of allocated inodes
inodeHardLimit   # absolute limit on allocated inodes
inodeSoftLimit   # preferred inode limit
inodeInDoubt     # distributed shares + "lost" usage for inodes
quoId            # uid, gid or fileset id
blockGraceTime   # time limit for excessive disk use
inodeGraceTime   # time limit for excessive inode use

All fields are type int.


Lookup Attributes of the root fileset quota

>>> from arcapix.fs.gpfs.clib.quota import get_quota, Q_FSET
>>> # get quota dict for root fileset
... q = get_quota('/mmfs1', Q_FSET, 0)
>>> print "Usage: blocks=%s, inodes=%s" % q['blockUsage'], q['inodeUsage']
Usage: blocks=384, inodes=9


You can get the id for a named fileset using the arcapix.fs.gpfs.clib.utils.getfilesetid() function

>>> from arcapix.fs.gpfs.clib.utils import getfilesetid
>>> get_quota('/mmfs1', Q_FSET, getfilesetid('/mmfs1', 'myfset'))

Enable User Quotas

>>> from arcapix.fs.gpfs.clib.quota import quota_on, Q_USR
>>> # enable quotas
... quota_on('/mmfs1', Q_USR)

Get a Group Quota by id

>>> from arcapix.fs.gpfs.clib.quota import get_quota, Q_GRP
>>> # get quota dict for root group
... q = get_quota('/mmfs1', Q_GRP, 0)
>>> print q['blockHardLimit']