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.

Change-Id: Ic1ad7a38cf21256d9446fd2c0270610b4cfe75c5
Closes-Bug: #1773924
This commit is contained in:
yuanyue 2018-05-29 04:57:32 -04:00 committed by Eric Harney
parent 9d263f711d
commit 219961bff6
1 changed files with 11 additions and 7 deletions

View File

@ -17,16 +17,13 @@
"""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