diff --git a/nova/debugger.py b/nova/debugger.py index a735775c1a05..6e52e712eb3e 100644 --- a/nova/debugger.py +++ b/nova/debugger.py @@ -37,7 +37,6 @@ def init(): if not (CONF.remote_debug.host and CONF.remote_debug.port): return - from nova.i18n import _LW from oslo_log import log as logging LOG = logging.getLogger(__name__) @@ -49,12 +48,13 @@ def init(): from pydev import pydevd except ImportError: import pydevd + pydevd.settrace(host=CONF.remote_debug.host, port=CONF.remote_debug.port, stdoutToServer=False, stderrToServer=False) - LOG.warning(_LW('WARNING: Using the remote debug option changes how ' - 'Nova uses the eventlet library to support async IO. This ' - 'could result in failures that do not occur under normal ' - 'operation. Use at your own risk.')) + LOG.warning('WARNING: Using the remote debug option changes how ' + 'Nova uses the eventlet library to support async IO. This ' + 'could result in failures that do not occur under normal ' + 'operation. Use at your own risk.') diff --git a/nova/hooks.py b/nova/hooks.py index 4323a3fea0eb..37c595920c5f 100644 --- a/nova/hooks.py +++ b/nova/hooks.py @@ -50,7 +50,7 @@ import functools from oslo_log import log as logging import stevedore -from nova.i18n import _, _LW +from nova.i18n import _ LOG = logging.getLogger(__name__) NS = 'nova.hooks' @@ -86,8 +86,8 @@ class HookManager(stevedore.hook.HookManager): obj = e.obj hook_method = getattr(obj, method_type, None) if hook_method: - LOG.warning(_LW("Hooks are deprecated as of Nova 13.0 and " - "will be removed in a future release")) + LOG.warning("Hooks are deprecated as of Nova 13.0 and " + "will be removed in a future release") LOG.debug("Running %(name)s %(type)s-hook: %(obj)s", {'name': name, 'type': method_type, 'obj': obj}) try: diff --git a/nova/i18n.py b/nova/i18n.py index 9607616d26c4..57e07072a228 100644 --- a/nova/i18n.py +++ b/nova/i18n.py @@ -33,7 +33,6 @@ _ = _translators.primary # name like '_'. The "L" is for "log" and the other letter comes from # the level. _LI = _translators.log_info -_LW = _translators.log_warning def translate(value, user_locale): diff --git a/nova/policy.py b/nova/policy.py index 05d35e6204f9..ad1b79c54290 100644 --- a/nova/policy.py +++ b/nova/policy.py @@ -24,7 +24,6 @@ from oslo_utils import excutils from nova import exception -from nova.i18n import _LW from nova import policies @@ -115,10 +114,12 @@ def _warning_for_deprecated_user_based_rules(rules): if resource in rule[0]]: continue if 'user_id' in KEY_EXPR.findall(rule[1]): - LOG.warning(_LW("The user_id attribute isn't supported in the " - "rule '%s'. All the user_id based policy " - "enforcement will be removed in the " - "future."), rule[0]) + LOG.warning( + "The user_id attribute isn't supported in the rule '%s'. " + "All the user_id based policy enforcement will be removed in " + "the future.", + rule[0] + ) def set_rules(rules, overwrite=True, use_conf=False): diff --git a/nova/service.py b/nova/service.py index 9bb4d694370a..c618cf6da7fa 100644 --- a/nova/service.py +++ b/nova/service.py @@ -34,7 +34,7 @@ import nova.conf from nova import context from nova import debugger from nova import exception -from nova.i18n import _, _LI, _LW +from nova.i18n import _, _LI from nova import objects from nova.objects import base as objects_base from nova.objects import service as service_obj @@ -282,7 +282,7 @@ class Service(service.Service): try: self.service_ref.destroy() except exception.NotFound: - LOG.warning(_LW('Service killed that has no database entry')) + LOG.warning('Service killed that has no database entry') def stop(self): """stop the service and clean up.""" diff --git a/nova/servicegroup/api.py b/nova/servicegroup/api.py index d715161f05a1..ea0a1c3d3ed9 100644 --- a/nova/servicegroup/api.py +++ b/nova/servicegroup/api.py @@ -20,7 +20,6 @@ from oslo_log import log as logging from oslo_utils import importutils import nova.conf -from nova.i18n import _LW LOG = logging.getLogger(__name__) @@ -47,11 +46,11 @@ class API(object): report_interval = CONF.report_interval if CONF.service_down_time <= report_interval: new_service_down_time = int(report_interval * 2.5) - LOG.warning(_LW("Report interval must be less than service down " - "time. Current config: . Setting service_down_time " - "to: %(new_service_down_time)s"), + LOG.warning("Report interval must be less than service down " + "time. Current config: . Setting service_down_time " + "to: %(new_service_down_time)s", {'service_down_time': CONF.service_down_time, 'report_interval': report_interval, 'new_service_down_time': new_service_down_time}) diff --git a/nova/servicegroup/drivers/db.py b/nova/servicegroup/drivers/db.py index de462d5c927c..811bf9503954 100644 --- a/nova/servicegroup/drivers/db.py +++ b/nova/servicegroup/drivers/db.py @@ -20,7 +20,7 @@ import six import nova.conf from nova import exception -from nova.i18n import _, _LI, _LW +from nova.i18n import _, _LI from nova.servicegroup import api from nova.servicegroup.drivers import base @@ -102,8 +102,10 @@ class DbDriver(base.Driver): # as nova-conductor is restarted, so only log this error once. if not getattr(service, 'model_disconnected', False): service.model_disconnected = True - LOG.warning(_LW('Lost connection to nova-conductor ' - 'for reporting service status.')) + LOG.warning( + 'Lost connection to nova-conductor for reporting service ' + 'status.' + ) except exception.ServiceNotFound: # The service may have been deleted via the API but the actual # process is still running. Provide a useful error message rather diff --git a/nova/servicegroup/drivers/mc.py b/nova/servicegroup/drivers/mc.py index 506ff01ebc79..ea86cb26845b 100644 --- a/nova/servicegroup/drivers/mc.py +++ b/nova/servicegroup/drivers/mc.py @@ -23,7 +23,7 @@ from oslo_utils import timeutils from nova import cache_utils import nova.conf -from nova.i18n import _, _LI, _LW +from nova.i18n import _, _LI from nova.servicegroup import api from nova.servicegroup.drivers import base @@ -108,5 +108,7 @@ class MemcachedDriver(base.Driver): except Exception: if not getattr(service, 'model_disconnected', False): service.model_disconnected = True - LOG.warning(_LW('Lost connection to memcache server ' - 'for reporting service status.')) + LOG.warning( + 'Lost connection to memcache server for reporting service ' + 'status.' + ) diff --git a/nova/utils.py b/nova/utils.py index 20692d43d64e..ed26d006f2bc 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -53,7 +53,7 @@ from six.moves import range from nova import block_device import nova.conf from nova import exception -from nova.i18n import _, _LW +from nova.i18n import _ from nova import safe_utils profiler = importutils.try_import('osprofiler.profiler') @@ -372,9 +372,9 @@ def sanitize_hostname(hostname, default_name=None): def truncate_hostname(name): if len(name) > 63: - LOG.warning(_LW("Hostname %(hostname)s is longer than 63, " - "truncate it to %(truncated_name)s"), - {'hostname': name, 'truncated_name': name[:63]}) + LOG.warning("Hostname %(hostname)s is longer than 63, " + "truncate it to %(truncated_name)s", + {'hostname': name, 'truncated_name': name[:63]}) return name[:63] if isinstance(hostname, six.text_type): diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py index 3c384e35eee6..95a131e1900f 100644 --- a/nova/volume/cinder.py +++ b/nova/volume/cinder.py @@ -42,7 +42,6 @@ from nova import availability_zones as az import nova.conf from nova import exception from nova.i18n import _ -from nova.i18n import _LW from nova import service_auth @@ -581,21 +580,21 @@ class API(object): attachment_id = attachments.get(instance_uuid, {}).\ get('attachment_id') if not attachment_id: - LOG.warning(_LW("attachment_id couldn't be retrieved " - "for volume %(volume_id)s with " - "instance_uuid %(instance_id)s. The " - "volume has the 'multiattach' flag " - "enabled, without the attachment_id " - "Cinder most probably cannot perform " - "the detach."), + LOG.warning("attachment_id couldn't be retrieved " + "for volume %(volume_id)s with " + "instance_uuid %(instance_id)s. The " + "volume has the 'multiattach' flag " + "enabled, without the attachment_id " + "Cinder most probably cannot perform " + "the detach.", {'volume_id': volume_id, 'instance_id': instance_uuid}) else: - LOG.warning(_LW("attachment_id couldn't be retrieved for " - "volume %(volume_id)s. The volume has the " - "'multiattach' flag enabled, without the " - "attachment_id Cinder most probably " - "cannot perform the detach."), + LOG.warning("attachment_id couldn't be retrieved for " + "volume %(volume_id)s. The volume has the " + "'multiattach' flag enabled, without the " + "attachment_id Cinder most probably " + "cannot perform the detach.", {'volume_id': volume_id}) client.volumes.detach(volume_id, attachment_id)