From ba78082e0c0f4c0aa1952841288bd1cf5e0191f8 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Wed, 19 Apr 2017 10:59:44 +0100 Subject: [PATCH] Fix cinder-api ubuntu binary deploy This changes moves cinder-api to make use of apache to launch its processes. Ubuntu binary removed support in Ocata for cinder-api system services [1]. At this moment cinder in Ocata branch is not working at all due this issue. This changes aims to fix cinder in master only for ubuntu binary with the purpose of make a clean backport to stable/ocata without do any other change on the backport process. A follow up change will migrate other OS/install_type to make use of Apache but only changing master branch. [1] http://lists.openstack.org/pipermail/openstack-dev/2017-January/111069.html Change-Id: I9885d6acadbac1da46844f583e7cd37785505ae0 Closes-Bug: #1676751 --- ansible/roles/cinder/handlers/main.yml | 3 +++ ansible/roles/cinder/tasks/config.yml | 19 +++++++++++++++++++ .../roles/cinder/templates/cinder-api.json.j2 | 11 +++++++++-- .../cinder/templates/cinder-wsgi.conf.j2 | 15 +++++++++++++++ .../templates/conf/filter/01-rewrite.conf.j2 | 2 +- 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 ansible/roles/cinder/templates/cinder-wsgi.conf.j2 diff --git a/ansible/roles/cinder/handlers/main.yml b/ansible/roles/cinder/handlers/main.yml index 8e6a9ebe62..7c5c593c8a 100644 --- a/ansible/roles/cinder/handlers/main.yml +++ b/ansible/roles/cinder/handlers/main.yml @@ -21,6 +21,9 @@ or cinder_conf.changed | bool or policy_json.changed | bool or cinder_api_container.changed | bool + or (kolla_base_distro in ['debian', 'ubuntu'] + and kolla_install_type == 'binary' + and wsgi_cinder_api | changed) - name: Restart cinder-scheduler container vars: diff --git a/ansible/roles/cinder/tasks/config.yml b/ansible/roles/cinder/tasks/config.yml index e32254aee4..3f808ddde0 100644 --- a/ansible/roles/cinder/tasks/config.yml +++ b/ansible/roles/cinder/tasks/config.yml @@ -24,6 +24,25 @@ - Restart cinder-volume container - Restart cinder-backup container +- name: Copying over cinder-wsgi.conf + vars: + service: "{{ cinder_services['cinder-api'] }}" + template: + src: "{{ item }}" + dest: "{{ node_config_directory }}/cinder-api/cinder-wsgi.conf" + with_first_found: + - "{{ node_custom_config }}/cinder/{{ inventory_hostname }}/cinder-wsgi.conf" + - "{{ node_custom_config }}/cinder/cinder-wsgi.conf" + - "cinder-wsgi.conf.j2" + register: wsgi_cinder_api + when: + - inventory_hostname in groups[service.group] + - service.enabled | bool + - kolla_base_distro in ['debian', 'ubuntu'] + - kolla_install_type == 'binary' + notify: + - Restart cinder-api container + - name: Copying over cinder.conf merge_configs: vars: diff --git a/ansible/roles/cinder/templates/cinder-api.json.j2 b/ansible/roles/cinder/templates/cinder-api.json.j2 index 4733681256..9a38426f41 100644 --- a/ansible/roles/cinder/templates/cinder-api.json.j2 +++ b/ansible/roles/cinder/templates/cinder-api.json.j2 @@ -1,5 +1,6 @@ +{% set command = '/usr/sbin/apache2 -DFOREGROUND' if kolla_base_distro in ['ubuntu', 'debian'] and kolla_install_type == 'binary' else 'cinder-api --config-file /etc/cinder/cinder.conf' %} { - "command": "cinder-api --config-file /etc/cinder/cinder.conf", + "command": "{{ command }}", "config_files": [ { "source": "{{ container_config_directory }}/cinder.conf", @@ -13,7 +14,13 @@ "owner": "cinder", "perm": "0600", "optional": true - } + }{% if kolla_base_distro in ['ubuntu', 'debian'] and kolla_install_type == 'binary' %}, + { + "source": "{{ container_config_directory }}/cinder-wsgi.conf", + "dest": "/etc/apache2/conf-enabled/cinder-wsgi.conf", + "owner": "cinder", + "perm": "0600" + }{% endif %} ], "permissions": [ { diff --git a/ansible/roles/cinder/templates/cinder-wsgi.conf.j2 b/ansible/roles/cinder/templates/cinder-wsgi.conf.j2 new file mode 100644 index 0000000000..0b6b3e1e14 --- /dev/null +++ b/ansible/roles/cinder/templates/cinder-wsgi.conf.j2 @@ -0,0 +1,15 @@ +{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} +Listen {{ api_interface_address }}:{{ cinder_api_port }} + + + WSGIDaemonProcess cinder-api processes={{ openstack_service_workers }} threads=1 user=cinder group=cinder display-name=%{GROUP} python-path={{ python_path }} + WSGIProcessGroup cinder-api + WSGIScriptAlias / /var/www/cgi-bin/cinder/cinder-wsgi + WSGIApplicationGroup %{GLOBAL} + WSGIPassAuthorization On + = 2.4> + ErrorLogFormat "%{cu}t %M" + + ErrorLog /var/log/kolla/cinder/cinder-api.log + CustomLog /var/log/kolla/cinder/cinder-api-access.log combined + diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2 index 0fde7a720a..03d8788088 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2 @@ -1,7 +1,7 @@ @type rewrite_tag_filter capitalize_regex_backreference yes - rewriterule1 programname ^(horizon-access|ceilometer-api-access|keystone-apache-admin-access|keystone-apache-public-access)$ apache_access + rewriterule1 programname ^(horizon-access|ceilometer-api-access|keystone-apache-admin-access|keystone-apache-public-access|cinder-api-access)$ apache_access rewriterule2 programname ^aodh_wsgi_access$ wsgi_access rewriterule3 programname ^(nova-api|nova-compute|nova-conductor|nova-consoleauth|nova-manage|nova-novncproxy|nova-scheduler|nova-placement-api|placement-api|placement-api-access|privsep-helper).* openstack_python rewriterule4 programname ^(sahara-api|sahara-engine).* openstack_python