deprecate eventlet monkey patch within oslo.log

Change-Id: I35797e0d03b69d77733a49c80b6e06c964fb48bf
This commit is contained in:
Hervé Beraud
2025-01-30 10:52:39 +01:00
committed by Takashi Kajinami
parent 2ead294761
commit e9730dacb2
3 changed files with 25 additions and 8 deletions

View File

@ -38,6 +38,7 @@ try:
except ImportError:
syslog = None
import debtcollector
from oslo_config import cfg
from oslo_utils import eventletutils
from oslo_utils import importutils
@ -275,14 +276,18 @@ def _fix_eventlet_logging():
global _EVENTLET_FIX_APPLIED
# If eventlet was not loaded before call to setup assume it's not used.
if eventletutils.is_monkey_patched('thread') and not _EVENTLET_FIX_APPLIED:
import eventlet.green.threading
from oslo_log import pipe_mutex
logging.threading = eventlet.green.threading
logging._lock = logging.threading.RLock()
logging.Handler.createLock = pipe_mutex.pipe_createLock
_EVENTLET_FIX_APPLIED = True
if eventletutils.is_monkey_patched('thread'):
debtcollector.deprecate(
"Eventlet support is deprecated and will be removed")
# If eventlet was not loaded before call to setup assume it's not used.
if not _EVENTLET_FIX_APPLIED:
import eventlet.green.threading
from oslo_log import pipe_mutex
logging.threading = eventlet.green.threading
logging._lock = logging.threading.RLock()
logging.Handler.createLock = pipe_mutex.pipe_createLock
_EVENTLET_FIX_APPLIED = True
def setup(conf, product_name, version='unknown', *, fix_eventlet=True):

View File

@ -0,0 +1,11 @@
---
deprecations:
- |
Eventlet usages are deprecated and the removal of Eventlet from
OpenStack `is planned <https://governance.openstack.org/tc//goals/proposed/remove-eventlet.html>`_,
for this reason, using oslo.log in a monkey
patched environment is now deprecated. The support of Eventlet will be
soon removed from oslo.log.
Please start considering removing your internal Eventlet usages and
start migrating your stack.

View File

@ -9,3 +9,4 @@ oslo.i18n>=3.20.0 # Apache-2.0
oslo.utils>=3.36.0 # Apache-2.0
oslo.serialization>=2.25.0 # Apache-2.0
python-dateutil>=2.7.0 # BSD
debtcollector>=3.0.0 # Apache-2.0