Add new manila.wsgi module

We also update our devstack plugin to take advantage of it. This aligns
Manila to a proposed OpenStack goal [1].

[1] https://governance.openstack.org/tc/goals/proposed/migrate-from-wsgi-scripts-to-module-paths.html

Change-Id: Icec9a8765eb7c40ec27da539a8bd544f487b61af
Co-authored-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #2109645
This commit is contained in:
Goutham Pacha Ravi 2025-04-29 15:05:29 -07:00 committed by Takashi Kajinami
parent e1a0e85687
commit a13d6c8062
4 changed files with 48 additions and 2 deletions

View File

@ -325,7 +325,7 @@ function configure_manila {
set_backend_availability_zones $MANILA_ENABLED_BACKENDS
if [ $(trueorfalse False MANILA_USE_UWSGI) == True ]; then
write_uwsgi_config "$MANILA_UWSGI_CONF" "$MANILA_WSGI" "/share"
write_uwsgi_config "$MANILA_UWSGI_CONF" "$MANILA_WSGI" "/share" "" "manila-api"
fi
if [ $(trueorfalse False MANILA_USE_MOD_WSGI) == True ]; then

View File

@ -106,7 +106,7 @@ MANILA_USE_MOD_WSGI=${MANILA_USE_MOD_WSGI:-False}
# 'governance' project. See:
# https://governance.openstack.org/tc/goals/pike/deploy-api-in-wsgi.html#completion-criteria
MANILA_USE_UWSGI=${MANILA_USE_UWSGI:-True}
MANILA_WSGI=$MANILA_BIN_DIR/manila-wsgi
MANILA_WSGI=manila.wsgi.api:application
MANILA_UWSGI_CONF=$MANILA_CONF_DIR/manila-uwsgi.ini
if [ $(trueorfalse False MANILA_USE_UWSGI) == True ]; then

24
manila/wsgi/api.py Normal file
View File

@ -0,0 +1,24 @@
# 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.
"""WSGI application entry-point for the Manila API."""
import threading
from manila.wsgi import wsgi
application = None
lock = threading.Lock()
with lock:
if application is None:
application = wsgi.initialize_application()

View File

@ -0,0 +1,22 @@
---
features:
- |
A new module, ``manila.wsgi``, has been added as a place to gather WSGI
``application`` objects. This is intended to ease deployment by providing
a consistent location for these objects. For example, if using uWSGI then
instead of:
.. code-block:: ini
[uwsgi]
wsgi-file = /bin/manila-wsgi
You can now use:
.. code-block:: ini
[uwsgi]
module = manila.wsgi.api:application
This also simplifies deployment with other WSGI servers that expect module
paths such as gunicorn.