]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update i18n translation for Brocade plugin log msg's
authorGary Kotton <gkotton@vmware.com>
Mon, 24 Nov 2014 19:32:37 +0000 (11:32 -0800)
committerGary Kotton <gkotton@vmware.com>
Wed, 3 Dec 2014 20:02:23 +0000 (12:02 -0800)
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
neutron/plugins/brocade/NeutronPlugin.py
neutron/plugins/brocade/nos/nosdriver.py

index 68dcfa1f9b8069445e4fa75c2d3676ead3a47e04..541e0e297e0ab10b82cc5e6a15ebd569f32abd9f 100644 (file)
@@ -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",
index 4437c012837917cfb40949d4359151a0232ef732..9a81fdf5935b24ef315737d8e9e4efdad2425fde 100644 (file)
@@ -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"))
 
index 700516bbf45a2eb6121128631baf3e633865a358..fccf5960887fc0e83316fe13209a7709d27a67bd 100644 (file)
@@ -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):