diff --git a/oslo_cache/_bmemcache_pool.py b/oslo_cache/_bmemcache_pool.py index a442757f..2edf4521 100644 --- a/oslo_cache/_bmemcache_pool.py +++ b/oslo_cache/_bmemcache_pool.py @@ -14,6 +14,7 @@ # under the License. """Thread-safe connection pool for python-binary-memcached.""" +import debtcollector try: import eventlet except ImportError: @@ -25,6 +26,16 @@ from oslo_log import log LOG = log.getLogger(__name__) +if eventlet and eventlet.patcher.is_monkey_patched('thread'): + debtcollector.deprecate( + "Eventlet support is deprecated " + "and will be soon no longer supported. " + "This backend was originally designed to be compatible with Eventlet " + "and with monkey patching, so using this backend in an environment " + "with eventlet is now deprecated. " + "Please migrate your code and stop monkey patching your environment.") + + class _BMemcacheClient(bmemcached.Client): """Thread global memcache client diff --git a/oslo_cache/_memcache_pool.py b/oslo_cache/_memcache_pool.py index f31f49fa..a3855a9d 100644 --- a/oslo_cache/_memcache_pool.py +++ b/oslo_cache/_memcache_pool.py @@ -22,6 +22,7 @@ import queue import threading import time +import debtcollector try: import eventlet except ImportError: @@ -36,6 +37,16 @@ from oslo_cache import exception LOG = log.getLogger(__name__) +if eventlet and eventlet.patcher.is_monkey_patched('thread'): + debtcollector.deprecate( + "Eventlet support is deprecated " + "and will be soon no longer supported. " + "This backend was originally designed to be compatible with Eventlet " + "and with monkey patching, so using this backend in an environment " + "with eventlet is now deprecated. " + "Please migrate your code and stop monkey patching your environment.") + + class _MemcacheClient(memcache.Client): """Thread global memcache client diff --git a/releasenotes/notes/deprecate-memcache_pool-backend-98f1267e4e912004.yaml b/releasenotes/notes/deprecate-memcache_pool-backend-98f1267e4e912004.yaml new file mode 100644 index 00000000..90f7b76b --- /dev/null +++ b/releasenotes/notes/deprecate-memcache_pool-backend-98f1267e4e912004.yaml @@ -0,0 +1,11 @@ +--- +deprecations: + - | + Eventlet usages are deprecated and the removal of Eventlet from + OpenStack `is planned `_, + for this reason, using the ``memcache_pool`` backend of oslo.cache + in an environment using eventlet is now deprecated. + The support of Eventlet will be soon removed from oslo.cache. + + Please start considering removing your internal Eventlet usages and + start migrating your stack. diff --git a/requirements.txt b/requirements.txt index c3e0e0e7..122d81fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ oslo.config>=8.1.0 # Apache-2.0 oslo.i18n>=5.0.0 # Apache-2.0 oslo.log>=4.2.1 # Apache-2.0 oslo.utils>=4.2.0 # Apache-2.0 +debtcollector>=3.0.0 # Apache-2.0