Implement uWSGI for cinder-api
As part of the Pike goals we are moving api services to run as WSGI apps. cinder-api service is set up as a wsgi app, and this patch moves it over. Since this is just a drop in replacement for the existing eventlet service, operators an deployers should notice no difference. Change-Id: I0283722d6da56201aa0894089c36168ad426700c Implements: blueprint goal-deploy-api-in-wsgi
This commit is contained in:
parent
3602554d51
commit
f7f45e118e
@ -44,6 +44,7 @@ cinder_default_availability_zone: "{{ cinder_storage_availability_zone }}"
|
|||||||
|
|
||||||
cinder_storage_address: 127.0.0.1
|
cinder_storage_address: 127.0.0.1
|
||||||
cinder_management_address: 127.0.0.1
|
cinder_management_address: 127.0.0.1
|
||||||
|
cinder_uwsgi_bind_address: 0.0.0.0
|
||||||
|
|
||||||
cinder_nova_catalog_info: compute:nova:internalURL
|
cinder_nova_catalog_info: compute:nova:internalURL
|
||||||
cinder_nova_catalog_admin_info: compute:nova:adminURL
|
cinder_nova_catalog_admin_info: compute:nova:adminURL
|
||||||
@ -258,6 +259,7 @@ cinder_pip_packages:
|
|||||||
- python-cinderclient
|
- python-cinderclient
|
||||||
- python-keystoneclient
|
- python-keystoneclient
|
||||||
- python-memcached
|
- python-memcached
|
||||||
|
- uwsgi
|
||||||
|
|
||||||
cinder_api_init_overrides: {}
|
cinder_api_init_overrides: {}
|
||||||
cinder_scheduler_init_overrides: {}
|
cinder_scheduler_init_overrides: {}
|
||||||
@ -271,6 +273,13 @@ cinder_services:
|
|||||||
service_name: cinder-api
|
service_name: cinder-api
|
||||||
init_config_overrides: "{{ cinder_api_init_overrides }}"
|
init_config_overrides: "{{ cinder_api_init_overrides }}"
|
||||||
start_order: 1
|
start_order: 1
|
||||||
|
wsgi_overrides: "{{ cinder_api_uwsgi_ini_overrides }}"
|
||||||
|
wsgi_app: True
|
||||||
|
log_string: "--logto "
|
||||||
|
wsgi_name: cinder-wsgi
|
||||||
|
uwsgi_port: "{{ cinder_service_port }}"
|
||||||
|
uwsgi_bind_address: "{{ cinder_uwsgi_bind_address }}"
|
||||||
|
program_override: "{{ cinder_bin }}/uwsgi --ini /etc/uwsgi/cinder-api.ini"
|
||||||
cinder-scheduler:
|
cinder-scheduler:
|
||||||
group: cinder_scheduler
|
group: cinder_scheduler
|
||||||
service_name: cinder-scheduler
|
service_name: cinder-scheduler
|
||||||
@ -288,6 +297,12 @@ cinder_services:
|
|||||||
init_config_overrides: "{{ cinder_backup_init_overrides }}"
|
init_config_overrides: "{{ cinder_backup_init_overrides }}"
|
||||||
start_order: 4
|
start_order: 4
|
||||||
|
|
||||||
|
# Cinder uWSGI settings
|
||||||
|
cinder_wsgi_processes_max: 16
|
||||||
|
cinder_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}"
|
||||||
|
cinder_wsgi_threads: 1
|
||||||
|
cinder_wsgi_buffer_size: 65535
|
||||||
|
|
||||||
# This variable is used by the repo_build process to determine
|
# This variable is used by the repo_build process to determine
|
||||||
# which host group to check for members of before building the
|
# which host group to check for members of before building the
|
||||||
# pip packages required by this role. The value is picked up
|
# pip packages required by this role. The value is picked up
|
||||||
@ -314,5 +329,6 @@ cinder_policy_overrides: {}
|
|||||||
cinder_rootwrap_conf_overrides: {}
|
cinder_rootwrap_conf_overrides: {}
|
||||||
cinder_api_paste_ini_overrides: {}
|
cinder_api_paste_ini_overrides: {}
|
||||||
cinder_cinder_conf_overrides: {}
|
cinder_cinder_conf_overrides: {}
|
||||||
|
cinder_api_uwsgi_ini_overrides: {}
|
||||||
|
|
||||||
_UUID_regex: "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}"
|
_UUID_regex: "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}"
|
||||||
|
15
releasenotes/notes/cinder_uwsgi-c6a1651a4c54a8cc.yaml
Normal file
15
releasenotes/notes/cinder_uwsgi-c6a1651a4c54a8cc.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``cinder-api`` service has moved to run as a
|
||||||
|
uWSGI application. You can set the max number of
|
||||||
|
WSGI processes, the number of processes, threads,
|
||||||
|
and buffer size utilizing the
|
||||||
|
``cinder_wsgi_processes_max``,
|
||||||
|
``cinder_wsgi_processes``, ``cinder_wsgi_threads``,
|
||||||
|
and ``cinder_wsgi_buffer_size``.
|
||||||
|
Additionally, you can override any settings in the
|
||||||
|
uWSGI ini configuration file using the
|
||||||
|
``cinder_api_uwsgi_ini_overrides`` setting.
|
||||||
|
The uWSGI application will listen on the address
|
||||||
|
specified by ``cinder_uwsgi_bind_address`` which
|
||||||
|
defaults to ``0.0.0.0``.
|
32
tasks/cinder_uwsgi.yml
Normal file
32
tasks/cinder_uwsgi.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2017, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Ensure uWSGI directory exists
|
||||||
|
file:
|
||||||
|
path: "/etc/uwsgi/"
|
||||||
|
state: directory
|
||||||
|
mode: "0711"
|
||||||
|
|
||||||
|
- name: Apply uWSGI configuration
|
||||||
|
config_template:
|
||||||
|
src: "cinder-uwsgi.ini.j2"
|
||||||
|
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
|
||||||
|
mode: "0744"
|
||||||
|
config_overrides: "{{ item.wsgi_overrides }}"
|
||||||
|
config_type: ini
|
||||||
|
with_items: "{{ filtered_cinder_services }}"
|
||||||
|
when: item.wsgi_app | default(False)
|
||||||
|
notify:
|
||||||
|
- Restart cinder services
|
@ -59,6 +59,10 @@
|
|||||||
tags:
|
tags:
|
||||||
- cinder-config
|
- cinder-config
|
||||||
|
|
||||||
|
- include: cinder_uwsgi.yml
|
||||||
|
tags:
|
||||||
|
- cinder-config
|
||||||
|
|
||||||
- include: cinder_service_setup.yml
|
- include: cinder_service_setup.yml
|
||||||
static: no
|
static: no
|
||||||
when:
|
when:
|
||||||
|
@ -10,10 +10,10 @@ Type=simple
|
|||||||
User={{ cinder_system_user_name }}
|
User={{ cinder_system_user_name }}
|
||||||
Group={{ cinder_system_group_name }}
|
Group={{ cinder_system_group_name }}
|
||||||
|
|
||||||
{% if program_override is defined %}
|
{% if item.program_override is defined %}
|
||||||
ExecStart={{ program_override }} {{ program_config_options|default('') }} --log-file=/var/log/cinder/{{ item.service_name }}.log
|
ExecStart={{ item.program_override }} {{ item.program_config_options|default('') }} {{ item.log_string | default('--log-file=') }}/var/log/cinder/{{ item.service_name }}.log
|
||||||
{% else %}
|
{% else %}
|
||||||
ExecStart={{ cinder_bin }}/{{ item.service_name }} {{ program_config_options|default('') }} --log-file=/var/log/cinder/{{ item.service_name }}.log
|
ExecStart={{ cinder_bin }}/{{ item.service_name }} {{ item.program_config_options|default('') }} --log-file=/var/log/cinder/{{ item.service_name }}.log
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.service_name != "cinder-api" %}
|
{% if item.service_name != "cinder-api" %}
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
19
templates/cinder-uwsgi.ini.j2
Normal file
19
templates/cinder-uwsgi.ini.j2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[uwsgi]
|
||||||
|
uid = {{ cinder_system_user_name }}
|
||||||
|
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 }}
|
||||||
|
|
||||||
|
master = true
|
||||||
|
enable-threads = true
|
||||||
|
processes = {{ cinder_wsgi_processes }}
|
||||||
|
threads = {{ cinder_wsgi_threads }}
|
||||||
|
exit-on-reload = true
|
||||||
|
die-on-term = true
|
||||||
|
lazy-apps = true
|
||||||
|
add-header = Connection: close
|
||||||
|
buffer-size = {{ cinder_wsgi_buffer_size }}
|
||||||
|
thunder-lock = true
|
||||||
|
logfile-chmod = 644
|
Loading…
Reference in New Issue
Block a user