Quota Functions
The quota
module provides methods which allow users to determine and manipulate the quotas on a PixStor Filesystem.
CLib’s File Functions provide faster operation than the equivalent
ArcaPix PixStor Python API Quota
and Quotas
methods.
Note
Most methods require root permission
Description
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.
- arcapix.fs.gpfs.clib.quota.get_quota(pathname, int type, int id)
Get information for a particular quota.
- arcapix.fs.gpfs.clib.quota.quota_off(pathname, int type)
Disable quotas for the given filesystem and type.
- arcapix.fs.gpfs.clib.quota.quota_on(pathname, int type)
Enable quotas for the given filesystem and type.
Examples
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
Hint
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'])
0