From 3e2eccea4a5146c555be8dfcbb28e4906940a72d Mon Sep 17 00:00:00 2001 From: Andy Ning Date: Thu, 3 Oct 2019 11:23:31 -0400 Subject: [PATCH] Moved eventlet monkey_patch before app is imported In cmd/api.py the eventlet monkey_patch has been moved to be before api app import. This is because if it's called too late, the api app and db api module will be loaded without awareness of eventlet, the threading local context in db api won't be eventlet compatible, causing DB parallel operation errors. Change-Id: I294657fc910c6a4696f91308d60697d005dc53b0 Closes-Bug: 1846411 Signed-off-by: Andy Ning --- dcdbsync/cmd/api.py | 3 ++- dcmanager/cmd/api.py | 3 ++- dcorch/cmd/api.py | 3 ++- dcorch/cmd/api_proxy.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dcdbsync/cmd/api.py b/dcdbsync/cmd/api.py index 898891c87..251610a34 100644 --- a/dcdbsync/cmd/api.py +++ b/dcdbsync/cmd/api.py @@ -25,6 +25,8 @@ import sys import eventlet +eventlet.monkey_patch(os=False) + from oslo_config import cfg from oslo_log import log as logging from oslo_service import systemd @@ -41,7 +43,6 @@ from dcdbsync.common import messaging CONF = cfg.CONF config.register_options() LOG = logging.getLogger('dcdbsync.api') -eventlet.monkey_patch(os=False) def main(): diff --git a/dcmanager/cmd/api.py b/dcmanager/cmd/api.py index 2f3bba76f..d62912fa3 100644 --- a/dcmanager/cmd/api.py +++ b/dcmanager/cmd/api.py @@ -27,6 +27,8 @@ import sys import eventlet +eventlet.monkey_patch(os=False) + from oslo_config import cfg from oslo_log import log as logging from oslo_service import systemd @@ -43,7 +45,6 @@ from dcorch.common import messaging as dcorch_messaging CONF = cfg.CONF config.register_options() LOG = logging.getLogger('dcmanager.api') -eventlet.monkey_patch(os=False) def main(): diff --git a/dcorch/cmd/api.py b/dcorch/cmd/api.py index fcfc60e23..3fd66ce3e 100644 --- a/dcorch/cmd/api.py +++ b/dcorch/cmd/api.py @@ -20,6 +20,8 @@ import sys import eventlet +eventlet.monkey_patch(os=False) + from oslo_config import cfg from oslo_log import log as logging from oslo_service import systemd @@ -36,7 +38,6 @@ from dcorch.common import messaging CONF = cfg.CONF config.register_options() LOG = logging.getLogger('dcorch.api') -eventlet.monkey_patch(os=False) def main(): diff --git a/dcorch/cmd/api_proxy.py b/dcorch/cmd/api_proxy.py index 74229a0dd..4df471f96 100644 --- a/dcorch/cmd/api_proxy.py +++ b/dcorch/cmd/api_proxy.py @@ -20,6 +20,8 @@ import sys import eventlet +eventlet.monkey_patch(os=False) + from oslo_config import cfg from oslo_log import log as logging from oslo_service import systemd @@ -58,7 +60,6 @@ config.register_options() CONF.register_cli_opts(proxy_cli_opts) LOG = logging.getLogger('dcorch.api.proxy') -eventlet.monkey_patch(os=False) def main():