Add systemd scripts for cgroups

This is needed for Ubuntu Xenial.

Change-Id: Ibe7d18f10aa48222b8bc08fd6f56cc9cd2790232
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-06-28 17:07:49 -04:00
parent a44a41c4a0
commit 868a8ec5c5
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
4 changed files with 50 additions and 14 deletions

View File

@ -0,0 +1,17 @@
[Unit]
Description=Control Group configuration service
# The service should be able to start as soon as possible,
# before any 'normal' services:
DefaultDependencies=no
Conflicts=shutdown.target
Before=basic.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf -s 1664
ExecStop=/usr/sbin/cgclear -l /etc/cgconfig.conf -e
[Install]
WantedBy=sysinit.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=CGroups Rules Engine Daemon
After=syslog.target
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/cgred
ExecStart=/usr/sbin/cgrulesengd $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -33,15 +33,14 @@ class jenkins::cgroups {
source => 'puppet:///modules/jenkins/cgroups/cgrules.conf', source => 'puppet:///modules/jenkins/cgroups/cgrules.conf',
} }
# Starting with Ubuntu Quantal (12.10) cgroup-bin dropped its upstart jobs.
if $::osfamily == 'Debian' { if $::osfamily == 'Debian' {
# 14.04 and below is using upstart.
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '12.10') >= 0 { if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '14.04') <= 0 {
file { 'cgconfig.service':
file { '/etc/init/cgconfig.conf':
ensure => present, ensure => present,
replace => true, replace => true,
owner => 'root', owner => 'root',
path => '/etc/init/cgconfig.conf',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/upstart_cgconfig', source => 'puppet:///modules/jenkins/cgroups/upstart_cgconfig',
@ -52,10 +51,11 @@ class jenkins::cgroups {
target => '/lib/init/upstart-job', target => '/lib/init/upstart-job',
} }
file { '/etc/init/cgred.conf': file { 'cgred.service':
ensure => present, ensure => present,
replace => true, replace => true,
owner => 'root', owner => 'root',
path => '/etc/init/cgred.conf',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/upstart_cgred', source => 'puppet:///modules/jenkins/cgroups/upstart_cgred',
@ -65,19 +65,27 @@ class jenkins::cgroups {
ensure => link, ensure => link,
target => '/lib/init/upstart-job', target => '/lib/init/upstart-job',
} }
} else { } else {
file { 'cgred.service':
file { '/etc/init/cgconfig.conf':
ensure => present, ensure => present,
replace => true,
owner => 'root',
path => '/etc/systemd/system/cgred.service',
group => 'root',
mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/cgred.service',
} }
file { '/etc/init/cgred.conf': file { 'cgconfig.service':
ensure => present, ensure => present,
replace => true,
owner => 'root',
path => '/etc/systemd/system/cgconfig.service',
group => 'root',
mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/cgconfig.service',
} }
} }
} }
service { 'cgconfig': service { 'cgconfig':

View File

@ -48,11 +48,11 @@ class jenkins::params {
$cgroups_tools_package = '' $cgroups_tools_package = ''
$cgconfig_require = [ $cgconfig_require = [
Package['cgroups'], Package['cgroups'],
File['/etc/init/cgconfig.conf'], File['cgconfig.service'],
] ]
$cgred_require = [ $cgred_require = [
Package['cgroups'], Package['cgroups'],
File['/etc/init/cgred.conf'], File['cgred.service'],
] ]
# ruby packages # ruby packages
# ruby1.9.1 is not present in Debian Jessie, use ruby instead # ruby1.9.1 is not present in Debian Jessie, use ruby instead