]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update i18n translation for Embrane plugin
authorGary Kotton <gkotton@vmware.com>
Tue, 25 Nov 2014 09:46:50 +0000 (01:46 -0800)
committerGary Kotton <gkotton@vmware.com>
Wed, 3 Dec 2014 16:24:26 +0000 (08:24 -0800)
All the existing LOG.info, LOG.warning, LOG.error and LOG.critical
messages should have _LI, _LW, _LE and _LC respectively. Also, debug
level log shouldn't be translated. This patch set will cover the
embrane directory.

Change-Id: I89cf8e63311f96c3f1759a6c885d1b98e6fed598
Partial-Bug: #1320867

neutron/hacking/checks.py
neutron/plugins/embrane/agent/dispatcher.py
neutron/plugins/embrane/agent/operations/router_operations.py
neutron/plugins/embrane/base_plugin.py
neutron/plugins/embrane/common/utils.py

index afd9a690bef74377772f757d0f2d394f9b4a29bd..3630c6a08cebe75917a31ffa5f6966f99952c6ca 100644 (file)
@@ -78,7 +78,7 @@ def _directory_to_check_translation(filename):
             #"neutron/plugins/brocade",
             "neutron/plugins/cisco",
             "neutron/plugins/common",
-            #"neutron/plugins/embrane",
+            "neutron/plugins/embrane",
             "neutron/plugins/hyperv",
             #"neutron/plugins/ibm",
             "neutron/plugins/linuxbridge",
index 31c5602dc46752fd74228351a2d39ae4df6cbb87..9af511f7953037eb7b54f688dfd6bb8d4bab49b3 100644 (file)
@@ -18,6 +18,7 @@ from eventlet import queue
 from heleosapi import constants as h_con
 from heleosapi import exceptions as h_exc
 
+from neutron.i18n import _LE
 from neutron.openstack.common import log as logging
 from neutron.plugins.embrane.agent.operations import router_operations
 from neutron.plugins.embrane.common import constants as p_con
@@ -127,4 +128,4 @@ class Dispatcher(object):
                                 operation_context.item,
                                 transient_state)
             except Exception:
-                LOG.exception(_("Unhandled exception occurred"))
+                LOG.exception(_LE("Unhandled exception occurred"))
index 61059772a2718e70734b7e2477ec8a32c0c7ee27..c5cdcbbb9c701b73f87222444e1a1bf060d509d3 100644 (file)
@@ -17,6 +17,7 @@ import functools
 
 from heleosapi import exceptions as h_exc
 
+from neutron.i18n import _LW
 from neutron.openstack.common import log as logging
 from neutron.plugins.embrane.common import constants as p_con
 
@@ -92,8 +93,8 @@ def _delete_dva(api, tenant_id, neutron_router):
     try:
         api.delete_dva(tenant_id, neutron_router["id"])
     except h_exc.DvaNotFound:
-        LOG.warning(_("The router %s had no physical representation,"
-                      "likely already deleted"), neutron_router["id"])
+        LOG.warning(_LW("The router %s had no physical representation,"
+                        "likely already deleted"), neutron_router["id"])
     return p_con.Status.DELETED
 
 
@@ -121,8 +122,8 @@ def _shrink_dva_iface(api, tenant_id, neutron_router, port_id):
         dva = api.shrink_interface(tenant_id, neutron_router["id"],
                                    neutron_router["admin_state_up"], port_id)
     except h_exc.InterfaceNotFound:
-        LOG.warning(_("Interface %s not found in the heleos back-end,"
-                      "likely already deleted"), port_id)
+        LOG.warning(_LW("Interface %s not found in the heleos back-end,"
+                        "likely already deleted"), port_id)
         return (p_con.Status.ACTIVE if neutron_router["admin_state_up"] else
                 p_con.Status.READY)
     except h_exc.PreliminaryOperationsFailed as ex:
index 0dacc0fe779974324ab12c9526656131badcf3be..4aa25ffec1980e54aa54247da0c3d4cb4ce82a67 100644 (file)
@@ -25,6 +25,7 @@ from neutron.db import extraroute_db
 from neutron.db import l3_db
 from neutron.db import models_v2
 from neutron.extensions import l3
+from neutron.i18n import _LE
 from neutron.openstack.common import log as logging
 from neutron.plugins.embrane.agent import dispatcher
 from neutron.plugins.embrane.common import config  # noqa
@@ -102,7 +103,7 @@ class EmbranePlugin(object):
         try:
             self._update_db_interfaces_state(context, neutron_router)
         except Exception:
-            LOG.exception(_("Unhandled exception occurred"))
+            LOG.exception(_LE("Unhandled exception occurred"))
         return self._set_db_router_state(context, neutron_router, state)
 
     def _retrieve_prefix_from_port(self, context, neutron_port):
@@ -167,12 +168,12 @@ class EmbranePlugin(object):
                 self._esm_api.get_dva(id)
         except h_exc.DvaNotFound:
 
-            LOG.error(_("The following routers have not physical match: %s"),
+            LOG.error(_LE("The following routers have not physical match: %s"),
                       id)
             self._set_db_router_state(context, neutron_router,
                                       p_con.Status.ERROR)
 
-        LOG.debug(_("Requested router: %s"), neutron_router)
+        LOG.debug("Requested router: %s", neutron_router)
         return self._make_router_dict(neutron_router, fields)
 
     def get_routers(self, context, filters=None, fields=None, sorts=None,
@@ -186,7 +187,7 @@ class EmbranePlugin(object):
         try:
             self._esm_api.get_dvas(id_list)
         except h_exc.DvaNotFound:
-            LOG.error(_("The following routers have not physical match: %s"),
+            LOG.error(_LE("The following routers have not physical match: %s"),
                       repr(id_list))
             error_routers = []
             for id in id_list:
@@ -224,7 +225,7 @@ class EmbranePlugin(object):
             d_context=embrane_ctx.DispatcherContext(
                 p_con.Events.DELETE_ROUTER, neutron_router, context,
                 state_change), args=())
-        LOG.debug(_("Deleting router=%s"), neutron_router)
+        LOG.debug("Deleting router=%s", neutron_router)
         return neutron_router
 
     def add_router_interface(self, context, router_id, interface_info):
index 34c2d5c44a6de02090f84bd42c01e953a3f52aac..8eb4451a6b1e39b5d5f884a118e9f9b8ba72bb3b 100644 (file)
@@ -17,6 +17,7 @@ from heleosapi import info as h_info
 
 from neutron.common import constants
 from neutron.db import models_v2
+from neutron.i18n import _LI
 from neutron.openstack.common import log as logging
 
 LOG = logging.getLogger(__name__)
@@ -40,7 +41,7 @@ def retrieve_ip_allocation_info(context, neutron_port):
     try:
         subnet_id = neutron_port["fixed_ips"][0]["subnet_id"]
     except (KeyError, IndexError):
-        LOG.info(_("No ip allocation set"))
+        LOG.info(_LI("No ip allocation set"))
         return
     subnet = retrieve_subnet(context, subnet_id)
     allocated_ip = neutron_port["fixed_ips"][0]["ip_address"]