fuel-library/deployment/puppet/cgroups
Michael Polenchuk 4f33d4aabb Conform cgroups to systemd based services
Update cgroups configuration to be running on ubuntu 16.04.
Remove "cgroup-lite" package/service since systemd
mounts cgroups sanely itself.

Change-Id: I250f1ba92fbe1ceac415a73b640fd00d6e2898e4
Closes-Bug: #1669747
2017-03-21 11:35:46 +00:00
..
files Conform cgroups to systemd based services 2017-03-21 11:35:46 +00:00
lib/puppet Move format of all memory limits to the *_in_bytes limits 2016-03-28 16:28:19 +03:00
manifests Conform cgroups to systemd based services 2017-03-21 11:35:46 +00:00
spec Conform cgroups to systemd based services 2017-03-21 11:35:46 +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 Puppet4 support: cgroups 2016-07-01 10:20:12 +00:00
LICENSE Add cgroups module 2016-02-29 16:54:14 +03:00
README.md 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

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