Commit Graph

7 Commits

Author SHA1 Message Date
Takashi Kajinami 2aa2ed5119 api: Dump config options when deployed as a wsgi app
This ensures api service dumps config options to debug logs when being
deployed as a wsgi app, so that users can review the effective values
and find misconfiguration more easily.

Closes-Bug: #2031480
Change-Id: I622fbae7fb273e7405a305cc3e33ac89c0564fdc
2024-01-31 10:47:28 +09:00
Joshua Cornutt 5d48410d0a Fixing skipped default override for CORS options
Some of the cores middleware options should have overridden default
values but the override method was not actually called so the library
defaults are still used.

Closes-Bug: #2051691
Change-Id: I8dac03c787bf729c60c2e0ecc9c03b7ba9a5b5a5
2024-01-30 22:18:43 +09:00
Maurice Escher f8e8eaf586
Add Guru Meditation Report to wsgi
best use it with the file_event_handler config of oslo_reports
since using signal handlers is discouraged on wsgi

Closes-Bug: #1967326

Change-Id: I81569723adb5ff33076ec96b9ec3216b177379f3
2022-03-31 18:17:31 +02:00
kpdev fbc2b4d289 Integrate OSprofiler and Manila
*) Add osprofiler wsgi middleware

This middleware is used for 2 things:
1) It checks that person who want to trace is trusted and knows
secret HMAC key.
2) It start tracing in case of proper trace headers and add
first wsgi trace point, with info about HTTP request
*) Add initialization of osprofiler at start of serivce.

You should use python-manilaclient with this patch:

https://review.opendev.org/#/c/769731

Run any command with --profile SECRET_KEY

  $ manila --profile SECRET_KEY create NFS 1 --name <share> \
    --description <share_description> --share-network <network> \
    --share-type default
  # it will print <Trace ID>

Get pretty HTML with traces:

  $ osprofiler trace show --html <Trace ID> --connection-string \
   <connection_string> --out <output.html>
  e.g. --connection-string can be redis://localhost:6379

Note that osprofiler should be run from admin user name & tenant.

Implements: blueprint manila-os-profiler
Change-Id: I3bce1f04d1cfebfacd78ed135a949a068c78987d
2021-02-25 04:59:19 +01:00
Goutham Pacha Ravi 3e855d5f60 [pylint] Fix/ignore pylint errors in non-test modules
Pylint does not play very well with dynamic object
manipulation in python This creates a lot of
false-positives in the code-base which affects
contributors looking for genuine failures.

So, this change
- adds pylint ignore statements where appropriate
  to disable testing these lines of code and failing.
- replaces all the pylint error codes (they are
  hard to remember/relate to) with error names
  which are easier to understand when reading the
  code.
- initializes sqlalchemy model objects as dictionaries
  which is a valid representation over None.
- removes ignore directives on six.moves which
  is globally ignored in our pylintrc.
- adds alembic.op to the ignored
  modules list since they are not supported by
  pylint and have known issues.

This patch is the beginning of a series of
commits to use pylint in a sane way on manila code.

Change-Id: I44616821c5311d6f14986697efbbe5624de364a5
2019-02-25 17:23:15 +00:00
whoami-rajat e7ebfa1079 Remove i18n.enable_lazy() translation
Lazy translation of messages is not used in OpenStack [1].
This causes problems for commands which use translatable messages.
The lazy translation effort was abandoned several years ago.

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-November/136289.html

Change-Id: I25a9ec0a96b7c57f8a6928c0537bf133f6b6931c
2018-11-14 14:09:08 +05:30
Valeriy Ponomaryov 16bfc82962 Add possibility to run 'manila-api' with wsgi web servers
One of the goals for Pike [1] is to make each API service be able to
run under web servers that support WSGI applications,
such as Apache (+mod-wsgi) and Nginx (+uWSGI).

Do following to address governance requirements:
- Split existing manila/wsgi.py module into 3 modules:
  First (manila/wsgi/eventlet_server.py) is used by
  eventlet-based WSGI application approach.
  Second (manila/wsgi/wsgi.py) is used for WSGI web servers.
  And third (manila/wsgi/common.py) is common code for both.
  All three are made in cinder-like way to have alike-approach.
- Reuse common code from "oslo_service/wsgi.py" module that
  allows us to remove code duplication.
- Delete config opts that are defined by newly reused common code.
- Register new entry point that will be manila wsgi app: "manila-wsgi".
- Fix "manila/api/openstack/wsgi.py" module to be compatible
  with str/bytes handling approach used by Apache mod-wsgi plugin using
  different python versions (2/3).
- Add web server config template "devstack/apache-manila.template"
- Add devstack support where usage of this feature can be
  enabled or disabled using "MANILA_USE_MOD_WSGI" env var.
  It is set to "True" by default, because it is requirement for Pike
  release - to have it running in all CI jobs.
  Disable it only for one CI job that uses dummy driver and tests
  various manila core features that are not covered by other CI jobs.

[1] https://governance.openstack.org/tc/goals/pike/deploy-api-in-wsgi.html

Partially-Implements BluePrint wsgi-web-servers-support
DocImpact
Change-Id: Ibdef3c6810b65a5d6f3611e2d0079c635ee523ab
2017-04-10 12:49:20 +03:00