Fix eventlet detection
Eventlet may be installed, but not used for example projects like octavia. Improve autodetection mechanism by trying to import module and check if it is actually patched. Closes-Bug: #2039346 Change-Id: I860abe953ce945bb5152c77a7daeb6aa1003512b (cherry picked from commita1fe1b9cfb
) (cherry picked from commita6c4f8a9c6
)
This commit is contained in:
parent
f6a0a5786e
commit
287e138adf
|
@ -40,6 +40,7 @@ except ImportError:
|
|||
syslog = None
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import eventletutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
|
||||
|
@ -272,8 +273,7 @@ def _fix_eventlet_logging():
|
|||
"""
|
||||
|
||||
# If eventlet was not loaded before call to setup assume it's not used.
|
||||
eventlet = sys.modules.get('eventlet')
|
||||
if eventlet:
|
||||
if eventletutils.is_monkey_patched('thread'):
|
||||
import eventlet.green.threading
|
||||
from oslo_log import pipe_mutex
|
||||
logging.threading = eventlet.green.threading
|
||||
|
|
Loading…
Reference in New Issue