Merge "Read the environment variable EVENTLET_MONKEYPATCH"

This commit is contained in:
Zuul 2025-01-08 17:18:14 +00:00 committed by Gerrit Code Review
commit 8a75a54707
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.