This sets our default ulimit NOFILE to 2048, which is double what we
set things like mysql'd max_connections to.
Change-Id: I5126bed1e6b9f8c64db00eae4151ac61e47b1bf8
... | ... |
@@ -720,6 +720,22 @@ function enable_kernel_bridge_firewall { |
720 | 720 |
} |
721 | 721 |
|
722 | 722 |
|
723 |
+# Set a systemd system override |
|
724 |
+# |
|
725 |
+# This sets a system-side override in system.conf. A per-service |
|
726 |
+# override would be /etc/systemd/system/${service}.service/override.conf |
|
727 |
+function set_systemd_override { |
|
728 |
+ local key="$1" |
|
729 |
+ local value="$2" |
|
730 |
+ |
|
731 |
+ local sysconf="/etc/systemd/system.conf" |
|
732 |
+ iniset -sudo "${sysconf}" "Manager" "$key" "$value" |
|
733 |
+ echo "Set systemd system override for ${key}=${value}" |
|
734 |
+ |
|
735 |
+ sudo systemctl daemon-reload |
|
736 |
+} |
|
737 |
+ |
|
738 |
+ |
|
723 | 739 |
# Restore xtrace |
724 | 740 |
$_XTRACE_FUNCTIONS |
725 | 741 |
|
... | ... |
@@ -765,6 +765,9 @@ install_infra |
765 | 765 |
# Phase: pre-install |
766 | 766 |
run_phase stack pre-install |
767 | 767 |
|
768 |
+# NOTE(danms): Set global limits before installing anything |
|
769 |
+set_systemd_override DefaultLimitNOFILE ${ULIMIT_NOFILE} |
|
770 |
+ |
|
768 | 771 |
install_rpc_backend |
769 | 772 |
restart_rpc_backend |
770 | 773 |
|
... | ... |
@@ -925,6 +925,9 @@ fi |
925 | 925 |
# ``LOGDIR`` is always set at this point so it is not useful as a 'enable' for service logs |
926 | 926 |
# ``SCREEN_LOGDIR`` may be set, it is useful to enable the compat symlinks |
927 | 927 |
|
928 |
+# System-wide ulimit file descriptors override |
|
929 |
+ULIMIT_NOFILE=${ULIMIT_NOFILE:-2048} |
|
930 |
+ |
|
928 | 931 |
# Local variables: |
929 | 932 |
# mode: shell-script |
930 | 933 |
# End: |