From 296d570b0fffd101b2d9e4e480786c78cb6362f4 Mon Sep 17 00:00:00 2001 From: Megh Bhatt Date: Mon, 5 Oct 2015 10:37:47 -0700 Subject: [PATCH] Remove code that modifies supervisor configuration to change fd limit to 10240 since that changes cassandra fd limit from the recommended value of 100000. Related changes have been done in the controller and packaging repos to instead have the other supervisor configuration files be installed with the 10240 fd limits. Closes-Bug: #1501960 Change-Id: I3698ff0f7dd6e94987649d65ea87ea3d78ac75bb --- fabfile/tasks/helpers.py | 91 ++++------------------------------------ 1 file changed, 7 insertions(+), 84 deletions(-) diff --git a/fabfile/tasks/helpers.py b/fabfile/tasks/helpers.py index d35d9838d..e00aa1919 100644 --- a/fabfile/tasks/helpers.py +++ b/fabfile/tasks/helpers.py @@ -1013,6 +1013,7 @@ def increase_ulimits(): Increase ulimit in /etc/init.d/mysqld /etc/init/mysql.conf /etc/init.d/rabbitmq-server files ''' execute('increase_ulimits_node', env.host_string) +#end increase_ulimits @task def increase_ulimits_node(*args): @@ -1028,27 +1029,16 @@ def increase_ulimits_node(*args): sudo("sed -i '/start(){/ a\ ulimit -n 10240' /etc/init.d/mysqld") sudo("sed -i '/start_rabbitmq () {/a\ ulimit -n 10240' /etc/init.d/rabbitmq-server") sudo("sed -i '/\[mysqld\]/a\max_connections = 2048' /etc/my.cnf") - - - with settings(warn_only = True): - if detect_ostype() == 'ubuntu': - sudo("sed -i '/start|stop)/ a\ ulimit -n 10240' /etc/init.d/mysql") - sudo("sed -i '/start_rabbitmq () {/a\ ulimit -n 10240' /etc/init.d/rabbitmq-server") - sudo("sed -i '/umask 007/ a\limit nofile 10240 10240' /etc/init/mysql.conf") - sudo("sed -i '/\[mysqld\]/a\max_connections = 10000' /etc/mysql/my.cnf") - sudo("echo 'ulimit -n 10240' >> /etc/default/rabbitmq-server") - else: - sudo("sed -i '/start(){/ a\ ulimit -n 10240' /etc/init.d/mysqld") - sudo("sed -i '/start_rabbitmq () {/a\ ulimit -n 10240' /etc/init.d/rabbitmq-server") - sudo("sed -i '/\[mysqld\]/a\max_connections = 2048' /etc/my.cnf") +#end increase_ulimits_node @roles('cfgm','database','control','collector') @task def increase_limits(): ''' - Increase limits in /etc/security/limits.conf, sysctl.conf and /etc/contrail/supervisor*.conf files + Increase limits in /etc/security/limits.conf, and sysctl.conf ''' execute('increase_limits_node', env.host_string) +#end increase_limits @task def increase_limits_node(*args): @@ -1082,82 +1072,15 @@ def increase_limits_node(*args): insert_line_to_file(pattern = '^fs.file-max.*', line = 'fs.file-max = 65535',file_name = sysctl_conf) sudo('sysctl -p') - - sudo('sed -i \'s/^minfds.*/minfds=10240/\' /etc/contrail/supervisor*.conf') - - - limits_conf = '/etc/security/limits.conf' - with settings(warn_only = True): - pattern='^root\s*soft\s*nproc\s*.*' - if detect_ostype() in ['ubuntu']: - line = 'root soft nofile 65535\nroot hard nofile 65535' - else: - line = 'root soft nproc 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*hard\s*nofile\s*.*' - line = '* hard nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*soft\s*nofile\s*.*' - line = '* soft nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*hard\s*nproc\s*.*' - line = '* hard nproc 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*soft\s*nproc\s*.*' - line = '* soft nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - sysctl_conf = '/etc/sysctl.conf' - insert_line_to_file(pattern = '^fs.file-max.*', - line = 'fs.file-max = 65535',file_name = sysctl_conf) - sudo('sysctl -p') - - sudo('sed -i \'s/^minfds.*/minfds=10240/\' /etc/contrail/supervisor*.conf') - -#end increase_limits +#end increase_limits_node @roles('cfgm','database','collector') @task def increase_limits_no_control(): ''' - Increase limits in /etc/security/limits.conf, sysctl.conf and /etc/contrail/supervisor*.conf files + Increase limits in /etc/security/limits.conf, and sysctl.conf ''' - limits_conf = '/etc/security/limits.conf' - with settings(warn_only = True): - pattern='^root\s*soft\s*nproc\s*.*' - if detect_ostype() in ['ubuntu']: - line = 'root soft nofile 65535\nroot hard nofile 65535' - else: - line = 'root soft nproc 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*hard\s*nofile\s*.*' - line = '* hard nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*soft\s*nofile\s*.*' - line = '* soft nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*hard\s*nproc\s*.*' - line = '* hard nproc 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - pattern='^*\s*soft\s*nproc\s*.*' - line = '* soft nofile 65535' - insert_line_to_file(pattern = pattern, line = line,file_name = limits_conf) - - sysctl_conf = '/etc/sysctl.conf' - insert_line_to_file(pattern = '^fs.file-max.*', - line = 'fs.file-max = 65535',file_name = sysctl_conf) - sudo('sysctl -p') - - sudo('sed -i \'s/^minfds.*/minfds=10240/\' /etc/contrail/supervisor*.conf') - + execute('increase_limits_node', env.host_string) #end increase_limits_no_control def insert_line_to_file(line,file_name,pattern=None):