From 4f2d4d03f3a1a0a277dd04ec2abcbee2d4018fa2 Mon Sep 17 00:00:00 2001 From: jiajunsu Date: Wed, 16 May 2018 16:40:49 +0800 Subject: [PATCH] Remove args(os=False) in monkey_patch The first patch introduced os=False is https://review.openstack.org/#/c/11556/ But there is no explaination why nova should not monkey_patch `os` module. The args(os=False) make nova process has to wait while calling os.(['fdopen', 'read', 'write', 'wait', 'waitpid', 'open']) , which seems to be unnecessary. For nova-compute running on Windows(Hyper-v), `os` module should not be patched, because Windows pipes don't support non-blocking I/O. I add a comment to note that. [1] https://github.com/eventlet/eventlet/blob/v0.23.0/eventlet/green/os.py#L12 Change-Id: I8b456676a04b9066cb2b570060c0d95cd4fe69f8 --- nova/test.py | 2 +- nova/tests/functional/__init__.py | 2 +- nova/utils.py | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nova/test.py b/nova/test.py index ea7fa2d04779..4a7fefc8730b 100644 --- a/nova/test.py +++ b/nova/test.py @@ -22,7 +22,7 @@ inline callbacks. """ import eventlet # noqa -eventlet.monkey_patch(os=False) +eventlet.monkey_patch() import abc import copy diff --git a/nova/tests/functional/__init__.py b/nova/tests/functional/__init__.py index e74717f867e1..71f41e30f33e 100644 --- a/nova/tests/functional/__init__.py +++ b/nova/tests/functional/__init__.py @@ -22,4 +22,4 @@ import eventlet -eventlet.monkey_patch(os=False) +eventlet.monkey_patch() diff --git a/nova/utils.py b/nova/utils.py index a890d3ea67a4..c544e326d827 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1293,9 +1293,13 @@ def generate_hostid(host, project_id): def monkey_patch(): if debugger.enabled(): # turn off thread patching to enable the remote debugger - eventlet.monkey_patch(os=False, thread=False) - else: + eventlet.monkey_patch(thread=False) + elif os.name == 'nt': + # for nova-compute running on Windows(Hyper-v) + # pipes don't support non-blocking I/O eventlet.monkey_patch(os=False) + else: + eventlet.monkey_patch() # NOTE(rgerganov): oslo.context is storing a global thread-local variable # which keeps the request context for the current thread. If oslo.context