From 68a9e2c1da882087c97b2b3bc63652dec24515da Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 24 Nov 2014 11:32:37 -0800 Subject: [PATCH] Update i18n translation for Brocade plugin log msg's All the log messages now have the required hints. In addition to this debug messages are not translated. This is done for the plugins/brocade directory. Change-Id: I2ac926fd72037bb8f0605267ad50472c447ae83d --- neutron/hacking/checks.py | 2 +- neutron/plugins/brocade/NeutronPlugin.py | 19 ++++++++++--------- neutron/plugins/brocade/nos/nosdriver.py | 13 +++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index 68dcfa1f9..541e0e297 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -75,7 +75,7 @@ def _directory_to_check_translation(filename): "neutron/services", #"neutron/plugins", "neutron/plugins/bigswitch", - #"neutron/plugins/brocade", + "neutron/plugins/brocade", "neutron/plugins/cisco", "neutron/plugins/common", #"neutron/plugins/embrane", diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 4437c0128..9a81fdf59 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -46,6 +46,7 @@ from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg from neutron.openstack.common import context +from neutron.i18n import _LE, _LI from neutron.openstack.common import log as logging from neutron.plugins.brocade.db import models as brocade_db from neutron.plugins.brocade import vlanbm as vbm @@ -90,7 +91,7 @@ class BridgeRpcCallbacks(object): agent_id = kwargs.get('agent_id') device = kwargs.get('device') - LOG.debug(_("Device %(device)s details requested from %(agent_id)s"), + LOG.debug("Device %(device)s details requested from %(agent_id)s", {'device': device, 'agent_id': agent_id}) port = brocade_db.get_port(rpc_context, device[len(q_const.TAP_DEVICE_PREFIX):]) @@ -105,7 +106,7 @@ class BridgeRpcCallbacks(object): else: entry = {'device': device} - LOG.debug(_("%s can not be found in database"), device) + LOG.debug("%s can not be found in database", device) return entry def get_devices_details_list(self, rpc_context, **kwargs): @@ -132,7 +133,7 @@ class BridgeRpcCallbacks(object): else: entry = {'device': device, 'exists': False} - LOG.debug(_("%s can not be found in database"), device) + LOG.debug("%s can not be found in database", device) return entry @@ -292,8 +293,8 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, vlan_id) except Exception: # Proper formatting - LOG.exception(_("Brocade NOS driver error")) - LOG.debug(_("Returning the allocated vlan (%d) to the pool"), + LOG.exception(_LE("Brocade NOS driver error")) + LOG.debug("Returning the allocated vlan (%d) to the pool", vlan_id) self._vlan_bitmap.release_vlan(int(vlan_id)) raise Exception(_("Brocade plugin raised exception, " @@ -302,7 +303,7 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, brocade_db.create_network(context, net_uuid, vlan_id) self._process_l3_create(context, net, network['network']) - LOG.info(_("Allocated vlan (%d) from the pool"), vlan_id) + LOG.info(_LI("Allocated vlan (%d) from the pool"), vlan_id) return net def delete_network(self, context, net_id): @@ -336,7 +337,7 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, vlan_id) except Exception: # Proper formatting - LOG.exception(_("Brocade NOS driver error")) + LOG.exception(_LE("Brocade NOS driver error")) raise Exception(_("Brocade plugin raised exception, " "check logs")) @@ -389,7 +390,7 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, mac) except Exception: # Proper formatting - LOG.exception(_("Brocade NOS driver error")) + LOG.exception(_LE("Brocade NOS driver error")) raise Exception(_("Brocade plugin raised exception, " "check logs")) @@ -419,7 +420,7 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, vlan_id, mac) except Exception: - LOG.exception(_("Brocade NOS driver error")) + LOG.exception(_LE("Brocade NOS driver error")) raise Exception( _("Brocade plugin raised exception, check logs")) diff --git a/neutron/plugins/brocade/nos/nosdriver.py b/neutron/plugins/brocade/nos/nosdriver.py index 700516bbf..fccf59608 100644 --- a/neutron/plugins/brocade/nos/nosdriver.py +++ b/neutron/plugins/brocade/nos/nosdriver.py @@ -21,6 +21,7 @@ Neutron network life-cycle management. from ncclient import manager from oslo.utils import excutils +from neutron.i18n import _LE from neutron.openstack.common import log as logging from neutron.plugins.brocade.nos import nctemplates as template @@ -62,9 +63,9 @@ class NOSdriver(): unknown_host_cb=nos_unknown_host_cb) except Exception as e: with excutils.save_and_reraise_exception(): - LOG.error(_("Connect failed to switch: %s"), e) + LOG.error(_LE("Connect failed to switch: %s"), e) - LOG.debug(_("Connect success to host %(host)s:%(ssh_port)d"), + LOG.debug("Connect success to host %(host)s:%(ssh_port)d", dict(host=host, ssh_port=SSH_PORT)) return self.mgr @@ -89,7 +90,7 @@ class NOSdriver(): self.activate_port_profile(mgr, name) except Exception as ex: with excutils.save_and_reraise_exception(): - LOG.exception(_("NETCONF error: %s"), ex) + LOG.exception(_LE("NETCONF error: %s"), ex) self.close_session() def delete_network(self, host, username, password, net_id): @@ -103,7 +104,7 @@ class NOSdriver(): self.delete_vlan_interface(mgr, net_id) except Exception as ex: with excutils.save_and_reraise_exception(): - LOG.exception(_("NETCONF error: %s"), ex) + LOG.exception(_LE("NETCONF error: %s"), ex) self.close_session() def associate_mac_to_network(self, host, username, password, @@ -116,7 +117,7 @@ class NOSdriver(): self.associate_mac_to_port_profile(mgr, name, mac) except Exception as ex: with excutils.save_and_reraise_exception(): - LOG.exception(_("NETCONF error: %s"), ex) + LOG.exception(_LE("NETCONF error: %s"), ex) self.close_session() def dissociate_mac_from_network(self, host, username, password, @@ -129,7 +130,7 @@ class NOSdriver(): self.dissociate_mac_from_port_profile(mgr, name, mac) except Exception as ex: with excutils.save_and_reraise_exception(): - LOG.exception(_("NETCONF error: %s"), ex) + LOG.exception(_LE("NETCONF error: %s"), ex) self.close_session() def create_vlan_interface(self, mgr, vlan_id): -- 2.45.2