summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtom Lifshitz <alifshit@redhat.com>2020-09-11 10:23:30 -0400
committerArtom Lifshitz <alifshit@redhat.com>2020-09-13 18:30:35 -0400
commit4984b3b75b5f7086b7464d9acb940e3fb0334a5e (patch)
tree7a45bd7f81512efe0a469c9ede38d5947d902104
parent90c1b6afc575c07e3e2874c506c7602ef76f13d5 (diff)
downloadnova-4984b3b75b5f7086b7464d9acb940e3fb0334a5e.tar.gz
Correctly disable greendns
Previously, we were setting the environment variable to disable greendns in eventlet *after* import eventlet. This has no effect, as eventlet processes environment variables at import time. This patch moves the setting of EVENTLET_NO_GREENDNS before importing eventlet in order to correctly disable greendns. Closes-bug: 1895322 Change-Id: I4deed815c8984df095019a7f61d089f233f1fc66 (cherry picked from commit 7c1d964faab33a02fe2366b5194611252be045fc) (cherry picked from commit 79e6b7fd30a04cdb2374abcaf496b6b5b76084ff)
-rw-r--r--nova/monkey_patch.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/nova/monkey_patch.py b/nova/monkey_patch.py
index a07ff91dac..160bb1a661 100644
--- a/nova/monkey_patch.py
+++ b/nova/monkey_patch.py
@@ -22,6 +22,19 @@ import os
def _monkey_patch():
+ # See https://bugs.launchpad.net/nova/+bug/1164822
+ # TODO(mdbooth): This feature was deprecated and removed in eventlet at
+ # some point but brought back in version 0.21.0, presumably because some
+ # users still required it to work round issues. However, there have been a
+ # number of greendns fixes in eventlet since then. Specifically, it looks
+ # as though the originally reported IPv6 issue may have been fixed in
+ # version 0.24.0. We should remove this when we can confirm that the
+ # original issue is fixed.
+ # NOTE(artom) eventlet processes environment variables at import-time. We
+ # therefore set this here, before importing eventlet, in order to correctly
+ # disable greendns.
+ os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
+
# NOTE(mdbooth): Anything imported here will not be monkey patched. It is
# important to take care not to import anything here which requires monkey
# patching.
@@ -39,16 +52,6 @@ def _monkey_patch():
problems = (set(['urllib3', 'oslo_context.context']) &
set(sys.modules.keys()))
- # See https://bugs.launchpad.net/nova/+bug/1164822
- # TODO(mdbooth): This feature was deprecated and removed in eventlet at
- # some point but brought back in version 0.21.0, presumably because some
- # users still required it to work round issues. However, there have been a
- # number of greendns fixes in eventlet since then. Specifically, it looks
- # as though the originally reported IPv6 issue may have been fixed in
- # version 0.24.0. We should remove this when we can confirm that the
- # original issue is fixed.
- os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
-
if debugger.enabled():
# turn off thread patching to enable the remote debugger
eventlet.monkey_patch(thread=False)