Update limits

* Update yaql expression for limits task
* Move libvirtd limits to compute task

Change-Id: I314fdf80c11fe81e158b65f3df1732bc7ba75195
Closes-Bug: 1659351
This commit is contained in:
Oleksiy Molchanov 2017-01-26 15:12:05 +02:00
parent 49df8e1f83
commit 238127b5b4
6 changed files with 28 additions and 27 deletions

View File

@ -46,7 +46,7 @@
$.get('block_device_allocate_retries', 300),
$.get('block_device_allocate_retries_interval', 3),
$.get('queue_provider', 'rabbit'), $.quantum_settings,
$.get('memcached_servers', ''),
$.get('memcached_servers', ''), $.get('limits', None),
$.network_metadata.nodes.values().where(
$.node_roles.any($.matches('(controller|rabbitmq)'))).network_roles.select(
$.get('mgmt/messaging')),

View File

@ -144,6 +144,11 @@ class openstack_tasks::roles::compute {
########################################################################
include ::nova::params
$libvirt_service_name = $::nova::params::libvirt_service_name
$limits = hiera('limits', {})
$general_mof_limit = pick($limits['general_mof_limit'], '102400')
$libvirt_mof_limit = pick($limits['libvirt_mof_limit'], '102400')
case $::osfamily {
'RedHat': {
@ -417,9 +422,17 @@ class openstack_tasks::roles::compute {
libvirt_inject_partition => $libvirt_inject_partition,
vncserver_listen => '0.0.0.0',
remove_unused_original_minimum_age_seconds => pick($nova_hash_real['remove_unused_original_minimum_age_seconds'], '86400'),
libvirt_service_name => $::nova::params::libvirt_service_name,
libvirt_service_name => $libvirt_service_name,
}
file_line { 'Add max open files limit':
path => "/etc/init/${libvirt_service_name}.conf",
line => "limit nofile $libvirt_mof_limit $libvirt_mof_limit",
after => 'respawn',
}
Package<| title == 'libvirt'|> -> File_line['Add max open files limit'] ~> Service<| title == 'libvirt'|>
class { '::nova::migration::libvirt':
override_uuid => true,
}

View File

@ -2,14 +2,9 @@ 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,
@ -20,12 +15,4 @@ class osnailyfacter::limits::limits {
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',
}
}
}

View File

@ -7,7 +7,7 @@
requires: [logging]
condition:
yaql_exp: >
changedAny($.get('limits'))
changedAny(($.get('limits', None) = None) and ($.deployed_before.value = false)) or changed($.get('limits'))
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/limits/limits.pp
puppet_modules: /etc/puppet/modules

View File

@ -27,10 +27,6 @@ describe manifest 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,
@ -41,12 +37,5 @@ describe manifest do
'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

View File

@ -79,6 +79,14 @@ describe manifest do
compute_driver = 'libvirt.LibvirtDriver'
end
let(:limits) do
Noop.hiera 'limits', {}
end
let(:libvirt_mof_limit) do
Noop.puppet_function 'pick', limits['libvirt_mof_limit'], '102400'
end
it 'should configure region name in cinder section' do
should contain_nova_config('cinder/os_region_name').with_value(region_name)
end
@ -470,6 +478,10 @@ describe manifest do
)
end
it 'should configure libvirt max open files limit' do
should contain_file_line('Add max open files limit').with( 'line' => "limit nofile #{libvirt_mof_limit} #{libvirt_mof_limit}" )
end
it 'should contain migration basics' do
should contain_class('nova::client')
should contain_install_ssh_keys('nova_ssh_key_for_migration')