diff --git a/defaults/main.yml b/defaults/main.yml index 6f275890..00cec2fe 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -113,6 +113,11 @@ statsd_default_sample_rate: 1.0 statsd_sample_rate_factor: 1.0 statsd_metric_prefix: +# Set the file limits +swift_hard_open_file_limits: 10240 +swift_soft_open_file_limits: 4096 +swift_max_file_limits: "{{ swift_hard_open_file_limits * 24 }}" + ## Keystone authentication middleware swift_keystone_auth_plugin: "password" diff --git a/releasenotes/notes/swift-fs-file-limits-a57ab8b4c3c944e4.yaml b/releasenotes/notes/swift-fs-file-limits-a57ab8b4c3c944e4.yaml new file mode 100644 index 00000000..3edb979c --- /dev/null +++ b/releasenotes/notes/swift-fs-file-limits-a57ab8b4c3c944e4.yaml @@ -0,0 +1,11 @@ +--- +features: + - The ``os_swift`` role has 3 new variables that will allow a + deployer to change the hard, soft and fs.file-max limits. the + hard and soft limits are being added to the limits.conf file for + the swift system user. The fs.file-max settings are added to + storage hosts via kernel tuning. The new options are + ``swift_hard_open_file_limits`` with a default of 10240 + ``swift_soft_open_file_limits`` with a default of 4096 + ``swift_max_file_limits`` with a default of 24 times the value + of ``swift_hard_open_file_limits``. diff --git a/tasks/swift_pre_install.yml b/tasks/swift_pre_install.yml index cbdaa805..833a6db1 100644 --- a/tasks/swift_pre_install.yml +++ b/tasks/swift_pre_install.yml @@ -109,3 +109,23 @@ group: "root" tags: - swift-crond + +- name: Configure soft file limits + lineinfile: + dest: "/etc/security/limits.conf" + regexp: "^{{ swift_system_user_name }}.*soft.*nofile.*" + state: "present" + line: "{{ swift_system_user_name }}\tsoft\tnofile\t\t{{ swift_soft_open_file_limits }}" + insertbefore: "^# End of file" + tags: + - swift-config + +- name: Configure hard file limits + lineinfile: + dest: "/etc/security/limits.conf" + regexp: "^{{ swift_system_user_name }}.*hard.*nofile.*" + state: "present" + line: "{{ swift_system_user_name }}\thard\tnofile\t\t{{ swift_hard_open_file_limits }}" + insertbefore: "^# End of file" + tags: + - swift-config diff --git a/tasks/swift_storage_hosts_setup.yml b/tasks/swift_storage_hosts_setup.yml index ac4b676a..581c13e9 100644 --- a/tasks/swift_storage_hosts_setup.yml +++ b/tasks/swift_storage_hosts_setup.yml @@ -26,6 +26,14 @@ sysctl_set: yes delegate_to: "{{ physical_host }}" +- name: "Set sysctl file-max" + sysctl: + name: "fs.file-max" + state: present + value: "{{ swift_max_file_limits }}" + sysctl_set: yes + delegate_to: "{{ physical_host }}" + - name: "Put /etc/rsyncd.conf in place" template: src: "rsyncd.conf.j2"