1. Handling overquota users

This module provides a plugin for astakos that handles users who are overquota. Overquota are the users who are still using resources (e.g. VMs, IPs), after their quota have been revoked due to, for example, project termination or removal of the user from the project.

Overquota users are handled through:

  • an astakos hook that allows updating the overquota state of memberships whenever an action is performed that affects quota,
  • a new management command which can be scheduled to run periodically and applies the specified overquota policy (described below).

1.1. Astakos policy hook

Astakos now records an overquota state on each project membership. Astakos only knows a default state (OK), and it is up to the policy module to provide and update policy-specific states. You must specify the policy module in astakos settings 20-snf-astakos-app-settings.conf:

Whenever an action happens which may affect a membership’s overquota status, astakos calls the provided policy module, which inspects the quota and adapts the state. For instance, if a project is terminated, the plugin will check whether a membership is overquota and it will update its state to OVERQUOTA in case it was OK. In this way, memberships which are overquota are marked as such in order to be handled later by the management command which applies the policy.

1.2. Policy

The policy of this plugin defines the following types of overquota states for project memberships: * OK: User is not overquota on the project. * OVERQUOTA: User is overquota on the project. * SOFT_USER: User is informed about the impending SOFT actions. * SOFT_ADMIN: Enforce overquota resources softly, e.g. shutdown VMs. * HARD_USER: User is informed about the impending HARD actions. * HARD_ADMIN: Enforce overquota resources the hard way, e.g. delete VMs.

Note

“Soft” quota enforcements are non-destructive, e.g. VMs are shutdown rather than deleted, as is the case with “hard” enforcements.

For every state type, you can define how many days after a user becomes overquota the state can apply and which actions should be performed. Settings reside at 20-okeanos-policy.conf, for example the following settings:

define that zero, eight and 14 days after the user became overquota on a project an informative email will be sent to the user to warn about soft enforcement and that 15 days after the user became overquota an email will be sent to the admin to instruct about soft-enforcing the quota.

On an actual overquota state, the state type and the number of times it has been applied is recorded, e.g. SOFT_USER:1 denotes the first time the user was informed for soft-enforcement.

Note

Current policy supports only resources associated with cyclades.

1.3. Policy actions

The module defines the following actions: * inform_user: Send an email to the user to inform about being overquota

for a particular project and warn about impending quota reclamation. This is the default for *_USER_ACTIONS.
  • inform_admin: Send an email to the admins to instruct about resource enforcement. This is the default for *_ADMIN_ACTIONS.
  • enforce: Directly reclaim resources. This is an alternative for *_ADMIN_ACTIONS.

1.4. Applying the policy

Management command overquota automates the procedure descibed above.

Admins can specify projects and states on which to apply the procedure. By default, it does not perform any action; it simply prints the current state, the next scheduled transitions, and their related actions. The actions scheduled to run now can be thoroughly inspected with –show-actions.

Use the option –run to actually perform the actions and state transitions. You can also repeat an action without changing the state with option –repeat.

The command is meant to run daily with:

snf-manage overquota --run

1.5. Initialization

In order to start applying the policy, we need to first migrate all project memberships that had become overquota before the QUOTA_POLICY_MODULE was set. This can be done with:

snf-manage overquota --states OK

This will find all memberships that are on state OK and must transition to OVERQUOTA. Use –run` to actually do the transitions.