Don't translate debug level logs in nova.cells

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: Idb346d04f24cbbc19b6e41af6e4782ac1c49d3b8
This commit is contained in:
Gary Kotton 2014-04-27 01:16:01 -07:00
parent fbc1a1606b
commit f213ec7b25
4 changed files with 15 additions and 14 deletions

View File

@ -696,8 +696,8 @@ class _TargetedMessageMethods(_BaseMessageMethods):
def update_capabilities(self, message, cell_name, capabilities):
"""A child cell told us about their capabilities."""
LOG.debug(_("Received capabilities from child cell "
"%(cell_name)s: %(capabilities)s"),
LOG.debug("Received capabilities from child cell "
"%(cell_name)s: %(capabilities)s",
{'cell_name': cell_name, 'capabilities': capabilities})
self.state_manager.update_cell_capabilities(cell_name,
capabilities)
@ -706,8 +706,8 @@ class _TargetedMessageMethods(_BaseMessageMethods):
def update_capacities(self, message, cell_name, capacities):
"""A child cell told us about their capacity."""
LOG.debug(_("Received capacities from child cell "
"%(cell_name)s: %(capacities)s"),
LOG.debug("Received capacities from child cell "
"%(cell_name)s: %(capacities)s",
{'cell_name': cell_name, 'capacities': capacities})
self.state_manager.update_cell_capacities(cell_name,
capacities)
@ -1031,7 +1031,7 @@ class _BroadcastMessageMethods(_BaseMessageMethods):
# instance_update.
instance['system_metadata'] = utils.instance_sys_meta(instance)
LOG.debug(_("Got update for instance: %(instance)s"),
LOG.debug("Got update for instance: %(instance)s",
{'instance': instance}, instance_uuid=instance_uuid)
self._apply_expected_states(instance)
@ -1067,7 +1067,7 @@ class _BroadcastMessageMethods(_BaseMessageMethods):
if not self._at_the_top():
return
instance_uuid = instance['uuid']
LOG.debug(_("Got update to delete instance"),
LOG.debug("Got update to delete instance",
instance_uuid=instance_uuid)
try:
self.db.instance_destroy(message.ctxt, instance_uuid,
@ -1082,7 +1082,7 @@ class _BroadcastMessageMethods(_BaseMessageMethods):
belongs to but the instance was requested to be deleted or
soft-deleted. So, we'll run it everywhere.
"""
LOG.debug(_("Got broadcast to %(delete_type)s delete instance"),
LOG.debug("Got broadcast to %(delete_type)s delete instance",
{'delete_type': delete_type}, instance=instance)
if delete_type == 'soft':
self.compute_api.soft_delete(message.ctxt, instance)
@ -1380,7 +1380,7 @@ class MessageRunner(object):
return
my_cell_info = self.state_manager.get_my_state()
capabs = self.state_manager.get_our_capabilities()
LOG.debug(_("Updating parents with our capabilities: %(capabs)s"),
LOG.debug("Updating parents with our capabilities: %(capabs)s",
{'capabs': capabs})
# We have to turn the sets into lists so they can potentially
# be json encoded when the raw message is sent.
@ -1400,7 +1400,7 @@ class MessageRunner(object):
return
my_cell_info = self.state_manager.get_my_state()
capacities = self.state_manager.get_our_capacities()
LOG.debug(_("Updating parents with our capacities: %(capacities)s"),
LOG.debug("Updating parents with our capacities: %(capacities)s",
{'capacities': capacities})
method_kwargs = {'cell_name': my_cell_info.name,
'capacities': capacities}

View File

@ -150,7 +150,7 @@ class CellsScheduler(base.Base):
weighted_cells = self.weight_handler.get_weighed_objects(
self.weigher_classes, cells, filter_properties)
LOG.debug(_("Weighted cells: %(weighted_cells)s"),
LOG.debug("Weighted cells: %(weighted_cells)s",
{'weighted_cells': weighted_cells})
target_cells = [cell.obj for cell in weighted_cells]
return target_cells
@ -166,7 +166,7 @@ class CellsScheduler(base.Base):
security_groups = request_spec['security_group']
block_device_mapping = request_spec['block_device_mapping']
LOG.debug(_("Scheduling with routing_path=%(routing_path)s"),
LOG.debug("Scheduling with routing_path=%(routing_path)s",
{'routing_path': message.routing_path})
for target_cell in target_cells:
@ -206,7 +206,7 @@ class CellsScheduler(base.Base):
security_groups = build_inst_kwargs['security_groups']
block_device_mapping = build_inst_kwargs['block_device_mapping']
LOG.debug(_("Building instances with routing_path=%(routing_path)s"),
LOG.debug("Building instances with routing_path=%(routing_path)s",
{'routing_path': message.routing_path})
for target_cell in target_cells:

View File

@ -428,7 +428,7 @@ class CellStateManagerDB(CellStateManager):
of whether it's time to do so.
"""
if force or self._time_to_sync():
LOG.debug(_("Updating cell cache from db."))
LOG.debug("Updating cell cache from db.")
self.last_cell_db_check = timeutils.utcnow()
ctxt = context.get_admin_context()
db_cells = self.db.cell_get_all(ctxt)
@ -465,7 +465,7 @@ class CellStateManagerFile(CellStateManager):
force_reload=force)
if reloaded:
LOG.debug(_("Updating cell cache from config file."))
LOG.debug("Updating cell cache from config file.")
self.cells_config_data = jsonutils.loads(data)
self._refresh_cells_from_dict(self.cells_config_data)

View File

@ -210,6 +210,7 @@ def no_translate_debug_logs(logical_line, filename):
"nova/network",
"nova/volume",
"nova/api",
"nova/cells",
]
if max([name in filename for name in dirs]):
if logical_line.startswith("LOG.debug(_("):