summaryrefslogtreecommitdiff
path: root/ironic/nova
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2014-05-31 12:36:32 -0700
committerChris Behrens <cbehrens@codestud.com>2014-06-17 10:42:18 -0700
commit1676118664d12a8455c5cbe9d8ccd1def7e98632 (patch)
tree3a847b30b6ea19dfc5640a77e306a48c08b05845 /ironic/nova
parent58b245405622a496aa760c51b8fd45d806589ea6 (diff)
downloadironic-1676118664d12a8455c5cbe9d8ccd1def7e98632.tar.gz
Allow overriding the log level for ironicclient
oslo provides a 'default_log_levels' conf variable for overriding logging levels for certain modules. This could be used to override ironicclient's default logging level, however it requires re-setting all of the log levels for oslo's defaults. This is rather inconvenient. I think it makes sense to allow the ironic virt driver to have an easy config option for this. When in debug mode, ironicclient logs every single API call and response. In an environment with a lot of nodes, it clutters the logs. This adds a 'client_log_level' config option to the 'ironic' config section in nova. If it's unset (default), there's no change in behavior. If it's set, it takes precedence over the 'default_log_levels', 'verbose', and 'debug' settings that one may have in nova.conf Example usage: [ironic] client_log_level=INFO DocImpact Closes-bug: 1325663 Change-Id: Id16d5017e1d9ae5d2b15ff3daca177ab36a32869
Diffstat (limited to 'ironic/nova')
-rw-r--r--ironic/nova/virt/ironic/driver.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ironic/nova/virt/ironic/driver.py b/ironic/nova/virt/ironic/driver.py
index 2763f16bb..6ffba1681 100644
--- a/ironic/nova/virt/ironic/driver.py
+++ b/ironic/nova/virt/ironic/driver.py
@@ -20,6 +20,7 @@
A driver wrapping the Ironic API, such that Nova may provision
bare metal resources.
"""
+import logging as py_logging
from ironicclient import exc as ironic_exception
from oslo.config import cfg
@@ -57,6 +58,10 @@ opts = [
help='Ironic keystone auth token.'),
cfg.StrOpt('admin_url',
help='Keystone public API endpoint.'),
+ cfg.StrOpt('client_log_level',
+ help='Log level override for ironicclient. Set this in '
+ 'order to override the global "default_log_levels", '
+ '"verbose", and "debug" settings.'),
cfg.StrOpt('pxe_bootfile_name',
help='This gets passed to Neutron as the bootfile dhcp '
'parameter when the dhcp_options_enabled is set.',
@@ -176,6 +181,12 @@ class IronicDriver(virt_driver.ComputeDriver):
self.extra_specs = extra_specs
+ icli_log_level = CONF.ironic.client_log_level
+ if icli_log_level:
+ level = py_logging.getLevelName(icli_log_level)
+ logger = py_logging.getLogger('ironicclient')
+ logger.setLevel(level)
+
def _node_resources_unavailable(self, node_obj):
"""Determines whether the node's resources should be presented
to Nova for use based on the current power and maintenance state.