diff options
| author | Michael Still <mikal@stillhq.com> | 2013-04-08 07:46:34 +1000 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2013-04-09 08:48:47 +1000 |
| commit | f2e49ad3128856785f6ea460b1968bf03dc87e99 (patch) | |
| tree | b2088d2ef0bd52270d7642f7c766b7238ee683e6 /nova/cmd | |
| parent | 88cd09445ea46bba0f62ef58894fd92243021a88 (diff) | |
| download | nova-f2e49ad3128856785f6ea460b1968bf03dc87e99.tar.gz nova-f2e49ad3128856785f6ea460b1968bf03dc87e99.tar.xz nova-f2e49ad3128856785f6ea460b1968bf03dc87e99.zip | |
Import eventlet in __init__.py
All of this is because if dnspython is present in your environment then
eventlet monkeypatches socket.getaddrinfo() with an implementation
which doesn't work for IPv6. To turn this off you need to set an
environment variable before you do the import.
Resolves bug 1164822.
Change-Id: I2382db7b3ac4a2d940e0c45dfe3d48f499de2f16
Diffstat (limited to 'nova/cmd')
| -rw-r--r-- | nova/cmd/__init__.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/nova/cmd/__init__.py b/nova/cmd/__init__.py index cc641efc0..9ee46ea44 100644 --- a/nova/cmd/__init__.py +++ b/nova/cmd/__init__.py @@ -13,7 +13,24 @@ # License for the specific language governing permissions and limitations # under the License. +# TODO(mikal): move eventlet imports to nova.__init__ once we move to PBR +import os +import sys + +# NOTE(mikal): All of this is because if dnspython is present in your +# environment then eventlet monkeypatches socket.getaddrinfo() with an +# implementation which doesn't work for IPv6. What we're checking here is +# that the magic environment variable was set when the import happened. +if ('eventlet' in sys.modules and + os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes'): + raise ImportError('eventlet imported before nova/cmd/__init__ ' + '(env var set to %s)' + % os.environ.get('EVENTLET_NO_GREENDNS')) + +os.environ['EVENTLET_NO_GREENDNS'] = 'yes' + import eventlet + eventlet.monkey_patch(os=False) import gettext |
