Read the environment variable EVENTLET_MONKEYPATCH

Since eventlet 0.39.0 [1] it is possible to you set an environment
variable ``EVENTLET_MONKEYPATCH=1`` to get patching as early as
possible in Python startup, which may avoid some problems.

[1]b754135b04

Related-Bug: #2091538
Topic: eventlet-deprecation
Change-Id: I928e32ea736bdb3357fdbb1de6646e69db3159d7
This commit is contained in:
Rodolfo Alonso Hernandez 2024-12-11 14:08:30 +00:00 committed by Rodolfo Alonso
parent 046fd37d9d
commit 5ee7ac1261
2 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import eventlet
@ -22,6 +24,13 @@ IS_MONKEY_PATCHED = False
def monkey_patch():
global IS_MONKEY_PATCHED
if not IS_MONKEY_PATCHED:
# This environment variable will be used in eventlet 0.39.0
# https://github.com/eventlet/eventlet/commit/
# b754135b045306022a537b5797f2cb2cf47ba49b
if os.getenv('EVENTLET_MONKEYPATCH') == '1':
IS_MONKEY_PATCHED = True
return
eventlet.monkey_patch()
# pylint: disable=import-outside-toplevel

View File

@ -0,0 +1,12 @@
---
features:
- |
Since eventlet 0.39.0, a new environment variable
``EVENTLET_MONKEYPATCH=1`` can be defined to get patching as early as
possible in Python startup.
upgrade:
- |
Neutron can read the environment variable ``EVENTLET_MONKEYPATCH=1`` in
order to not monkey patch the system libraries. If this environment
variable is set and the eventlet version is lower, the process won't be
patched.