remove i18n log markers from nova.api.*

This completes the removal of i18n markers from nova.api.*

Change-Id: I8e765d2dcda3edbef4981b0f4c960da3e6d15776
This commit is contained in:
Sean Dague 2017-03-21 09:06:18 -04:00 committed by Matt Riedemann
parent e7118ae2e3
commit 94671e279f
13 changed files with 37 additions and 53 deletions

View File

@ -21,7 +21,6 @@ import webob.exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _LE
from nova.policies import base as base_policies
from nova.policies import extensions as ext_policies
@ -330,7 +329,7 @@ class LoadedExtensionInfo(object):
try:
extension.is_valid()
except AttributeError:
LOG.exception(_LE("Exception loading extension"))
LOG.exception("Exception loading extension")
return False
return True

View File

@ -31,7 +31,6 @@ from nova import compute
from nova.compute import utils as compute_utils
from nova import exception
from nova.i18n import _
from nova.i18n import _LW
from nova import network
from nova.policies import floating_ips as fi_policies
@ -224,8 +223,8 @@ class FloatingIPActionController(wsgi.Controller):
cached_nwinfo = compute_utils.get_nw_info_for_instance(instance)
if not cached_nwinfo:
LOG.warning(
_LW('Info cache is %r during associate with no nw_info cache'),
instance.info_cache, instance=instance)
'Info cache is %r during associate with no nw_info cache',
instance.info_cache, instance=instance)
msg = _('Instance network is not ready yet')
raise webob.exc.HTTPBadRequest(explanation=msg)
@ -256,8 +255,8 @@ class FloatingIPActionController(wsgi.Controller):
{'address': address, 'id': id})
raise webob.exc.HTTPBadRequest(explanation=msg)
if len(fixed_ips) > 1:
LOG.warning(_LW('multiple fixed_ips exist, using the first '
'IPv4 fixed_ip: %s'), fixed_address)
LOG.warning('multiple fixed_ips exist, using the first '
'IPv4 fixed_ip: %s', fixed_address)
try:
self.network_api.associate_floating_ip(context, instance,

View File

@ -27,7 +27,6 @@ from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.policies import migrate_server as ms_policies
LOG = logging.getLogger(__name__)
@ -114,9 +113,9 @@ class MigrateServerController(wsgi.Controller):
exception.LiveMigrationWithOldNovaNotSupported) as ex:
if async:
with excutils.save_and_reraise_exception():
LOG.error(_LE("Unexpected exception received from "
"conductor during pre-live-migration checks "
"'%(ex)s'"), {'ex': ex})
LOG.error("Unexpected exception received from "
"conductor during pre-live-migration checks "
"'%(ex)s'", {'ex': ex})
else:
raise exc.HTTPBadRequest(explanation=ex.format_message())
except exception.InstanceIsLocked as e:

View File

@ -23,7 +23,6 @@ from nova import compute
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova.i18n import _LI
from nova import objects
from nova.policies import server_external_events as see_policies
@ -96,8 +95,8 @@ class ServerExternalEventsController(wsgi.Controller):
if instance.host:
accepted_events.append(event)
accepted_instances.add(instance)
LOG.info(_LI('Creating event %(name)s:%(tag)s for '
'instance %(instance_uuid)s on %(host)s'),
LOG.info('Creating event %(name)s:%(tag)s for '
'instance %(instance_uuid)s on %(host)s',
{'name': event.name, 'tag': event.tag,
'instance_uuid': event.instance_uuid,
'host': instance.host})

View File

@ -27,7 +27,6 @@ from nova.api.openstack import wsgi
from nova.api import validation
import nova.exception
from nova.i18n import _
from nova.i18n import _LE
from nova import objects
from nova.policies import server_groups as sg_policies
@ -101,8 +100,7 @@ class ServerGroupController(wsgi.Controller):
user_id=user_id, server_groups=-1)
except Exception:
quotas = None
LOG.exception(_LE("Failed to update usages deallocating "
"server group"))
LOG.exception("Failed to update usages deallocating server group")
try:
sg.destroy()

View File

@ -41,7 +41,6 @@ import nova.conf
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova.i18n import _LW
from nova.image import glance
from nova import objects
from nova.policies import servers as server_policies
@ -112,10 +111,8 @@ class ServersController(wsgi.Controller):
if ext.obj.alias in whitelist:
if ext.obj.alias in blacklist:
LOG.warning(
_LW(
"Extension %s is both in whitelist and "
"blacklist, blacklisting takes precedence"
),
"Extension %s is both in whitelist and "
"blacklist, blacklisting takes precedence",
ext.obj.alias)
return False
else:

View File

@ -30,7 +30,6 @@ import nova.conf
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
import nova.network
from nova.policies import tenant_networks as tn_policies
from nova import quota
@ -64,7 +63,7 @@ class TenantNetworkController(wsgi.Controller):
try:
self._default_networks = self._get_default_networks()
except Exception:
LOG.exception(_LE("Failed to get default networks"))
LOG.exception("Failed to get default networks")
def _get_default_networks(self):
project_id = CONF.api.neutron_default_tenant_id
@ -110,8 +109,7 @@ class TenantNetworkController(wsgi.Controller):
reservation = QUOTAS.reserve(context, networks=-1)
except Exception:
reservation = None
LOG.exception(_LE("Failed to update usages deallocating "
"network."))
LOG.exception("Failed to update usages deallocating network.")
def _rollback_quota(reservation):
if CONF.enable_network_quota and reservation:

View File

@ -25,7 +25,6 @@ from nova.api.openstack.compute.views import flavors as views_flavors
from nova.api.openstack.compute.views import images as views_images
from nova import context as nova_context
from nova import exception
from nova.i18n import _LW
from nova import objects
from nova.objects import base as obj_base
from nova import utils
@ -248,8 +247,8 @@ class ViewBuilder(common.ViewBuilder):
def _get_flavor(self, request, instance):
instance_type = instance.get_flavor()
if not instance_type:
LOG.warning(_LW("Instance has had its instance_type removed "
"from the DB"), instance=instance)
LOG.warning("Instance has had its instance_type removed "
"from the DB", instance=instance)
return {}
flavor_id = instance_type["flavorid"]
flavor_bookmark = self._flavor_builder._get_bookmark_link(request,

View File

@ -26,8 +26,6 @@ import webob.exc
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LW
LOG = logging.getLogger(__name__)
@ -190,7 +188,7 @@ class ExtensionManager(object):
try:
extension.is_valid()
except AttributeError:
LOG.exception(_LE("Exception loading extension"))
LOG.exception("Exception loading extension")
return False
return True
@ -225,9 +223,9 @@ class ExtensionManager(object):
try:
self.load_extension(ext_factory)
except Exception as exc:
LOG.warning(_LW('Failed to load extension %(ext_factory)s: '
'%(exc)s'),
{'ext_factory': ext_factory, 'exc': exc})
LOG.warning(
'Failed to load extension %(ext_factory)s: %(exc)s',
{'ext_factory': ext_factory, 'exc': exc})
class ControllerExtension(object):
@ -363,7 +361,7 @@ def expected_errors(errors):
# generate new token and do another attempt.
raise
LOG.exception(_LE("Unexpected exception in API method"))
LOG.exception("Unexpected exception in API method")
msg = _('Unexpected API Error. Please report this at '
'http://bugs.launchpad.net/nova/ and attach the Nova '
'API log if possible.\n%s') % type(exc)

View File

@ -17,7 +17,7 @@ from keystoneauth1 import session
from oslo_log import log as logging
import webob
from nova.i18n import _, _LE, _LI, _LW
from nova.i18n import _
LOG = logging.getLogger(__name__)
@ -37,7 +37,7 @@ def verify_project_id(context, project_id):
except kse.ClientException:
# something is wrong, like there isn't a keystone v3 endpoint,
# we'll take the pass and default to everything being ok.
LOG.exception(_LE("Unable to contact keystone to verify project_id"))
LOG.exception("Unable to contact keystone to verify project_id")
return True
if resp:
@ -52,14 +52,14 @@ def verify_project_id(context, project_id):
# we don't have enough permission to verify this, so default
# to "it's ok".
LOG.info(
_LI("Insufficient permissions for user %(user)s to verify "
"existence of project_id %(pid)s"),
"Insufficient permissions for user %(user)s to verify "
"existence of project_id %(pid)s",
{"user": context.user_id, "pid": project_id})
return True
else:
LOG.warning(
_LW("Unexpected response from keystone trying to "
"verify project_id %(pid)s - resp: %(code)s %(content)s"),
"Unexpected response from keystone trying to "
"verify project_id %(pid)s - resp: %(code)s %(content)s",
{"pid": project_id,
"code": resp.status_code,
"content": resp.content})

View File

@ -35,10 +35,10 @@ from nova.api.openstack.placement.handlers import resource_class
from nova.api.openstack.placement.handlers import resource_provider
from nova.api.openstack.placement.handlers import root
from nova.api.openstack.placement.handlers import usage
from nova.api.openstack.placement import policy
from nova.api.openstack.placement import util
from nova import exception
from nova.i18n import _, _LE
from nova.api.openstack.placement import policy
from nova.i18n import _
LOG = logging.getLogger(__name__)
@ -205,5 +205,5 @@ class PlacementHandler(object):
except webob.exc.HTTPNotFound:
raise
except Exception as exc:
LOG.exception(_LE("Uncaught exception"))
LOG.exception("Uncaught exception")
raise

View File

@ -22,7 +22,7 @@ import webob
from nova.api.openstack.placement import util
from nova.api.openstack.placement import wsgi_wrapper
from nova import exception
from nova.i18n import _, _LE
from nova.i18n import _
from nova import objects
@ -261,11 +261,11 @@ def set_allocations(req):
"%(rp_uuid)s: %(error)s") %
{'rp_uuid': resource_provider_uuid, 'error': exc})
except exception.InvalidInventory as exc:
LOG.exception(_LE("Bad inventory"))
LOG.exception("Bad inventory")
raise webob.exc.HTTPConflict(
_('Unable to allocate inventory: %(error)s') % {'error': exc})
except exception.ConcurrentUpdateDetected as exc:
LOG.exception(_LE("Concurrent Update"))
LOG.exception("Concurrent Update")
raise webob.exc.HTTPConflict(
_('Inventory changed while attempting to allocate: %(error)s') %
{'error': exc})

View File

@ -29,8 +29,6 @@ from nova.api.openstack import versioned_method
from nova import exception
from nova import i18n
from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LI
from nova import utils
from nova import wsgi
@ -421,14 +419,14 @@ class ResourceExceptionHandler(object):
explanation=ex_value.format_message()))
elif isinstance(ex_value, TypeError):
exc_info = (ex_type, ex_value, ex_traceback)
LOG.error(_LE('Exception handling resource: %s'), ex_value,
LOG.error('Exception handling resource: %s', ex_value,
exc_info=exc_info)
raise Fault(webob.exc.HTTPBadRequest())
elif isinstance(ex_value, Fault):
LOG.info(_LI("Fault thrown: %s"), ex_value)
LOG.info("Fault thrown: %s", ex_value)
raise ex_value
elif isinstance(ex_value, webob.exc.HTTPException):
LOG.info(_LI("HTTP exception thrown: %s"), ex_value)
LOG.info("HTTP exception thrown: %s", ex_value)
raise Fault(ex_value)
# We didn't handle the exception