diff options
Diffstat (limited to 'nova/cells')
-rw-r--r-- | nova/cells/messaging.py | 58 | ||||
-rw-r--r-- | nova/cells/scheduler.py | 7 | ||||
-rw-r--r-- | nova/cells/state.py | 6 |
3 files changed, 41 insertions, 30 deletions
diff --git a/nova/cells/messaging.py b/nova/cells/messaging.py index d13677f74..1ea68d29f 100644 --- a/nova/cells/messaging.py +++ b/nova/cells/messaging.py @@ -202,7 +202,7 @@ class _BaseMessage(object): resp_value = sys.exc_info() failure = True LOG.exception(_("Error processing message locally: %(exc)s"), - locals()) + {'exc': exc}) return Response(self.routing_path, resp_value, failure) def _setup_response_queue(self): @@ -355,14 +355,18 @@ class _TargetedMessage(_BaseMessage): next_hop_num = current_hops + 1 dest_hops = target_cell.count(_PATH_CELL_SEP) if dest_hops < current_hops: + reason_args = {'target_cell': target_cell, + 'routing_path': routing_path} reason = _("destination is %(target_cell)s but routing_path " - "is %(routing_path)s") % locals() + "is %(routing_path)s") % reason_args raise exception.CellRoutingInconsistency(reason=reason) dest_name_parts = target_cell.split(_PATH_CELL_SEP) if (_PATH_CELL_SEP.join(dest_name_parts[:next_hop_num]) != routing_path): + reason_args = {'target_cell': target_cell, + 'routing_path': routing_path} reason = _("destination is %(target_cell)s but routing_path " - "is %(routing_path)s") % locals() + "is %(routing_path)s") % reason_args raise exception.CellRoutingInconsistency(reason=reason) next_hop_name = dest_name_parts[next_hop_num] if self.direction == 'up': @@ -371,8 +375,10 @@ class _TargetedMessage(_BaseMessage): next_hop = self.state_manager.get_child_cell(next_hop_name) if not next_hop: cell_type = 'parent' if self.direction == 'up' else 'child' + reason_args = {'cell_type': cell_type, + 'target_cell': target_cell} reason = _("Unknown %(cell_type)s when routing to " - "%(target_cell)s") % locals() + "%(target_cell)s") % reason_args raise exception.CellRoutingInconsistency(reason=reason) return next_hop @@ -396,7 +402,7 @@ class _TargetedMessage(_BaseMessage): except Exception as exc: exc_info = sys.exc_info() LOG.exception(_("Error locating next hop for message: %(exc)s"), - locals()) + {'exc': exc}) return self._send_response_from_exception(exc_info) if next_hop.is_me: @@ -424,7 +430,7 @@ class _TargetedMessage(_BaseMessage): exc_info = sys.exc_info() err_str = _("Failed to send message to cell: %(next_hop)s: " "%(exc)s") - LOG.exception(err_str, locals()) + LOG.exception(err_str, {'exc': exc, 'next_hop': next_hop}) self._cleanup_response_queue() return self._send_response_from_exception(exc_info) @@ -502,7 +508,7 @@ class _BroadcastMessage(_BaseMessage): except Exception as exc: exc_info = sys.exc_info() LOG.exception(_("Error locating next hops for message: %(exc)s"), - locals()) + {'exc': exc}) return self._send_response_from_exception(exc_info) # Short circuit if we don't need to respond @@ -522,7 +528,7 @@ class _BroadcastMessage(_BaseMessage): # with the failure. exc_info = sys.exc_info() LOG.exception(_("Error sending message to next hops: %(exc)s"), - locals()) + {'exc': exc}) self._cleanup_response_queue() return self._send_response_from_exception(exc_info) @@ -541,7 +547,7 @@ class _BroadcastMessage(_BaseMessage): exc_info = sys.exc_info() err_str = _("Error waiting for responses from neighbor cells: " "%(exc)s") - LOG.exception(err_str, locals()) + LOG.exception(err_str, {'exc': exc}) return self._send_response_from_exception(exc_info) if local_response: @@ -652,7 +658,7 @@ class _TargetedMessageMethods(_BaseMessageMethods): if not fn: detail = _("Unknown method '%(method)s' in compute API") raise exception.CellServiceAPIMethodNotFound( - detail=detail % locals()) + detail=detail % {'method': method}) args = list(method_info['method_args']) # 1st arg is instance_uuid that we need to turn into the # instance object. @@ -674,7 +680,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"), locals()) + "%(cell_name)s: %(capabilities)s"), + {'cell_name': cell_name, 'capabilities': capabilities}) self.state_manager.update_cell_capabilities(cell_name, capabilities) # Go ahead and update our parents now that a child updated us @@ -683,7 +690,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"), locals()) + "%(cell_name)s: %(capacities)s"), + {'cell_name': cell_name, 'capacities': capacities}) self.state_manager.update_cell_capacities(cell_name, capacities) # Go ahead and update our parents now that a child updated us @@ -808,8 +816,8 @@ class _BroadcastMessageMethods(_BaseMessageMethods): for md in instance['system_metadata']]) instance['system_metadata'] = sys_metadata - LOG.debug(_("Got update for instance %(instance_uuid)s: " - "%(instance)s") % locals()) + LOG.debug(_("Got update for instance: %(instance)s"), + {'instance': instance}, instance_uuid=instance_uuid) # To attempt to address out-of-order messages, do some sanity # checking on the VM state. @@ -839,8 +847,8 @@ class _BroadcastMessageMethods(_BaseMessageMethods): self.db.instance_create(message.ctxt, instance) if info_cache: try: - self.db.instance_info_cache_update(message.ctxt, - instance_uuid, info_cache, update_cells=False) + self.db.instance_info_cache_update( + message.ctxt, instance_uuid, info_cache) except exception.InstanceInfoCacheNotFound: # Can happen if we try to update a deleted instance's # network information. @@ -851,8 +859,8 @@ class _BroadcastMessageMethods(_BaseMessageMethods): if not self._at_the_top(): return instance_uuid = instance['uuid'] - LOG.debug(_("Got update to delete instance %(instance_uuid)s") % - locals()) + LOG.debug(_("Got update to delete instance"), + instance_uuid=instance_uuid) try: self.db.instance_destroy(message.ctxt, instance_uuid, update_cells=False) @@ -867,7 +875,7 @@ class _BroadcastMessageMethods(_BaseMessageMethods): soft-deleted. So, we'll run it everywhere. """ LOG.debug(_("Got broadcast to %(delete_type)s delete instance"), - locals(), instance=instance) + {'delete_type': delete_type}, instance=instance) if delete_type == 'soft': self.compute_api.soft_delete(message.ctxt, instance) else: @@ -882,7 +890,7 @@ class _BroadcastMessageMethods(_BaseMessageMethods): instance_fault.pop(key, None) log_str = _("Got message to create instance fault: " "%(instance_fault)s") - LOG.debug(log_str, locals()) + LOG.debug(log_str, {'instance_fault': instance_fault}) self.db.instance_fault_create(message.ctxt, instance_fault) def bw_usage_update_at_top(self, message, bw_update_info, **kwargs): @@ -902,7 +910,8 @@ class _BroadcastMessageMethods(_BaseMessageMethods): projid_str = project_id is None and "<all>" or project_id since_str = updated_since is None and "<all>" or updated_since LOG.info(_("Forcing a sync of instances, project_id=" - "%(projid_str)s, updated_since=%(since_str)s"), locals()) + "%(projid_str)s, updated_since=%(since_str)s"), + {'projid_str': projid_str, 'since_str': since_str}) if updated_since is not None: updated_since = timeutils.parse_isotime(updated_since) instances = cells_utils.get_instances_to_sync(message.ctxt, @@ -1086,7 +1095,7 @@ class MessageRunner(object): 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"), - locals()) + {'capabs': capabs}) # We have to turn the sets into lists so they can potentially # be json encoded when the raw message is sent. for key, values in capabs.items(): @@ -1106,7 +1115,7 @@ class MessageRunner(object): 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"), - locals()) + {'capacities': capacities}) method_kwargs = {'cell_name': my_cell_info.name, 'capacities': capacities} for cell in parent_cells: @@ -1120,8 +1129,7 @@ class MessageRunner(object): """ method_kwargs = dict(host_sched_kwargs=host_sched_kwargs) message = _TargetedMessage(self, ctxt, 'schedule_run_instance', - method_kwargs, 'down', - target_cell) + method_kwargs, 'down', target_cell) message.process() def run_compute_api_method(self, ctxt, cell_name, method_info, call): diff --git a/nova/cells/scheduler.py b/nova/cells/scheduler.py index 8ec65b2d0..18389dbc5 100644 --- a/nova/cells/scheduler.py +++ b/nova/cells/scheduler.py @@ -104,7 +104,7 @@ class CellsScheduler(base.Base): target_cell = cells[0] LOG.debug(_("Scheduling with routing_path=%(routing_path)s"), - locals()) + {'routing_path': message.routing_path}) if target_cell.is_me: # Need to create instance DB entries as the host scheduler @@ -130,14 +130,15 @@ class CellsScheduler(base.Base): raise sleep_time = max(1, CONF.cells.scheduler_retry_delay) LOG.info(_("No cells available when scheduling. Will " - "retry in %(sleep_time)s second(s)"), locals()) + "retry in %(sleep_time)s second(s)"), + {'sleep_time': sleep_time}) time.sleep(sleep_time) continue except Exception: request_spec = host_sched_kwargs['request_spec'] instance_uuids = request_spec['instance_uuids'] LOG.exception(_("Error scheduling instances %(instance_uuids)s"), - locals()) + {'instance_uuids': instance_uuids}) ctxt = message.ctxt for instance_uuid in instance_uuids: self.msg_runner.instance_update_at_top(ctxt, diff --git a/nova/cells/state.py b/nova/cells/state.py index 403f42d47..f1c77cef1 100644 --- a/nova/cells/state.py +++ b/nova/cells/state.py @@ -313,7 +313,8 @@ class CellStateManager(base.Base): cell = self.parent_cells.get(cell_name) if not cell: LOG.error(_("Unknown cell '%(cell_name)s' when trying to " - "update capabilities"), locals()) + "update capabilities"), + {'cell_name': cell_name}) return # Make sure capabilities are sets. for capab_name, values in capabilities.items(): @@ -328,7 +329,8 @@ class CellStateManager(base.Base): cell = self.parent_cells.get(cell_name) if not cell: LOG.error(_("Unknown cell '%(cell_name)s' when trying to " - "update capacities"), locals()) + "update capacities"), + {'cell_name': cell_name}) return cell.update_capacities(capacities) |