Add a new option to enable signals
When running behind a wsgi server like apache/mod_wsgi, neutron should not register on Signals, it will overlap with the Signals registered by the wsgi server. Related-Bug: #2021814 Change-Id: I3c74846a8337d019f1ab6759ebb03f18c3f00238 Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
This commit is contained in:
parent
0ceecd3282
commit
878ea0dfd5
@ -165,6 +165,10 @@ core_opts = [
|
||||
help=_('IPv6 address of this host. If no address is provided '
|
||||
'and one cannot be determined, ::1 will be '
|
||||
'used.')),
|
||||
cfg.BoolOpt('enable_signals', default=True,
|
||||
help=_('If False, neutron-server will not listen for signals '
|
||||
'like SIGINT or SIGTERM. This is useful when running '
|
||||
'behind a WSGI server like apache/mod_wsgi.')),
|
||||
]
|
||||
|
||||
core_cli_opts = [
|
||||
|
@ -154,9 +154,12 @@ class OVOServerRpcInterface(object):
|
||||
Generates RPC callback notifications on ML2 object changes.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, enable_signals=True):
|
||||
self._rpc_pusher = resources_rpc.ResourcesPushRpcApi()
|
||||
self._setup_change_handlers()
|
||||
# When running behind wsgi server (like apache2/mod_wsgi)
|
||||
# we should not register signals
|
||||
if enable_signals:
|
||||
_setup_change_handlers_cleanup()
|
||||
LOG.debug("ML2 OVO RPC backend initialized.")
|
||||
|
||||
|
@ -407,7 +407,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
self.ovo_notifier = None
|
||||
rpc_workers = conf_service.get_rpc_workers()
|
||||
if rpc_workers is None or rpc_workers >= 1:
|
||||
self.ovo_notifier = ovo_rpc.OVOServerRpcInterface()
|
||||
self.ovo_notifier = ovo_rpc.OVOServerRpcInterface(
|
||||
cfg.CONF.enable_signals)
|
||||
self.notifier = rpc.AgentNotifierApi(topics.AGENT)
|
||||
if cfg.CONF.enable_traditional_dhcp:
|
||||
self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
|
||||
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new config option ``enable_signals`` has been added to neutron.conf to
|
||||
control whether neutron-server registers signal handlers or not (like
|
||||
SIGTERM, etc). The default value for this new option is True to mimic the
|
||||
original behavior of registering signal handlers.
|
||||
The recommendation is to set this option to False when neutron-server is
|
||||
running behind a WSGI server, because in that situation the signals are
|
||||
taken over by the WSGI server and neutron will print a stack trace letting
|
||||
us know that signals cannot be registered.
|
Loading…
Reference in New Issue
Block a user