Quotas

The Quotas Collection (which is exclusively accessible via Filesystem and Fileset objects and cannot be manually instantiated) provides access to the various Quota objects related to the parent object.

It is a dict which is indexed via the name of the quota (i.e. group, user or fileset name). However, if the name is ambiguous, access should be made via the relevant convenience map, group, user or fileset.

Description

arcapix.fs.gpfs.quotas.setEagerQuotas()

Cause all Quota access for this session to be eager.

See GPFS documentation for the meaning of eager in this context

arcapix.fs.gpfs.quotas.setVisibleNullQuotas()

Normally the quota collections do not return ‘null’ quota’s

i.e. they do not report an object for Users when there is no explicit quota set.

Call this method to change this behaviour for this session so that all quota’s reported by mmrepquota etc. are returned regardless

class arcapix.fs.gpfs.quotas.Quotas(deviceName, filesetName=None)

The Quotas collection represents quotas on the filesystem, or restricted to a particular fileset.

Whilst this is a mapping, quota keys can be non-unique in the case when there is both a group and a user quota of the same name, so access is best achieved via the .group and .user convenience properties

Parameters:
  • deviceName – Name of the filesystem to get quotas for
  • filesetName – Name of the fileset to get quotas for, or None to get global quotas
group

Returns a filtered view of the quotas including only those regarding GROUP’s

Return type:Mapping
user

Returns a filtered view of the quotas including only those regarding USER’s

Return type:Mapping
fileset

Returns the fileset quota for this fileset

Return type:FilesetQuota

Examples

Working with quotas via the Cluster object

>>> from arcapix.fs.gpfs import Cluster
>>>
>>> # List all user quotas for Filesystem mmfs1
>>> for q in Cluster().filesystems["mmfs1"].quotas.user.values()
...     print q.name, q.blockSoftLimit
...
>>> # List all group quotas for all filesets on Filesystem mmfs1
... for fset in Cluster().filesystems["mmfs1"].filesets.values():
...     for q in fset.quotas.group.values()
...         print fset.name, q.name, q.blockHardLimit
...
>>> # Examine the fileset quota (for all filesets that have one set)
... for fset in Cluster().filesystems["mmfs1"].filesets.values():
...     if fset.quotas.fileset is not None:
...         print fset.quotas.fileset
...

Working with quotas directly

>>> from arcapix.fs.gpfs.quotas import Quotas, setVisibleNullQuotas
>>>
>>> # Including Quotas not explicitly defined for a specific fileset
... setVisibleNullQuotas()
>>>
>>> # List all group quotas from filesystem mmfs1
... for x in Quotas("mmfs1", "fileset").group.values():
...     print x.name, x.blockHardLimit
...
>>> # List total allocated user quotas for specific fileset
... # (i.e. space requirement if all users fill their quota)
... print sum(x.blockHardLimit for x in Quotas("mmfs1").user.values())