summaryrefslogtreecommitdiff
path: root/nova/utils.py
diff options
context:
space:
mode:
authorAlexandre Arents <alexandre.arents@corp.ovh.com>2020-06-09 14:17:37 +0000
committerAlexandre Arents <alexandre.arents@corp.ovh.com>2020-06-30 07:21:02 +0000
commitbe9b7358473ca5276cff3c6491f88cd512d118b8 (patch)
tree717563f8a8daa332c996b570aa2df7765fc8fa40 /nova/utils.py
parent6bb0c4fdabb98f168c530617b7c7a8f9396075fc (diff)
downloadnova-be9b7358473ca5276cff3c6491f88cd512d118b8.tar.gz
Snapshot: offload glance upload in a native thread
Execute glance upload in a native thread as it may block the current coroutine until it completes. Despite the fact we use eventlet monkey_patching [1] to achieve cooperative yielding for network IO, file IO on busy file system may still get nova-compute hanging. Stick those IO in a native thread using eventlet tpool.execute() [2] avoid this issue. [1] https://eventlet.net/doc/patching.html [2] https://eventlet.net/doc/threading.html Closes-Bug: #1874032 Change-Id: I8dbc579e0037969aab4f2bb500fccfbde4190726
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index ed26d006f2..e2d9d5e657 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -698,6 +698,11 @@ def spawn_n(func, *args, **kwargs):
eventlet.spawn_n(context_wrapper, *args, **kwargs)
+def tpool_execute(func, *args, **kwargs):
+ """Run func in a native thread"""
+ eventlet.tpool.execute(func, *args, **kwargs)
+
+
def is_none_string(val):
"""Check if a string represents a None value.
"""