Update i18n translation for Embrane plugin

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
This commit is contained in:
Gary Kotton 2014-11-25 01:46:50 -08:00
parent d8d0ec78d3
commit bfcd061bde
5 changed files with 16 additions and 12 deletions

View 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",

View 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"))

View 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:

View 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):

View 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"]