fuel-library/deployment/puppet/cgroups
Bartosz Kupidura 57e10ad82a Notify cgconfigparser service after config change
Provide cgconfigparser restart command

Cgconfigparser service is simple script, not a daemon
because of this it is always marked as stopped by upstart.

We need to provide restart + status method to properly
restart cgconfigparser.

Change-Id: If35a62f44a20d5f2d9809b53de5ad65ce1235b89
Closes-Bug: #1564358
2016-04-05 10:25:39 +00:00
..
lib/puppet Move format of all memory limits to the *_in_bytes limits 2016-03-28 16:28:19 +03:00
manifests Notify cgconfigparser service after config change 2016-04-05 10:25:39 +00:00
spec Notify cgconfigparser service after config change 2016-04-05 10:25:39 +00:00
templates Add cgroups module 2016-02-29 16:54:14 +03:00
.fixtures.yml Add cgroups module 2016-02-29 16:54:14 +03:00
.gitignore Subscribe cgrulesengd to the file changes 2016-03-22 15:09:29 +03:00
.rspec Subscribe cgrulesengd to the file changes 2016-03-22 15:09:29 +03:00
Gemfile Fix puppet syntax errors (lint) 2016-03-18 03:30:16 +00:00
LICENSE Add cgroups module 2016-02-29 16:54:14 +03:00
Rakefile Add function for parsing services cgroups settings 2016-02-29 02:53:27 +03:00
README.md Add cgroups module 2016-02-29 16:54:14 +03:00

CGroups

This puppet module is for configuring Control Groups on the nodes. At the moment, it supports Ubuntu 14.04+ only.

Classes

Initialization

Place this module at /etc/puppet/modules/cgroups or in the directory where your puppet modules are stored.

The 'cgroups' class has the following parameters and default values:

class { 'cgroups':
  cgroups_set => {},
  packages    => [cgroup-bin, libcgroup1, cgroup-upstart],
}
  • cgroups_set - user settings of Control Groups defined in the hash format.
  • packages - list of necessary packages for cgroups.

By default cgroups is disabled. It will be enabled, if user specify limits for cluster via API/CLI.

Service

This class contains all necessary services for work of cgroups.

Service 'cgroup-lite' mounts cgroups at the "/sys/fs/cgroups" when starts and unmounts them when stops.

Service 'cgconfigparser' parses /etc/cgconfig.conf and sets up cgroups in the /sys/fs/cgroups every time when starts.

Service 'cgrulesengd' is a CGroups Rules Engine Daemon. This daemon distributes processes to control groups. When any process changes its effective UID or GID, cgrulesengd inspects the list of rules loaded from the /etc/cgrules.conf file and moves the process to the appropriate control group.

Service 'cgclassify' moves processes defined by the list of processes to given control groups.

The 'cgroups::service' class has only the 'cgroups_set' parameter.

Usage

For activating cgroup user should add 'cgroup' section into cluster's settings file via CLI. For example:

cgroups: metadata: group: general label: Cgroups configuration weight: 90 restrictions: - condition: "true" action: "hide" keystone: label: keystone type: text value: {"cpu":{"cpu.shares":70}}

Format of relative expressions is (for example, memory limits):

%percentage_value, minimal_value, maximum_value

It means that:

* percentage value(% of total memory) will be calculated and
  then clamped to keep value within the range( percentage value
  will be used if total node's RAM lower than minimal range value)
* minimal value will be taken if node's RAM lower than minimal
  value
* maximum value will be taken if node's RAM upper than maximum
  value

Example:

%20, 2G, 20G

Documentation

Official documentation for CGroups can be found in the https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt