Browse Source

Monkey patch original current_thread _active

Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: Ida548b4bec00530418fd3d7ab254e971af77d3fe
Closes-Bug: #1863021
changes/54/724754/3
Corey Bryant 1 year ago
parent
commit
9f0aae5b58
  1. 7
      cinder/cmd/api.py
  2. 7
      cinder/cmd/backup.py
  3. 7
      cinder/cmd/scheduler.py
  4. 7
      cinder/cmd/volume.py

7
cinder/cmd/api.py

@ -22,6 +22,13 @@ import sys
import eventlet # noqa
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr

7
cinder/cmd/backup.py

@ -26,6 +26,13 @@ import sys
# share the same context.
import eventlet
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging

7
cinder/cmd/scheduler.py

@ -22,6 +22,13 @@ import sys
import eventlet
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr

7
cinder/cmd/volume.py

@ -33,6 +33,13 @@ if os.name == 'nt':
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context

Loading…
Cancel
Save