Enable split logging for cinder-glanceclient interaction

To enable split logging functionality [1], need to register
'split_loggers' conf option under [default] section of cinder.conf

This patch registers 'split_loggers' conf option under [default]
so that operator can set value of 'split_loggers' to True to
enable split logging.

[1]: https://review.openstack.org/#/c/505764/

DocImpact
Change-Id: I05639133c7e5770e810be97d8c6bb98450c8c9ba
This commit is contained in:
Neha Alhat 2018-06-26 17:39:31 +05:30
parent 5306a20150
commit 70c48ff6bb
4 changed files with 23 additions and 4 deletions

View File

@ -175,6 +175,9 @@ global_opts = [
cfg.StrOpt('group_api_class',
default='cinder.group.api.API',
help='The full class name of the group API class'),
cfg.BoolOpt('split_loggers',
default=False,
help='Log requests to multiple loggers.')
]
CONF.register_opts(core_opts)

View File

@ -114,14 +114,16 @@ def _create_glance_client(context, netloc, use_ssl):
if use_ssl and CONF.auth_strategy == 'noauth':
params = {'insecure': CONF.glance_api_insecure,
'cacert': CONF.glance_ca_certificates_file,
'timeout': CONF.glance_request_timeout
'timeout': CONF.glance_request_timeout,
'split_loggers': CONF.split_loggers
}
if CONF.auth_strategy == 'keystone':
global _SESSION
if not _SESSION:
config_options = {'insecure': CONF.glance_api_insecure,
'cacert': CONF.glance_ca_certificates_file,
'timeout': CONF.glance_request_timeout
'timeout': CONF.glance_request_timeout,
'split_loggers': CONF.split_loggers
}
_SESSION = ks_session.Session().load_from_options(**config_options)

View File

@ -972,7 +972,8 @@ class TestGlanceImageServiceClient(test.TestCase):
config_options = {'insecure': False,
'cacert': None,
'timeout': None}
'timeout': None,
'split_loggers': False}
mock_get_auth_plugin.return_value = context._ContextAuthPlugin
mock_load.return_value = session.Session
@ -1003,7 +1004,8 @@ class TestGlanceImageServiceClient(test.TestCase):
config_options = {'insecure': False,
'cacert': '/opt/stack/data/ca-bundle.pem',
'timeout': 60}
'timeout': 60,
'split_loggers': False}
mock_get_auth_plugin.return_value = context._ContextAuthPlugin
mock_load.return_value = session.Session

View File

@ -0,0 +1,12 @@
---
features:
- |
Added boolean conf option 'split_loggers' in [default] section of
cinder.conf to `enable split logging`_ functionality. The default
value of split_loggers option is set to False. Operator can set it's
value to True to split HTTP content into subloggers to allow for
fine-grained control of what is logged and how. This new config option
'split_loggers' should be enabled only when keystoneauth log level is
set to DEBUG in 'default_log_levels' config option.
.. _`enable split logging`: https://docs.openstack.org/keystoneauth/latest/using-sessions.html#logging