trivial: Remove remaining '_LW' instances

There are only a few of these remaining in the code base. Remove them.

Change-Id: I33725e2439b0f39c1e9bec9e33a37bf3e24944fb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2020-05-18 16:56:35 +01:00
parent eee57f2380
commit 3a28b0e771
10 changed files with 47 additions and 45 deletions

View File

@ -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.')

View File

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

View File

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

View File

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

View File

@ -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."""

View File

@ -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: <service_down_time: "
"%(service_down_time)s, report_interval: "
"%(report_interval)s>. Setting service_down_time "
"to: %(new_service_down_time)s"),
LOG.warning("Report interval must be less than service down "
"time. Current config: <service_down_time: "
"%(service_down_time)s, report_interval: "
"%(report_interval)s>. 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})

View File

@ -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

View File

@ -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.'
)

View File

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

View File

@ -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)