From 89a92bfb3db7e77085a60fdb1634ee4a5b3f619f Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sat, 22 Jun 2013 02:03:20 +0000 Subject: [PATCH] Fedora cgroups support. * modules/jenkins/manifests/cgroups.pp * modules/jenkins/manifests/params.pp: Fedora separates the cgroups management utilities into an additional package. * modules/jenkins/templates/cgconfig.erb: Fedora already automounts cgroups subsystems. Also, because of Red Hat bug 918951, swap management doesn't work in Fedora 18. Change-Id: I2366261d64c11fdc8e65a39481e8db9d589ca2de Reviewed-on: https://review.openstack.org/34083 Reviewed-by: Clark Boylan Reviewed-by: James E. Blair Approved: James E. Blair Tested-by: Jenkins --- modules/jenkins/manifests/cgroups.pp | 6 ++++++ modules/jenkins/manifests/params.pp | 18 ++++++++++++++++-- modules/jenkins/templates/cgconfig.erb | 10 +++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/modules/jenkins/manifests/cgroups.pp b/modules/jenkins/manifests/cgroups.pp index ad1979de80..e379c60329 100644 --- a/modules/jenkins/manifests/cgroups.pp +++ b/modules/jenkins/manifests/cgroups.pp @@ -4,6 +4,12 @@ class jenkins::cgroups { include jenkins::params + if ($::jenkins::params::cgroups_tools_package != '') { + package { 'cgroups-tools': + ensure => present, + name => $::jenkins::params::cgroups_tools_package, + } + } package { 'cgroups': ensure => present, name => $::jenkins::params::cgroups_package, diff --git a/modules/jenkins/manifests/params.pp b/modules/jenkins/manifests/params.pp index fd49a3eb1d..6dbe0dbcd0 100644 --- a/modules/jenkins/manifests/params.pp +++ b/modules/jenkins/manifests/params.pp @@ -50,8 +50,21 @@ class jenkins::params { $xslt_package = 'libxslt' $xvfb_package = 'xorg-x11-server-Xvfb' $cgroups_package = 'libcgroup' - $cgconfig_require = Package['cgroups'] - $cgred_require = Package['cgroups'] + if ($::operatingsystem == 'Fedora') { + $cgroups_tools_package = 'libcgroup-tools' + $cgconfig_require = [ + Package['cgroups'], + Package['cgroups-tools'], + ] + $cgred_require = [ + Package['cgroups'], + Package['cgroups-tools'], + ] + } else { + $cgroups_tools_package = '' + $cgconfig_require = Package['cgroups'] + $cgred_require = Package['cgroups'] + } } 'Debian': { # common packages @@ -99,6 +112,7 @@ class jenkins::params { $xslt_package = 'xsltproc' $xvfb_package = 'xvfb' $cgroups_package = 'cgroup-bin' + $cgroups_tools_package = '' $cgconfig_require = [ Package['cgroups'], File['/etc/init/cgconfig.conf'], diff --git a/modules/jenkins/templates/cgconfig.erb b/modules/jenkins/templates/cgconfig.erb index c2639be6e5..3b88807d59 100644 --- a/modules/jenkins/templates/cgconfig.erb +++ b/modules/jenkins/templates/cgconfig.erb @@ -1,4 +1,7 @@ -<% if osfamily == "RedHat" then %> +<% if operatingsystem == "Fedora" then %> +# Fedora auto-mounts subsystems under /sys/fs/cgroup/ already, so no +# mount section is needed. +<% elsif osfamily == "RedHat" then %> mount { cpuset = /cgroup/cpuset; @@ -48,6 +51,11 @@ group jenkins/children { memory { memory.soft_limit_in_bytes = <%= (memorytotalbytes.to_f * 0.75).to_i %>; memory.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>; +<% if (operatingsystem == "Fedora") and (operatingsystemrelease == "18") then %> + # Because of Red Hat bug 918951, swap management doesn't + # work in Fedora 18 but should be fixed in 19. +<% else %> memory.memsw.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>; +<% end %> } }