Ironic: fix log level manipulation

This moves log level manipulation back to the stdlib module, as oslo.log
does not have the methods required to do this.

Also deprecate this option, in favor of the standard logging
configuration, to be removed in Liberty.

Change-Id: I5c8435ddf7d6f50f367d23a2c586fafedae13cb0
Closes-Bug: #1439796
This commit is contained in:
Jim Rollenhagen 2015-04-02 10:48:24 -07:00
parent 430c92e3cd
commit d6baa2ae4d
2 changed files with 9 additions and 5 deletions

View File

@ -87,6 +87,9 @@ class IronicDriverTestCase(test.NoDBTestCase):
super(IronicDriverTestCase, self).setUp()
self.flags(**IRONIC_FLAGS)
# set client log config to exercise the code that manipulates it
CONF.set_override('client_log_level', 'DEBUG', group='ironic')
self.driver = ironic_driver.IronicDriver(None)
self.driver.virtapi = fake.FakeVirtAPI()
self.ctx = nova_context.get_admin_context()

View File

@ -22,6 +22,7 @@ bare metal resources.
"""
import base64
import gzip
import logging as py_logging
import shutil
import tempfile
import time
@ -75,9 +76,11 @@ opts = [
cfg.StrOpt('admin_url',
help='Keystone public API endpoint.'),
cfg.StrOpt('client_log_level',
deprecated_for_removal=True,
help='Log level override for ironicclient. Set this in '
'order to override the global "default_log_levels", '
'"verbose", and "debug" settings.'),
'"verbose", and "debug" settings. '
'DEPRECATED: use standard logging configuration.'),
cfg.StrOpt('admin_tenant_name',
help='Ironic keystone tenant name.'),
cfg.IntOpt('api_max_retries',
@ -178,12 +181,10 @@ class IronicDriver(virt_driver.ComputeDriver):
self.node_cache = {}
self.node_cache_time = 0
# TODO(mrda): Bug ID 1365230 Logging configurability needs
# to be addressed
ironicclient_log_level = CONF.ironic.client_log_level
if ironicclient_log_level:
level = logging.getLevelName(ironicclient_log_level)
logger = logging.getLogger('ironicclient')
level = py_logging.getLevelName(ironicclient_log_level)
logger = py_logging.getLogger('ironicclient')
logger.setLevel(level)
self.ironicclient = client_wrapper.IronicClientWrapper()