Package syspolicy :: Package modules :: Module quota
[hide private]
[frames] | no frames]

Module quota

source code

Quota configuration support

Classes [hide private]
  Quota
This module provides Linux quota configuration support for SysPolicy.
Functions [hide private]
 
extract_quota(limits)
This function extracts the quota definition from either a string or a list and returns a dictionary of detected values, which are directly suitable for passing on to the set_quota operation.
source code
 
kilobytes(sizestr)
This function converts a text-based size specification to kilobytes.
source code
Variables [hide private]
  SETQUOTA = '/usr/sbin/setquota'
  __package__ = 'syspolicy.modules'
Function Details [hide private]

extract_quota(limits)

source code 

This function extracts the quota definition from either a string or a list and returns a dictionary of detected values, which are directly suitable for passing on to the set_quota operation.

Detected quita formats (given in YAML syntax):

  1. 256M - hard block size limit is set to 256M
  2. [256M] - hard block size limit is set to 256M
  3. [128M, 256M] - soft block limit 128M, hard limit 256M
  4. [128M, 256M, 2000, 4000] - soft block limit 128M, hard limit 256M, soft inode limit 2000, hard limit 4000
Parameters:
  • limits - The limits' definition (string or list of strings)
Returns:
Dictionary of detected values

kilobytes(sizestr)

source code 

This function converts a text-based size specification to kilobytes. The following units are accepted: K, M, G & T.

Parameters:
  • sizestr - The size string containing an integer with a unit character
Returns:
Integer value in kilobytes