Remove log translations

Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Icf0c6173e81bddc42f33796e89607e8dab985f52
This commit is contained in:
D G Lee 2017-04-05 11:05:51 +08:00
parent 033bba1c52
commit 64c2518a7a
17 changed files with 67 additions and 70 deletions

View File

@ -27,7 +27,6 @@ from oslo_utils import excutils
from oslo_utils import reflection
import six
from os_win._i18n import _LE
LOG = logging.getLogger(__name__)
@ -67,7 +66,7 @@ def parse_server_string(server_str):
return (address, port)
except (ValueError, netaddr.AddrFormatError):
LOG.error(_LE('Invalid server_string: %s'), server_str)
LOG.error('Invalid server_string: %s', server_str)
return ('', '')

View File

@ -29,7 +29,7 @@ from oslo_log import log as logging
from oslo_utils import excutils
from six.moves import queue
from os_win._i18n import _, _LI, _LE, _LW
from os_win._i18n import _
from os_win import _utils
from os_win import constants
from os_win import exceptions
@ -248,9 +248,9 @@ class ClusterUtils(baseutils.BaseUtils):
exp_state_after_migr,
new_host)
LOG.warning(
_LW('Cluster group migration completed '
'successfuly after cancel attempt. '
'Suppressing timeout exception.'))
'Cluster group migration completed '
'successfuly after cancel attempt. '
'Suppressing timeout exception.')
ctxt.reraise = False
except exceptions.ClusterGroupMigrationFailed:
pass
@ -307,7 +307,7 @@ class ClusterUtils(baseutils.BaseUtils):
group_name, group_handle,
expected_state,
timeout=None):
LOG.info(_LI("Canceling cluster group '%s' migration"), group_name)
LOG.info("Canceling cluster group '%s' migration", group_name)
try:
cancel_finished = (
self._clusapi_utils.cancel_cluster_group_operation(
@ -335,10 +335,10 @@ class ClusterUtils(baseutils.BaseUtils):
expected_state,
timeout=timeout)
except Exception:
LOG.exception(_LE("Failed to cancel cluster group migration."))
LOG.exception("Failed to cancel cluster group migration.")
raise exceptions.JobTerminateFailed()
LOG.info(_LI("Cluster group migration canceled."))
LOG.info("Cluster group migration canceled.")
def _is_migration_queued(self, group_status_info):
return bool(
@ -394,7 +394,7 @@ class ClusterUtils(baseutils.BaseUtils):
if not migration_pending:
return
LOG.error(_LE("Cluster group migration timed out."))
LOG.error("Cluster group migration timed out.")
raise exceptions.ClusterGroupMigrationTimeOut(
group_name=group_name,
time_elapsed=time.time() - time_start)
@ -475,7 +475,7 @@ class ClusterUtils(baseutils.BaseUtils):
callback(vm_name, old_host, new_host)
except Exception:
LOG.exception(
_LE("Exception during failover callback."))
"Exception during failover callback.")
except exceptions.x_wmi_timed_out:
pass
@ -567,8 +567,8 @@ class _ClusterEventListener(object):
except Exception:
if self._running:
LOG.exception(
_LE("Unexpected exception in event listener loop. "
"The cluster event listener will now close."))
"Unexpected exception in event listener loop. "
"The cluster event listener will now close.")
self._signal_stopped()
def _process_event(self, event):

View File

@ -17,7 +17,7 @@ import platform
from oslo_log import log as logging
from os_win._i18n import _, _LE
from os_win._i18n import _
from os_win import exceptions
from os_win.utils import _wqlutils
from os_win.utils.compute import migrationutils
@ -42,7 +42,7 @@ class LiveMigrationUtils(migrationutils.MigrationUtils):
return self._get_wmi_obj(self._wmi_namespace % host,
compatibility_mode=True)
except exceptions.x_wmi as ex:
LOG.exception(_LE('Get version 2 connection error'))
LOG.exception('Get version 2 connection error')
if ex.com_error.hresult == -2147217394:
msg = (_('Live migration is not supported on target host "%s"')
% host)

View File

@ -31,7 +31,7 @@ from oslo_utils import uuidutils
import six
from six.moves import range # noqa
from os_win._i18n import _, _LE, _LW
from os_win._i18n import _
from os_win import _utils
from os_win import constants
from os_win import exceptions
@ -501,8 +501,8 @@ class VMUtils(baseutils.BaseUtilsVirt):
# Add the new vhd object as a virtual hard disk to the vm.
self._jobutils.add_virt_resource(res, vm)
except Exception:
LOG.exception(_LE("Failed to attach disk image %(disk_path)s "
"to vm %(vm_name)s. Reverting attachment."),
LOG.exception("Failed to attach disk image %(disk_path)s "
"to vm %(vm_name)s. Reverting attachment.",
dict(disk_path=path, vm_name=vm_name))
drive = self._get_wmi_obj(drive_path)
@ -609,9 +609,9 @@ class VMUtils(baseutils.BaseUtilsVirt):
disk_found = True
break
if not disk_found:
LOG.warning(_LW('Disk not found on controller '
'"%(controller_path)s" with '
'address "%(address)s"'),
LOG.warning('Disk not found on controller '
'"%(controller_path)s" with '
'address "%(address)s"',
{'controller_path': controller_path,
'address': address})
@ -942,10 +942,10 @@ class VMUtils(baseutils.BaseUtilsVirt):
try:
callback(vm_name, vm_power_state)
except Exception:
err_msg = _LE("Executing VM power state change event "
"callback failed. "
"VM name: %(vm_name)s, "
"VM power state: %(vm_power_state)s.")
err_msg = ("Executing VM power state change "
"event callback failed. "
"VM name: %(vm_name)s, "
"VM power state: %(vm_power_state)s.")
LOG.exception(err_msg,
dict(vm_name=vm_name,
vm_power_state=vm_power_state))
@ -953,8 +953,8 @@ class VMUtils(baseutils.BaseUtilsVirt):
pass
except Exception:
LOG.exception(
_LE("The VM power state change event listener "
"encountered an unexpected exception."))
"The VM power state change event listener "
"encountered an unexpected exception.")
time.sleep(event_timeout / 1000)
return _handle_events if get_handler else listener

View File

@ -18,7 +18,7 @@ import socket
from oslo_log import log as logging
from os_win._i18n import _, _LW
from os_win._i18n import _
from os_win import _utils
from os_win import constants
from os_win import exceptions
@ -192,14 +192,14 @@ class HostUtils(baseutils.BaseUtilsVirt):
memory_info = self._get_numa_memory_info(numa_node_assoc,
system_memory)
if not memory_info:
LOG.warning(_LW("Could not find memory information for NUMA "
"node. Skipping node measurements."))
LOG.warning("Could not find memory information for NUMA "
"node. Skipping node measurements.")
continue
cpu_info = self._get_numa_cpu_info(numa_node_assoc, processors)
if not cpu_info:
LOG.warning(_LW("Could not find CPU information for NUMA "
"node. Skipping node measurements."))
LOG.warning("Could not find CPU information for NUMA "
"node. Skipping node measurements.")
continue
node_info = {

View File

@ -15,7 +15,7 @@
import re
from os_win._i18n import _, _LW
from os_win._i18n import _
from os_win import exceptions
from os_win.utils import hostutils
from oslo_log import log as logging
@ -55,8 +55,8 @@ class HostUtils10(hostutils.HostUtils):
(return_code,
host_config) = self._conn_hgs.MSFT_HgsClientConfiguration.Get()
if return_code:
LOG.warning(_LW('Retrieving the local Host Guardian Service '
'Client configuration failed with code: %s'),
LOG.warning('Retrieving the local Host Guardian Service '
'Client configuration failed with code: %s',
return_code)
return False
return host_config.IsHostGuarded

View File

@ -21,7 +21,7 @@ Hyper-V Server / Windows Server 2012.
from oslo_log import log as logging
from os_win._i18n import _, _LW
from os_win._i18n import _
from os_win import exceptions
from os_win.utils import _wqlutils
from os_win.utils import baseutils
@ -100,7 +100,7 @@ class MetricsUtils(baseutils.BaseUtilsVirt):
for metrics_name in metrics_names:
metrics_def = self._metrics_defs.get(metrics_name)
if not metrics_def:
LOG.warning(_LW("Metric not found: %s"), metrics_name)
LOG.warning("Metric not found: %s", metrics_name)
continue
definition_paths.append(metrics_def.path_())

View File

@ -26,7 +26,7 @@ from eventlet import tpool
from oslo_utils import units
import six
from os_win._i18n import _, _LE
from os_win._i18n import _
from os_win import constants
from os_win import exceptions
from os_win.utils import _wqlutils
@ -369,8 +369,8 @@ class NetworkUtils(baseutils.BaseUtilsVirt):
self._jobutils.add_virt_feature(new_port_profile, port_alloc)
except Exception as ex:
raise exceptions.HyperVException(
_LE('Unable to set port profile settings %(port_profile)s '
'for port %(port)s. Error: %(error)s') %
'Unable to set port profile settings %(port_profile)s '
'for port %(port)s. Error: %(error)s' %
dict(port_profile=new_port_profile, port=port_alloc, error=ex))
def set_vswitch_port_vlan_id(self, vlan_id=None, switch_port_name=None,
@ -830,8 +830,8 @@ class NetworkUtils(baseutils.BaseUtilsVirt):
raise exceptions.InvalidParameterValue(
param_name="qos_rule", param_value=qos_rule)
raise exceptions.HyperVException(
_LE('Unable to set qos rule %(qos_rule)s for port %(port)s. '
'Error: %(error)s') %
'Unable to set qos rule %(qos_rule)s for port %(port)s. '
'Error: %(error)s' %
dict(qos_rule=qos_rule, port=port_alloc, error=ex))
def remove_port_qos_rule(self, port_id):

View File

@ -15,7 +15,6 @@
from oslo_log import log as logging
from os_win._i18n import _, _LI, _LW, _LE # noqa
from os_win import constants
from os_win import exceptions
from os_win.utils import baseutils
@ -158,7 +157,7 @@ class NvgreUtils(baseutils.BaseUtils):
if n.DriverDescription == self._HYPERV_VIRT_ADAPTER]
if not networks:
LOG.error(_LE('No vswitch was found with name: %s'), network_name)
LOG.error('No vswitch was found with name: %s', network_name)
return None, None
ip_addr = self._scimv2.MSFT_NetIPAddress(
@ -166,7 +165,7 @@ class NvgreUtils(baseutils.BaseUtils):
AddressFamily=self._IPV4_ADDRESS_FAMILY)
if not ip_addr:
LOG.error(_LE('No IP Address could be found for network: %s'),
LOG.error('No IP Address could be found for network: %s',
network_name)
return None, None

View File

@ -21,7 +21,7 @@ import sys
from oslo_log import log as logging
from os_win._i18n import _, _LE
from os_win._i18n import _
from os_win import _utils
from os_win import exceptions
from os_win.utils import baseutils
@ -95,8 +95,8 @@ class DiskUtils(baseutils.BaseUtils):
kernel32_lib_func=True)
return total_bytes.value, free_bytes.value
except exceptions.Win32Exception as exc:
LOG.error(_LE("Could not get disk %(path)s capacity info. "
"Exception: %(exc)s"),
LOG.error("Could not get disk %(path)s capacity info. "
"Exception: %(exc)s",
dict(path=path,
exc=exc))
if ignore_errors:

View File

@ -21,7 +21,7 @@ import textwrap
from oslo_log import log as logging
import six
from os_win._i18n import _, _LW
from os_win._i18n import _
from os_win import _utils
import os_win.conf
from os_win import exceptions
@ -147,18 +147,18 @@ class FCUtils(object):
try:
adapter_name = self._get_adapter_name(adapter_index)
except Exception as exc:
msg = _LW("Could not retrieve FC HBA adapter name for "
"adapter number: %(adapter_index)s. "
"Exception: %(exc)s")
msg = ("Could not retrieve FC HBA adapter name for "
"adapter number: %(adapter_index)s. "
"Exception: %(exc)s")
LOG.warning(msg, dict(adapter_index=adapter_index, exc=exc))
continue
try:
hba_ports += self._get_fc_hba_adapter_ports(adapter_name)
except Exception as exc:
msg = _LW("Could not retrieve FC HBA ports for "
"adapter: %(adapter_name)s. "
"Exception: %(exc)s")
msg = ("Could not retrieve FC HBA ports for "
"adapter: %(adapter_name)s. "
"Exception: %(exc)s")
LOG.warning(msg, dict(adapter_name=adapter_name, exc=exc))
return hba_ports

View File

@ -23,7 +23,6 @@ import time
from oslo_log import log as logging
from os_win._i18n import _LI, _LE
from os_win import _utils
from os_win import constants
from os_win import exceptions
@ -136,8 +135,8 @@ class ISCSIInitiatorUtils(object):
ctypes.byref(buff))
return buff.value
except exceptions.ISCSIInitiatorAPIException as ex:
LOG.info(_LI("The ISCSI initiator node name can't be found. "
"Choosing the default one. Exception: %s"), ex)
LOG.info("The ISCSI initiator node name can't be found. "
"Choosing the default one. Exception: %s", ex)
return "%s:%s" % (self._MS_IQN_PREFIX, socket.getfqdn().lower())
@ensure_buff_and_retrieve_items(
@ -418,8 +417,8 @@ class ISCSIInitiatorUtils(object):
if device_path and device_number not in (None, -1):
return device_number, device_path
except exceptions.ISCSIInitiatorAPIException:
err_msg = _LE("Could not find lun %(target_lun)s "
"for iSCSI target %(target_iqn)s.")
err_msg = ("Could not find lun %(target_lun)s "
"for iSCSI target %(target_iqn)s.")
LOG.exception(err_msg,
dict(target_lun=target_lun,
target_iqn=target_iqn))

View File

@ -20,7 +20,7 @@ import sys
from oslo_log import log as logging
from os_win._i18n import _, _LE
from os_win._i18n import _
from os_win import _utils
from os_win import exceptions
from os_win.utils import baseutils
@ -107,8 +107,8 @@ class SMBUtils(baseutils.BaseUtils):
kernel32_lib_func=True)
return total_bytes.value, free_bytes.value
except exceptions.Win32Exception as exc:
LOG.error(_LE("Could not get share %(share_path)s capacity info. "
"Exception: %(exc)s"),
LOG.error("Could not get share %(share_path)s capacity info. "
"Exception: %(exc)s",
dict(share_path=share_path,
exc=exc))
if ignore_errors:

View File

@ -16,7 +16,7 @@
from oslo_log import log as logging
import six
from os_win._i18n import _, _LI
from os_win._i18n import _
from os_win import constants
from os_win import exceptions
from os_win.utils import baseutils
@ -125,7 +125,7 @@ class ISCSITargetUtils(baseutils.BaseUtils):
raise exceptions.ISCSITargetWMIException(err_msg % target_name,
wmi_exc=wmi_exc)
else:
LOG.info(_LI('The iSCSI target %s already exists.'),
LOG.info('The iSCSI target %s already exists.',
target_name)
def delete_iscsi_target(self, target_name):

View File

@ -19,7 +19,6 @@ import sys
from oslo_log import log as logging
from os_win._i18n import _LE
from os_win import _utils
from os_win import exceptions
@ -134,5 +133,5 @@ class Win32Utils(object):
try:
self._run_and_check_output(kernel32.LocalFree, handle)
except exceptions.Win32Exception:
LOG.exception(_LE("Could not deallocate memory. "
"There could be a memory leak."))
LOG.exception("Could not deallocate memory. "
"There could be a memory leak.")

View File

@ -15,7 +15,7 @@
from oslo_utils import importutils
from os_win._i18n import _, _LW # noqa
from os_win._i18n import _ # noqa
from os_win import exceptions
from os_win.utils import hostutils
from os_win.utils.io import namedpipe

View File

@ -29,7 +29,8 @@ commands = python setup.py build_sphinx
commands = oslo_debug_helper -t os_win/tests/unit {posargs}
[flake8]
# N321,N328,N329,N330 Remove log translations
ignore = N321,N328,N329,N330
show-source = True
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build