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.

Note

Most methods require root permission

Description

arcapix.fs.gpfs.clib.quota.get_quota(const char *pathname, int type, int id)

Get information for a particular quota.

Parameters:
  • pathname (str) – pathname of any file within the filesystem to which the quota is to be applied
  • type (int) – Quota type - one of (Q_USR, Q_GRP, Q_FSET)
  • id (int) – Numerical id of the Quota
Returns:

information about filesystem usage and quota limits

Return type:

dict

arcapix.fs.gpfs.clib.quota.quota_off(const char *pathname, int type)

Disable quotas for the given filesystem and type.

Parameters:
  • pathname (str) – pathname of any file within the filesystem to which the quota is to be applied
  • type (int) – Quota type - one of (Q_USR, Q_GRP, Q_FSET)
arcapix.fs.gpfs.clib.quota.quota_on(const char *pathname, int type)

Enable quotas for the given filesystem and type.

Parameters:
  • pathname (str) – pathname of any file within the filesystem to which the quota is to be applied
  • type (int) – Quota type - one of (Q_USR, Q_GRP, Q_FSET)
arcapix.fs.gpfs.clib.quota.sync(const char *pathname, int type)

Synchronise the disk copy of the filesystem quotas.

Parameters:
  • pathname (str) – pathname of any file within the filesystem to which the quota is to be applied
  • type (int) – Quota type - one of (Q_USR, Q_GRP, Q_FSET)

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

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