Fix cinder-volume uses latest req-id for all log calls
Currently all log entries will have the request ID of the
latest request that was received in the cinder-volume service.
To fix this we just move the monkey patching to the top in the
imports.
Closes-Bug:
"""Starter script for Cinder Volume."""
-import logging as python_logging
-import os
-import re
-
import eventlet
import eventlet.tpool
+import os
-from cinder import exception
-from cinder import objects
-
+# Monkey patching must go before the oslo.log import, otherwise
+# oslo.context will not use greenthread thread local and all greenthreads
+# will share the same context.
if os.name == 'nt':
# eventlet monkey patching the os module causes subprocess.Popen to fail
# on Windows when using pipes due to missing non-blocking IO support.
@@ -34,6 +31,13 @@ if os.name == 'nt':
else:
eventlet.monkey_patch()
+import logging as python_logging
+import re
+
+from cinder import exception
+from cinder import objects
+
+
import shlex
import sys
