diff --git a/nova/api/auth.py b/nova/api/auth.py index bf2ce70d5133..c59b2d502d88 100644 --- a/nova/api/auth.py +++ b/nova/api/auth.py @@ -25,7 +25,6 @@ import webob.exc import nova.conf from nova import context from nova.i18n import _ -from nova.i18n import _LW from nova import wsgi @@ -46,9 +45,9 @@ def pipeline_factory(loader, global_conf, **local_conf): """A paste pipeline replica that keys off of auth_strategy.""" versionutils.report_deprecated_feature( LOG, - _LW("The legacy V2 API code tree has been removed in Newton. " - "Please remove legacy v2 API entry from api-paste.ini, and use " - "V2.1 API or V2.1 API compat mode instead") + "The legacy V2 API code tree has been removed in Newton. " + "Please remove legacy v2 API entry from api-paste.ini, and use " + "V2.1 API or V2.1 API compat mode instead" ) diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 893227e030ef..ea88ec0376e0 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -17,17 +17,15 @@ from oslo_log import log as logging from oslo_log import versionutils -from nova.i18n import _LW - LOG = logging.getLogger(__name__) class CloudController(object): def __init__(self): versionutils.report_deprecated_feature( - LOG, - _LW('The in tree EC2 API has been removed in Mitaka. ' - 'Please remove entries from api-paste.ini and use ' - 'the OpenStack ec2-api project ' - 'http://git.openstack.org/cgit/openstack/ec2-api/') + LOG, + 'The in tree EC2 API has been removed in Mitaka. ' + 'Please remove entries from api-paste.ini and use ' + 'the OpenStack ec2-api project ' + 'http://git.openstack.org/cgit/openstack/ec2-api/' ) diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py index 3f9af9b7fa97..3134e309e51f 100644 --- a/nova/api/ec2/ec2utils.py +++ b/nova/api/ec2/ec2utils.py @@ -26,7 +26,6 @@ from nova import cache_utils from nova import context from nova import exception from nova.i18n import _ -from nova.i18n import _LI from nova.network import model as network_model from nova import objects from nova.objects import base as obj_base @@ -289,7 +288,7 @@ def is_ec2_timestamp_expired(request, expires=None): timeutils.is_newer_than(query_time, expires) return False except ValueError: - LOG.info(_LI("Timestamp is invalid.")) + LOG.info("Timestamp is invalid.") return True diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 9d5dc4049780..0626d98e980e 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -26,9 +26,6 @@ import webob.exc from nova.api.openstack import wsgi import nova.conf -from nova.i18n import _LE -from nova.i18n import _LI -from nova.i18n import _LW from nova.i18n import translate from nova import notifications from nova import utils @@ -53,7 +50,7 @@ class FaultWrapper(base_wsgi.Middleware): status, webob.exc.HTTPInternalServerError)() def _error(self, inner, req): - LOG.exception(_LE("Caught error: %s"), inner) + LOG.exception("Caught error: %s", inner) safe = getattr(inner, 'safe', False) headers = getattr(inner, 'headers', None) @@ -62,7 +59,7 @@ class FaultWrapper(base_wsgi.Middleware): status = 500 msg_dict = dict(url=req.url, status=status) - LOG.info(_LI("%(url)s returned with HTTP %(status)d"), msg_dict) + LOG.info("%(url)s returned with HTTP %(status)d", msg_dict) outer = self.status_to_type(status) if headers: outer.headers = headers @@ -243,7 +240,7 @@ class APIRouterV21(base_wsgi.Router): self._register_resources_check_inherits(mapper) self.api_extension_manager.map(self._register_controllers) - LOG.info(_LI("Loaded extensions: %s"), + LOG.info("Loaded extensions: %s", sorted(self.loaded_extension_info.get_extensions().keys())) super(APIRouterV21, self).__init__(mapper) @@ -331,8 +328,8 @@ class APIRouterV21(base_wsgi.Router): controller = extension.controller if collection not in self.resources: - LOG.warning(_LW('Extension %(ext_name)s: Cannot extend ' - 'resource %(collection)s: No such resource'), + LOG.warning('Extension %(ext_name)s: Cannot extend ' + 'resource %(collection)s: No such resource', {'ext_name': ext_name, 'collection': collection}) continue diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index c3f05c3786eb..c6d36805fd0c 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -31,8 +31,6 @@ from nova.compute import vm_states import nova.conf from nova import exception from nova.i18n import _ -from nova.i18n import _LE -from nova.i18n import _LW from nova import objects from nova import quota from nova import utils @@ -118,9 +116,9 @@ def status_from_state(vm_state, task_state='default'): task_map = _STATE_MAP.get(vm_state, dict(default='UNKNOWN')) status = task_map.get(task_state, task_map['default']) if status == "UNKNOWN": - LOG.error(_LE("status is UNKNOWN from vm_state=%(vm_state)s " - "task_state=%(task_state)s. Bad upgrade or db " - "corrupted?"), + LOG.error("status is UNKNOWN from vm_state=%(vm_state)s " + "task_state=%(task_state)s. Bad upgrade or db " + "corrupted?", {'vm_state': vm_state, 'task_state': task_state}) return status @@ -352,8 +350,8 @@ def check_snapshots_enabled(f): @functools.wraps(f) def inner(*args, **kwargs): if not CONF.api.allow_instance_snapshots: - LOG.warning(_LW('Rejecting snapshot request, snapshots currently' - ' disabled')) + LOG.warning('Rejecting snapshot request, snapshots currently' + ' disabled') msg = _("Instance snapshots are not permitted at this time.") raise webob.exc.HTTPBadRequest(explanation=msg) return f(*args, **kwargs) diff --git a/nova/api/openstack/compute/hosts.py b/nova/api/openstack/compute/hosts.py index af7e7e989d51..fb80b0bc00d4 100644 --- a/nova/api/openstack/compute/hosts.py +++ b/nova/api/openstack/compute/hosts.py @@ -26,7 +26,6 @@ from nova.api.openstack import wsgi from nova.api import validation from nova import compute from nova import exception -from nova.i18n import _LI from nova import objects from nova.policies import hosts as hosts_policies @@ -138,9 +137,8 @@ class HostController(wsgi.Controller): """Start/Stop host maintenance window. On start, it triggers guest VMs evacuation. """ - LOG.info(_LI("Putting host %(host_name)s in maintenance mode " - "%(mode)s."), - {'host_name': host_name, 'mode': mode}) + LOG.info("Putting host %(host_name)s in maintenance mode %(mode)s.", + {'host_name': host_name, 'mode': mode}) try: result = self.api.set_host_maintenance(context, host_name, mode) except NotImplementedError: @@ -159,9 +157,9 @@ class HostController(wsgi.Controller): on the host. """ if enabled: - LOG.info(_LI("Enabling host %s."), host_name) + LOG.info("Enabling host %s.", host_name) else: - LOG.info(_LI("Disabling host %s."), host_name) + LOG.info("Disabling host %s.", host_name) try: result = self.api.set_host_enabled(context, host_name=host_name, enabled=enabled)