From 009fff54713621ba697fd0f2db51cd5fa213c421 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Tue, 15 Aug 2017 17:34:53 +0100 Subject: [PATCH] Fix reloads for uWSGI uWSGI won't reload properly unless we use one of the built in options for uWSGI reloads: touch-reload pidfile reload using uwsgi binary This opts to use the pid file option, which uses the built in uWSGI --reload option along with the "pidfile" option specified in the conf file to reload the service. Change-Id: I9dbdd75f4ac555378e6999243718d2b986071dde --- templates/cinder-systemd-init.j2 | 4 ++-- templates/cinder-uwsgi.ini.j2 | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/cinder-systemd-init.j2 b/templates/cinder-systemd-init.j2 index d736bfab..5ddf687a 100644 --- a/templates/cinder-systemd-init.j2 +++ b/templates/cinder-systemd-init.j2 @@ -15,8 +15,8 @@ ExecStart={{ item.program_override }} {{ item.program_config_options|default('') {% else %} ExecStart={{ cinder_bin }}/{{ item.service_name }} {{ item.program_config_options|default('') }} --log-file=/var/log/cinder/{{ item.service_name }}.log {% endif %} -{% if item.service_name != "cinder-api" %} -ExecReload=/bin/kill -HUP $MAINPID +{% if item.service_name != "cinder-api" or item.wsgi_app %} +ExecReload={{ (item.wsgi_app is defined and item.wsgi_app) | ternary(cinder_bin + '/uwsgi --reload /var/run/' + item.service_name + '/' + item.service_name +'.pid','/bin/kill -HUP $MAINPID') }} {% endif %} # Give a reasonable amount of time for the server to start up/shut down diff --git a/templates/cinder-uwsgi.ini.j2 b/templates/cinder-uwsgi.ini.j2 index 20ba1abc..7c5fa17d 100644 --- a/templates/cinder-uwsgi.ini.j2 +++ b/templates/cinder-uwsgi.ini.j2 @@ -4,16 +4,17 @@ gid = {{ cinder_system_group_name }} virtualenv = /openstack/venvs/cinder-{{ cinder_venv_tag }} wsgi-file = {{ cinder_bin }}/{{ item.wsgi_name }} -http-socket = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }} +http = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }} master = true enable-threads = true processes = {{ cinder_wsgi_processes }} threads = {{ cinder_wsgi_threads }} -exit-on-reload = true +exit-on-reload = false die-on-term = true lazy-apps = true add-header = Connection: close buffer-size = {{ cinder_wsgi_buffer_size }} thunder-lock = true logfile-chmod = 644 +pidfile = /var/run/{{ item.service_name }}/{{ item.service_name }}.pid