Commit Graph

11 Commits

Author SHA1 Message Date
Takashi Kajinami 6a5859fc07 Fix python shebang
The current shebang requires /usr/bin/python which is not available in
Ubuntu Jammy by default.

This also fixes some unnecessary/missing shebangs.

Change-Id: Ib25a0a7f39f68f43622609391710dd3b1abc2d00
2023-10-17 16:02:25 +00:00
Nguyen Phuong An 2f98f56cb5 Allow neutron-api load config from WSGI process
neutron-api needs to load config files when deployed under
WSGI process. This patch will do this. neutron-rpc-server
also need to be aware of plugin extension.

uWSGI seems not happy with eventlet.GreenPool. So this patch
will switch to futurist.ThreadPoolExcutor for ML2 OVO push
notification.

Partially-implements: blueprint run-in-wsgi-server

Change-Id: Ia2659c9c8f1deeceefc1c75f1149a1e47c91e7a9
Closes-Bug: #1708389
2018-07-25 15:22:14 +07:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Kevin Benton 57a37c4a87 Switch to start_all_workers in RPC server
This does the same as the logic present but it emits
the registry callback event for resources.PROCESS AFTER_SPAWN
that some plugins may be expecting.

Change-Id: I6f9aeca753a5d3c0052f553a2ac46786ca113e1e
Related-Bug: #1687896
2017-06-13 02:20:35 -07:00
Sean McCully 0ef8e2c168 neutron-rpc-server fails with no plugins loaded
Neutron RPC Server fails with exception
"object has no attribute 'rpc_workers_supported'".

Change-Id: I0997789bb61635ed36e4b95f03fc7d396511e19f
Closes-Bug: #1687896
2017-06-06 20:31:42 -04:00
Dmitriy Ukhlov 483c5982c0 Revert "Revert "Remove threading before process forking""
This reverts commit b1cdba1696

Original patch was reverted because it broke neutron plugin's
backward compatibility and needed more work.

This patch fixes that problems:
1) original behaviour of add_agent_status_check,
   start_periodic_l3_agent_status_check and
   start_periodic_dhcp_agent_status_check methods is deprecated but kept
   for using in third part plugins for backward compatibility
2) new add_agent_status_check_worker, add_periodic_l3_agent_status_check
   and add_periodic_dhcp_agent_status_check method are implemented
   instead and are used for implementing plugins in neutron codebase

Closes-Bug: #1569404

Change-Id: I3a32a95489831f0d862930384309eefdc881d8f6
2016-06-02 21:26:08 +00:00
Carl Baldwin b1cdba1696 Revert "Remove threading before process forking"
I think this needs a little more thought.  This broke OVN at least and
I don't think that's good.  We need to figure out how to be compatible 
with existing plugins, even out of tree ones.

This reverts commit 1cafff0871.

Change-Id: Ie087fb11213cc85911483c2d32c463fa9c973e54
2016-05-05 21:07:21 +00:00
dukhlov 1cafff0871 Remove threading before process forking
Forking a process when multiple threads are running is an unsafe
operation and could cause a lot of problems because only current
thread will continue working in child thread. Any locked by other
thread resource will remain locked forever.

We faced with this problem during oslo.messaging development and
added workaround to hide this problem:
https://review.openstack.org/#/c/274255/

I tried to fix this problem in oslo.service:
https://review.openstack.org/#/c/270832/

but oslo folks said that this fix is ugly and it is wrong way to add
workarounds to common libraries because projects use them incorrectly.
I think that is fair.

So this patch fixes incorrect usage of oslo libraries. In this patch
I extended functionality of NeutronWorker and add there
`worker_process_count` parameter which determines how many processes
should be spawned for this worker. If `worker_process_count` = 0 - don't
create process and spawn thread in scope of current process for worker

Then I moved all background tasks to workers and return them by
`get_workers` method. start_plugin_workers collects plugin's workers
using `get_workers` method and starts in ProcessLauncher first workers
with `worker_process_count` > 0 and only after this starts threaded
workers by simple Launcher

Closes-bug: #1569404

Change-Id: I0544f1d47ae53d572adda872847a56fa0b202d2e
2016-05-03 21:54:23 +03:00
Kevin Benton d21d9798fe Don't decide web_framework before config parse
This ensures that the config files passed on the CLI
are parsed before the choice is made based on config options
to launch pecan/homegrown wsgi handler.

Closes-Bug: #1537292
Change-Id: I577befea74d84d611cd198c92c54ae3651e2d921
2016-01-22 17:44:35 -08:00
Doug Wiegley dd726ed494 Move i18n to _i18n, as per oslo_i18n guidelines
- This does NOT break other projects that rely on neutron.i18n,
  as this change includes a debtcollector shim to maintain those
  older entry points, until they can migrate.
- Also updates _i18n.py to the latest pattern defined by oslo_i18n
- Guidance and template are from the reference:
  http://docs.openstack.org/developer/oslo.i18n/usage.html

Partially-Closes-Bug: #1519493
Change-Id: I1aa3a5fd837d9156da4643a367013c869ed8bf9d
2015-12-01 19:29:10 -07:00
Salvatore Orlando fb69960f1e Introduce a separate RPC server
As the Pecan server only server REST requests over HTTP, this
patch introduces a new server implementing the RPC over AMQP
endpoints for agent/server communication.

However, the REST server does not yet have the ability to send
notifications to the RPC server or directly to the agents.
This patch simply adapts the ML2 plugin to run the RPC notifiers
only when initialized in the pecan server, so that notification
to agents can still be sent.

This patch therefore is tantamount to a poor man's
implementation of REST/RPC separation which will be iteratively
improved.

Change-Id: Ie471869d9b2793acdc412f13507038433f6a72c6
2015-09-17 05:18:32 -07:00