Refactor limits for max open files
* Move mof limits to separate task * Add mof limits for non-controller nodes * Add mof limits for libvirt Closes-Bug: 1644318 Change-Id: I56d041a16fc9ef4ec1853b6b8880974a5dd70757
This commit is contained in:
parent
5035ca27e1
commit
06b8e87459
1
deployment/.gitignore
vendored
1
deployment/.gitignore
vendored
@ -47,3 +47,4 @@ puppet/corosync
|
||||
puppet/rabbitmq
|
||||
puppet/pacemaker
|
||||
puppet/vswitch
|
||||
puppet/limits
|
||||
|
@ -161,3 +161,8 @@ mod 'galera',
|
||||
mod 'vswitch',
|
||||
:git => 'https://github.com/fuel-infra/puppet-vswitch.git',
|
||||
:ref => '6.0.0'
|
||||
|
||||
# Pull in saz-limits
|
||||
mod 'limits',
|
||||
:git => 'https://github.com/fuel-infra/puppet-limits.git',
|
||||
:ref => 'v2.5.0'
|
||||
|
@ -1,5 +0,0 @@
|
||||
# Raising open file limit for OpenStack services
|
||||
root soft nofile 102400
|
||||
root hard nofile 112640
|
||||
* soft nofile 102400
|
||||
* hard nofile 112640
|
@ -11,17 +11,6 @@ class openstack::corosync (
|
||||
$cluster_recheck_interval = '190s',
|
||||
) {
|
||||
|
||||
file { 'limitsconf':
|
||||
ensure => present,
|
||||
path => '/etc/security/limits.conf',
|
||||
source => 'puppet:///modules/openstack/limits.conf',
|
||||
replace => true,
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
before => Service['corosync'],
|
||||
}
|
||||
|
||||
anchor {'corosync':}
|
||||
|
||||
if $packages {
|
||||
|
@ -39,8 +39,6 @@ describe 'openstack::corosync' do
|
||||
:log_stderr => false,
|
||||
:log_function_name => true,
|
||||
).that_comes_before('Anchor[corosync-done]')
|
||||
should contain_file("limitsconf").that_comes_before(
|
||||
'Service[corosync]')
|
||||
should contain_corosync__service('pacemaker').with(
|
||||
:version => '1'
|
||||
).that_notifies('Service[corosync]')
|
||||
|
@ -11,3 +11,4 @@ fixtures:
|
||||
sysfs: "#{source_dir}/../sysfs"
|
||||
oslo: "#{source_dir}/../oslo"
|
||||
haproxy: "#{source_dir}/../haproxy"
|
||||
limits: "#{source_dir}/../limits"
|
||||
|
31
deployment/puppet/osnailyfacter/manifests/limits/limits.pp
Normal file
31
deployment/puppet/osnailyfacter/manifests/limits/limits.pp
Normal file
@ -0,0 +1,31 @@
|
||||
class osnailyfacter::limits::limits {
|
||||
|
||||
notice('MODULAR: limits/limits.pp')
|
||||
|
||||
include ::nova::params
|
||||
|
||||
$libvirt_service_name = $::nova::params::libvirt_service_name
|
||||
|
||||
$roles = hiera('roles')
|
||||
$limits = hiera('limits', {})
|
||||
$general_mof_limit = pick($limits['general_mof_limit'], '102400')
|
||||
$libvirt_mof_limit = pick($limits['libvirt_mof_limit'], '102400')
|
||||
|
||||
limits::limits{'*/nofile':
|
||||
hard => $general_mof_limit,
|
||||
soft => $general_mof_limit,
|
||||
}
|
||||
|
||||
limits::limits{'root/nofile':
|
||||
hard => $general_mof_limit,
|
||||
soft => $general_mof_limit,
|
||||
}
|
||||
|
||||
if member($roles, 'compute') {
|
||||
file { "/etc/init/${libvirt_service_name}.override":
|
||||
ensure => present,
|
||||
content => "limit nofile $libvirt_mof_limits $libvirt_mof_limit",
|
||||
mode => '0644',
|
||||
}
|
||||
}
|
||||
}
|
1
deployment/puppet/osnailyfacter/modular/limits/limits.pp
Normal file
1
deployment/puppet/osnailyfacter/modular/limits/limits.pp
Normal file
@ -0,0 +1 @@
|
||||
class { '::osnailyfacter::limits::limits' :}
|
14
deployment/puppet/osnailyfacter/modular/limits/tasks.yaml
Normal file
14
deployment/puppet/osnailyfacter/modular/limits/tasks.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
- id: limits
|
||||
type: puppet
|
||||
version: 2.2.0
|
||||
tags: [primary-controller, controller, cinder, cinder-block-device, cinder-vmware, compute, ceph-osd,
|
||||
primary-mongo, mongo, ironic, primary-rabbitmq, rabbitmq]
|
||||
required_for: [tools]
|
||||
requires: [logging]
|
||||
condition:
|
||||
yaql_exp: >
|
||||
changedAny($.get('limits'))
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/limits/limits.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 120
|
52
tests/noop/spec/hosts/limits/limits_spec.rb
Normal file
52
tests/noop/spec/hosts/limits/limits_spec.rb
Normal file
@ -0,0 +1,52 @@
|
||||
# ROLE: primary-mongo
|
||||
# ROLE: primary-controller
|
||||
# ROLE: mongo
|
||||
# ROLE: ironic
|
||||
# ROLE: controller
|
||||
# ROLE: compute
|
||||
# ROLE: cinder-vmware
|
||||
# ROLE: cinder-block-device
|
||||
# ROLE: cinder
|
||||
# ROLE: ceph-osd
|
||||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'limits/limits.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
|
||||
let(:roles) do
|
||||
Noop.hiera 'roles'
|
||||
end
|
||||
|
||||
let(:limits) do
|
||||
Noop.hiera 'limits', {}
|
||||
end
|
||||
|
||||
let(:general_mof_limit) do
|
||||
Noop.puppet_function 'pick', limits['general_mof_limit'], '102400'
|
||||
end
|
||||
|
||||
let(:libvirt_mof_limit) do
|
||||
Noop.puppet_function 'pick', limits['libvirt_mof_limit'], '102400'
|
||||
end
|
||||
|
||||
it 'should configure general max open files limit' do
|
||||
should contain_limits__limits('*/nofile').with(
|
||||
'hard' => general_mof_limit,
|
||||
'soft' => general_mof_limit
|
||||
)
|
||||
should contain_limits__limits('root/nofile').with(
|
||||
'hard' => general_mof_limit,
|
||||
'soft' => general_mof_limit
|
||||
)
|
||||
end
|
||||
|
||||
if Noop.puppet_function 'member', roles, 'compute'
|
||||
it 'should configure libvirt max open files limit' do
|
||||
should contain_file('/etc/init/libvirtd.override').with( 'content' => "limit nofile #{libvirt_mof_limits} #{libvirt_mof_limit}" )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user