From 2991a99657394774c26a9611091626a611377e80 Mon Sep 17 00:00:00 2001 From: Nolan Brubaker Date: Wed, 22 Mar 2017 16:23:51 -0400 Subject: [PATCH] Adjust cinder init restart times, provide variable In order to facilitate safely shutting down cinder services, allow the systemd time between SIGTERM and SIGKILL to be adjusted by the deployer. Also lower the default from 5 minutes to 2. Also lower the restart time from 150 seconds to 5 to recover more quickly. The `cinder_sigkill_timout` variable will also be provided for upstart via backports. Change-Id: Ib4381e092e15834c692b2fd76a2f41bf6fed28dd Requires: I31310dc9b3834e0bf16618db3e473f17eab2b610 --- defaults/main.yml | 8 ++++++++ ...r_init_time_settings-1ef46f6b9d4fc1df.yaml | 19 +++++++++++++++++++ templates/cinder-systemd-init.j2 | 4 ++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/cinder_init_time_settings-1ef46f6b9d4fc1df.yaml diff --git a/defaults/main.yml b/defaults/main.yml index d33fb107..48c9941c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -297,4 +297,12 @@ cinder_rootwrap_conf_overrides: {} cinder_api_paste_ini_overrides: {} cinder_cinder_conf_overrides: {} +# Timeout (in seconds) for cinder to wait between SIGTERM and SIGKILL +# Applies to TimeoutSec in systemd, affecting start and stop times. +# 'sigkill_timeout' is a global option should one desired. +cinder_sigkill_timeout: 120 + +# Number of seconds to wait before restarting the service +cinder_restart_wait: 5 + _UUID_regex: "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}" diff --git a/releasenotes/notes/cinder_init_time_settings-1ef46f6b9d4fc1df.yaml b/releasenotes/notes/cinder_init_time_settings-1ef46f6b9d4fc1df.yaml new file mode 100644 index 00000000..79e98e0a --- /dev/null +++ b/releasenotes/notes/cinder_init_time_settings-1ef46f6b9d4fc1df.yaml @@ -0,0 +1,19 @@ +--- +features: + - The ``cinder_sigkill_timeout`` was introduced to control + the time between sending a SIGTERM signal and a SIGKILL signal when + stopping or restarting services. This can help in letting long-lived + sessions drain while preventing new ones from starting before a + restart. Default is 120 seconds (was harcoded to 300 seconds). + - The ``cinder_restart_wait`` variable has been added to control the time + between restarts of cinder services. Default is 5 seconds (was + hardcoded to 150 seconds). +upgrade: + - The ``cinder_sigkill_timeout`` was introduced to control + the time between sending a SIGTERM signal and a SIGKILL signal when + stopping or restarting services. This can help in letting long-lived + sessions drain while preventing new ones from starting before a + restart. Default is 120 seconds (was harcoded to 300 seconds). + - The ``cinder_restart_wait`` variable has been added to control the time + between restarts of cinder services. Default is 5 seconds (was + hardcoded to 150 seconds). diff --git a/templates/cinder-systemd-init.j2 b/templates/cinder-systemd-init.j2 index c353c120..5a81f4d0 100644 --- a/templates/cinder-systemd-init.j2 +++ b/templates/cinder-systemd-init.j2 @@ -17,9 +17,9 @@ ExecStart={{ cinder_bin }}/{{ item.value.service_name }} {{ program_config_optio {% endif %} # Give a reasonable amount of time for the server to start up/shut down -TimeoutSec=300 +TimeoutSec={{ cinder_sigkill_timeout }} Restart=on-failure -RestartSec=150 +RestartSec={{ cinder_restart_wait }} [Install] WantedBy=multi-user.target