Correct initialization order for logging to use eventlet locks

oslo logging needs to be reconfigured after eventlet patching

Change-Id: I717ecfd1c0f9b791a57f69325365144692f1e0b6
Closes-Bug: 1420788
This commit is contained in:
Alexander Makarov 2015-02-11 18:42:32 +03:00
parent c0d56ecdf4
commit 6fefe72469
2 changed files with 17 additions and 12 deletions

View File

@ -23,7 +23,8 @@ from keystone import config
CONF = cfg.CONF
def configure(version=None, config_files=None):
def configure(version=None, config_files=None,
pre_setup_logging_fn=lambda: None):
config.configure()
sql.initialize()
config.set_default_for_default_log_levels()
@ -31,6 +32,7 @@ def configure(version=None, config_files=None):
CONF(project='keystone', version=version,
default_config_files=config_files)
pre_setup_logging_fn()
config.setup_logging()

View File

@ -103,6 +103,18 @@ def _get_workers(worker_type_config_opt):
return worker_count
def configure_threading():
monkeypatch_thread = not CONF.standard_threads
pydev_debug_url = utils.setup_remote_pydev_debug()
if pydev_debug_url:
# in order to work around errors caused by monkey patching we have to
# set the thread to False. An explanation is here:
# http://lists.openstack.org/pipermail/openstack-dev/2012-August/
# 000794.html
monkeypatch_thread = False
environment.use_eventlet(monkeypatch_thread)
def run(possible_topdir):
dev_conf = os.path.join(possible_topdir,
'etc',
@ -113,20 +125,11 @@ def run(possible_topdir):
common.configure(
version=pbr.version.VersionInfo('keystone').version_string(),
config_files=config_files)
config_files=config_files,
pre_setup_logging_fn=configure_threading)
paste_config = config.find_paste_config()
monkeypatch_thread = not CONF.standard_threads
pydev_debug_url = utils.setup_remote_pydev_debug()
if pydev_debug_url:
# in order to work around errors caused by monkey patching we have to
# set the thread to False. An explanation is here:
# http://lists.openstack.org/pipermail/openstack-dev/2012-August/
# 000794.html
monkeypatch_thread = False
environment.use_eventlet(monkeypatch_thread)
def create_servers():
admin_worker_count = _get_workers('admin_workers')
public_worker_count = _get_workers('public_workers')