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: I8056e32d29585605ab75aa44b85ec16befecbd20
This commit is contained in:
jeremy.zhang 2017-03-21 12:41:51 +08:00
parent 57f6eb74e7
commit 6cf9b1cd68
24 changed files with 211 additions and 235 deletions

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
from os_brick.encryptors import nop from os_brick.encryptors import nop
from os_brick.i18n import _LE, _LW
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import importutils from oslo_utils import importutils
@ -67,10 +66,10 @@ def get_volume_encryptor(root_helper,
# ERROR if provider is not a key in SUPPORTED_ENCRYPTION_PROVIDERS. # ERROR if provider is not a key in SUPPORTED_ENCRYPTION_PROVIDERS.
# Until then continue to allow both the class name and path to be used. # Until then continue to allow both the class name and path to be used.
if provider in LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP: if provider in LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP:
LOG.warning(_LW("Use of the in tree encryptor class %(provider)s" LOG.warning("Use of the in tree encryptor class %(provider)s"
" by directly referencing the implementation class" " by directly referencing the implementation class"
" will be blocked in the Pike release of" " will be blocked in the Pike release of"
" os-brick."), {'provider': provider}) " os-brick.", {'provider': provider})
provider = LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP[provider] provider = LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP[provider]
if provider in FORMAT_TO_FRONTEND_ENCRYPTOR_MAP: if provider in FORMAT_TO_FRONTEND_ENCRYPTOR_MAP:
@ -78,9 +77,9 @@ def get_volume_encryptor(root_helper,
elif provider is None: elif provider is None:
provider = "os_brick.encryptors.nop.NoOpEncryptor" provider = "os_brick.encryptors.nop.NoOpEncryptor"
else: else:
LOG.warning(_LW("Use of the out of tree encryptor class " LOG.warning("Use of the out of tree encryptor class "
"%(provider)s will be blocked with the Pike " "%(provider)s will be blocked with the Pike "
"release of os-brick."), {'provider': provider}) "release of os-brick.", {'provider': provider})
try: try:
encryptor = importutils.import_object( encryptor = importutils.import_object(
@ -91,7 +90,7 @@ def get_volume_encryptor(root_helper,
execute, execute,
**kwargs) **kwargs)
except Exception as e: except Exception as e:
LOG.error(_LE("Error instantiating %(provider)s: %(exception)s"), LOG.error("Error instantiating %(provider)s: %(exception)s",
{'provider': provider, 'exception': e}) {'provider': provider, 'exception': e})
raise raise
@ -111,12 +110,11 @@ def get_encryption_metadata(context, volume_api, volume_id, connection_info):
metadata = volume_api.get_volume_encryption_metadata(context, metadata = volume_api.get_volume_encryption_metadata(context,
volume_id) volume_id)
if not metadata: if not metadata:
LOG.warning(_LW( LOG.warning('Volume %s should be encrypted but there is no '
'Volume %s should be encrypted but there is no ' 'encryption metadata.', volume_id)
'encryption metadata.'), volume_id)
except Exception as e: except Exception as e:
LOG.error(_LE("Failed to retrieve encryption metadata for " LOG.error("Failed to retrieve encryption metadata for "
"volume %(volume_id)s: %(exception)s"), "volume %(volume_id)s: %(exception)s",
{'volume_id': volume_id, 'exception': e}) {'volume_id': volume_id, 'exception': e})
raise raise

View File

@ -20,7 +20,6 @@ import os
from os_brick.encryptors import base from os_brick.encryptors import base
from os_brick import exception from os_brick import exception
from os_brick.i18n import _LW, _LI
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_log import log as logging from oslo_log import log as logging
@ -91,8 +90,8 @@ class CryptsetupEncryptor(base.VolumeEncryptor):
# normal disk or multipath device), exit_code will be 1. In the # normal disk or multipath device), exit_code will be 1. In the
# case, we will omit the warning message. # case, we will omit the warning message.
if e.exit_code != 1: if e.exit_code != 1:
LOG.warning(_LW('cryptsetup status %(dev_name)s exited ' LOG.warning('cryptsetup status %(dev_name)s exited '
'abnormally (status %(exit_code)s): %(err)s'), 'abnormally (status %(exit_code)s): %(err)s',
{"dev_name": dev_name, "exit_code": e.exit_code, {"dev_name": dev_name, "exit_code": e.exit_code,
"err": e.stderr}) "err": e.stderr})
return False return False
@ -157,9 +156,9 @@ class CryptsetupEncryptor(base.VolumeEncryptor):
if e.exit_code == 2: if e.exit_code == 2:
# NOTE(lyarwood): Workaround bug#1633518 by attempting to use # NOTE(lyarwood): Workaround bug#1633518 by attempting to use
# a mangled passphrase to open the device.. # a mangled passphrase to open the device..
LOG.info(_LI("Unable to open %s with the current passphrase, " LOG.info("Unable to open %s with the current passphrase, "
"attempting to use a mangled passphrase to open " "attempting to use a mangled passphrase to open "
"the volume."), self.dev_path) "the volume.", self.dev_path)
self._open_volume(self._get_mangled_passphrase(key), **kwargs) self._open_volume(self._get_mangled_passphrase(key), **kwargs)
# modify the original symbolic link to refer to the decrypted device # modify the original symbolic link to refer to the decrypted device

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
from os_brick.encryptors import cryptsetup from os_brick.encryptors import cryptsetup
from os_brick.i18n import _LI, _LW
from os_brick.privileged import rootwrap as priv_rootwrap from os_brick.privileged import rootwrap as priv_rootwrap
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
from oslo_log import log as logging from oslo_log import log as logging
@ -38,8 +37,8 @@ def is_luks(root_helper, device, execute=None):
check_exit_code=True) check_exit_code=True)
return True return True
except putils.ProcessExecutionError as e: except putils.ProcessExecutionError as e:
LOG.warning(_LW("isLuks exited abnormally (status %(exit_code)s): " LOG.warning("isLuks exited abnormally (status %(exit_code)s): "
"%(stderr)s"), "%(stderr)s",
{"exit_code": e.exit_code, "stderr": e.stderr}) {"exit_code": e.exit_code, "stderr": e.stderr})
return False return False
@ -157,8 +156,8 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
self.dev_path, self.dev_path,
execute=self._execute): execute=self._execute):
# the device has never been formatted; format it and try again # the device has never been formatted; format it and try again
LOG.info(_LI("%s is not a valid LUKS device;" LOG.info("%s is not a valid LUKS device;"
" formatting device for first use"), " formatting device for first use",
self.dev_path) self.dev_path)
self._format_volume(passphrase, **kwargs) self._format_volume(passphrase, **kwargs)
self._open_volume(passphrase, **kwargs) self._open_volume(passphrase, **kwargs)
@ -166,9 +165,9 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
# NOTE(lyarwood): Workaround bug#1633518 by replacing any # NOTE(lyarwood): Workaround bug#1633518 by replacing any
# mangled passphrases that are found on the volume. # mangled passphrases that are found on the volume.
# TODO(lyarwood): Remove workaround during R. # TODO(lyarwood): Remove workaround during R.
LOG.warning(_LW("%s is not usable with the current " LOG.warning("%s is not usable with the current "
"passphrase, attempting to use a mangled " "passphrase, attempting to use a mangled "
"passphrase to open the volume."), "passphrase to open the volume.",
self.dev_path) self.dev_path)
self._unmangle_volume(key, passphrase, **kwargs) self._unmangle_volume(key, passphrase, **kwargs)
self._open_volume(passphrase, **kwargs) self._open_volume(passphrase, **kwargs)

View File

@ -16,7 +16,7 @@
import six import six
from os_brick.i18n import _, _LE from os_brick.i18n import _
from oslo_log import log as logging from oslo_log import log as logging
@ -51,11 +51,11 @@ class BrickException(Exception):
except Exception: except Exception:
# kwargs doesn't match a variable in the message # kwargs doesn't match a variable in the message
# log the issue and the kwargs # log the issue and the kwargs
LOG.exception(_LE("Exception in string format operation. " LOG.exception("Exception in string format operation. "
"msg='%s'"), self.message) "msg='%s'", self.message)
for name, value in kwargs.items(): for name, value in kwargs.items():
LOG.error(_LE("%(name)s: %(value)s"), {'name': name, LOG.error("%(name)s: %(value)s", {'name': name,
'value': value}) 'value': value})
# at least get the core message out if something happened # at least get the core message out if something happened
message = self.message message = self.message

View File

@ -26,13 +26,3 @@ _translators = i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -21,7 +21,6 @@ from oslo_service import loopingcall
from os_brick import exception from os_brick import exception
from os_brick import initiator from os_brick import initiator
from os_brick.i18n import _LI
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick import utils from os_brick import utils
@ -104,8 +103,8 @@ class AoEConnector(base.BaseLinuxConnector):
if waiting_status['tries'] >= self.device_scan_attempts: if waiting_status['tries'] >= self.device_scan_attempts:
raise exception.VolumeDeviceNotFound(device=aoe_path) raise exception.VolumeDeviceNotFound(device=aoe_path)
LOG.info(_LI("AoE volume not yet found at: %(path)s. " LOG.info("AoE volume not yet found at: %(path)s. "
"Try number: %(tries)s"), "Try number: %(tries)s",
{'path': aoe_device, 'tries': waiting_status['tries']}) {'path': aoe_device, 'tries': waiting_status['tries']})
self._aoe_discover() self._aoe_discover()

View File

@ -22,7 +22,6 @@ from oslo_log import log as logging
from os_brick import exception from os_brick import exception
from os_brick import initiator from os_brick import initiator
from os_brick.i18n import _LE, _LW
from os_brick.initiator import host_driver from os_brick.initiator import host_driver
from os_brick.initiator import initiator_connector from os_brick.initiator import initiator_connector
from os_brick.initiator import linuxscsi from os_brick.initiator import linuxscsi
@ -66,8 +65,8 @@ class BaseLinuxConnector(initiator_connector.InitiatorConnector):
out, info = self._execute(*cmd, run_as_root=run_as_root, out, info = self._execute(*cmd, run_as_root=run_as_root,
root_helper=self._root_helper) root_helper=self._root_helper)
except putils.ProcessExecutionError as e: except putils.ProcessExecutionError as e:
LOG.error(_LE("Failed to access the device on the path " LOG.error("Failed to access the device on the path "
"%(path)s: %(error)s."), "%(path)s: %(error)s.",
{"path": path, "error": e.stderr}) {"path": path, "error": e.stderr})
return False return False
# If the info is none, the path does not exist. # If the info is none, the path does not exist.
@ -124,6 +123,6 @@ class BaseLinuxConnector(initiator_connector.InitiatorConnector):
# initially and need additional time/rescans to get to RW. # initially and need additional time/rescans to get to RW.
self._linuxscsi.wait_for_rw(device_wwn, device_path) self._linuxscsi.wait_for_rw(device_wwn, device_path)
except exception.BlockDeviceReadOnly: except exception.BlockDeviceReadOnly:
LOG.warning(_LW('Block device %s is still read-only. ' LOG.warning('Block device %s is still read-only. '
'Continuing anyway.'), device_path) 'Continuing anyway.', device_path)
return device_path, multipath_id return device_path, multipath_id

View File

@ -21,8 +21,8 @@ from oslo_concurrency import lockutils
from oslo_log import log as logging from oslo_log import log as logging
import six import six
from os_brick.i18n import _, _LI, _LE
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick import utils from os_brick import utils
@ -128,7 +128,7 @@ class DISCOConnector(base.BaseLinuxConnector):
msg = _("Detach volume failed") msg = _("Detach volume failed")
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
else: else:
LOG.info(_LI("Volume already detached from host")) LOG.info("Volume already detached from host")
def _mount_disco_volume(self, path, volume_id): def _mount_disco_volume(self, path, volume_id):
"""Send request to mount volume on physical host.""" """Send request to mount volume on physical host."""
@ -146,7 +146,7 @@ class DISCOConnector(base.BaseLinuxConnector):
msg = _("Attach volume failed") msg = _("Attach volume failed")
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
else: else:
LOG.info(_LI("Volume already attached to host")) LOG.info("Volume already attached to host")
def _connect_tcp_socket(self, client_ip, client_port): def _connect_tcp_socket(self, client_ip, client_port):
"""Connect to TCP socket.""" """Connect to TCP socket."""
@ -171,7 +171,7 @@ class DISCOConnector(base.BaseLinuxConnector):
break break
if sock is None: if sock is None:
LOG.error(_LE("Cannot connect TCP socket")) LOG.error("Cannot connect TCP socket")
return sock return sock
def _send_disco_vol_cmd(self, client_ip, client_port, op_code, vol_id): def _send_disco_vol_cmd(self, client_ip, client_port, op_code, vol_id):

View File

@ -19,7 +19,6 @@ from oslo_log import log as logging
from oslo_service import loopingcall from oslo_service import loopingcall
import six import six
from os_brick.i18n import _LE, _LI, _LW
from os_brick import exception from os_brick import exception
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
@ -105,8 +104,8 @@ class FibreChannelConnector(base.BaseLinuxConnector):
if volume_paths: if volume_paths:
return self._linuxscsi.extend_volume(volume_paths) return self._linuxscsi.extend_volume(volume_paths)
else: else:
LOG.warning(_LW("Couldn't find any volume paths on the host to " LOG.warning("Couldn't find any volume paths on the host to "
"extend volume for %(props)s"), "extend volume for %(props)s",
{'props': connection_properties}) {'props': connection_properties})
raise exception.VolumePathsNotFound() raise exception.VolumePathsNotFound()
@ -133,8 +132,7 @@ class FibreChannelConnector(base.BaseLinuxConnector):
if len(host_devices) == 0: if len(host_devices) == 0:
# this is empty because we don't have any FC HBAs # this is empty because we don't have any FC HBAs
LOG.warning( LOG.warning("We are unable to locate any Fibre Channel devices")
_LW("We are unable to locate any Fibre Channel devices"))
raise exception.NoFibreChannelHostsFound() raise exception.NoFibreChannelHostsFound()
# The /dev/disk/by-path/... node is not always present immediately # The /dev/disk/by-path/... node is not always present immediately
@ -153,11 +151,11 @@ class FibreChannelConnector(base.BaseLinuxConnector):
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
if self.tries >= self.device_scan_attempts: if self.tries >= self.device_scan_attempts:
LOG.error(_LE("Fibre Channel volume device not found.")) LOG.error("Fibre Channel volume device not found.")
raise exception.NoFibreChannelVolumeDeviceFound() raise exception.NoFibreChannelVolumeDeviceFound()
LOG.info(_LI("Fibre Channel volume device not yet found. " LOG.info("Fibre Channel volume device not yet found. "
"Will rescan & retry. Try number: %(tries)s."), "Will rescan & retry. Try number: %(tries)s.",
{'tries': tries}) {'tries': tries})
self._linuxfc.rescan_hosts(hbas, self._linuxfc.rescan_hosts(hbas,

View File

@ -18,8 +18,8 @@ import socket
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _, _LE
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick import utils from os_brick import utils
@ -48,8 +48,8 @@ class HGSTConnector(base.BaseLinuxConnector):
def _log_cli_err(self, err): def _log_cli_err(self, err):
"""Dumps the full command output to a logfile in error cases.""" """Dumps the full command output to a logfile in error cases."""
LOG.error(_LE("CLI fail: '%(cmd)s' = %(code)s\nout: %(stdout)s\n" LOG.error("CLI fail: '%(cmd)s' = %(code)s\nout: %(stdout)s\n"
"err: %(stderr)s"), "err: %(stderr)s",
{'cmd': err.cmd, 'code': err.exit_code, {'cmd': err.cmd, 'code': err.exit_code,
'stdout': err.stdout, 'stderr': err.stderr}) 'stdout': err.stdout, 'stderr': err.stderr})

View File

@ -17,8 +17,8 @@ import os
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _, _LE
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick import utils from os_brick import utils
@ -45,8 +45,8 @@ class HuaweiStorHyperConnector(base.BaseLinuxConnector):
self.cli_path) self.cli_path)
if not os.path.isfile(self.cli_path): if not os.path.isfile(self.cli_path):
self.iscliexist = False self.iscliexist = False
LOG.error(_LE('SDS CLI file not found, ' LOG.error('SDS CLI file not found, '
'HuaweiStorHyperConnector init failed.')) 'HuaweiStorHyperConnector init failed.')
super(HuaweiStorHyperConnector, self).__init__(root_helper, super(HuaweiStorHyperConnector, self).__init__(root_helper,
driver=driver, driver=driver,
*args, **kwargs) *args, **kwargs)
@ -168,7 +168,7 @@ class HuaweiStorHyperConnector(base.BaseLinuxConnector):
LOG.debug('%(method)s volume returns %(analyse_result)s.', LOG.debug('%(method)s volume returns %(analyse_result)s.',
{'method': method, 'analyse_result': analyse_result}) {'method': method, 'analyse_result': analyse_result})
if clilog: if clilog:
LOG.error(_LE("SDS CLI output some log: %s."), clilog) LOG.error("SDS CLI output some log: %s.", clilog)
return analyse_result return analyse_result
def _analyze_output(self, out): def _analyze_output(self, out):

View File

@ -25,8 +25,8 @@ from oslo_concurrency import processutils as putils
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
from os_brick.i18n import _, _LE, _LI, _LW
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick.initiator.connectors import base_iscsi from os_brick.initiator.connectors import base_iscsi
@ -112,8 +112,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
iscsi_sessions = [] iscsi_sessions = []
if err: if err:
LOG.warning(_LW("Couldn't find iscsi sessions because " LOG.warning("Couldn't find iscsi sessions because "
"iscsiadm err: %s"), "iscsiadm err: %s",
err) err)
else: else:
# parse the output from iscsiadm # parse the output from iscsiadm
@ -163,7 +163,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
target_props = None target_props = None
connected_to_portal = False connected_to_portal = False
if self.use_multipath: if self.use_multipath:
LOG.info(_LI("Multipath discovery for iSCSI enabled")) LOG.info("Multipath discovery for iSCSI enabled")
# Multipath installed, discovering other targets if available # Multipath installed, discovering other targets if available
try: try:
ips_iqns_luns = self._discover_iscsi_portals( ips_iqns_luns = self._discover_iscsi_portals(
@ -208,7 +208,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
host_devices = self._get_device_path(connection_properties) host_devices = self._get_device_path(connection_properties)
else: else:
LOG.info(_LI("Multipath discovery for iSCSI not enabled.")) LOG.info("Multipath discovery for iSCSI not enabled.")
iscsi_sessions = [] iscsi_sessions = []
if not connect_to_portal: if not connect_to_portal:
iscsi_sessions = self._get_iscsi_sessions() iscsi_sessions = self._get_iscsi_sessions()
@ -223,8 +223,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
host_devices = self._get_device_path(props) host_devices = self._get_device_path(props)
break break
else: else:
LOG.warning(_LW( LOG.warning(
'Failed to connect to iSCSI portal %(portal)s.'), 'Failed to connect to iSCSI portal %(portal)s.',
{'portal': props['target_portal']}) {'portal': props['target_portal']})
else: else:
# If we aren't trying to connect to the portal, we # If we aren't trying to connect to the portal, we
@ -279,8 +279,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
if data[2] in self.supported_transports: if data[2] in self.supported_transports:
return transport_iface return transport_iface
LOG.warning(_LW("No useable transport found for iscsi iface %s. " LOG.warning("No useable transport found for iscsi iface %s. "
"Falling back to default transport."), "Falling back to default transport.",
transport_iface) transport_iface)
return 'default' return 'default'
@ -323,8 +323,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
connection_properties connection_properties
) )
else: else:
LOG.error(_LE("Unable to find target portal: " LOG.error("Unable to find target portal: "
"%(target_portal)s."), "%(target_portal)s.",
{'target_portal': connection_properties[ {'target_portal': connection_properties[
'target_portal']}) 'target_portal']})
raise raise
@ -373,15 +373,15 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
Try and update the local kernel's size information Try and update the local kernel's size information
for an iSCSI volume. for an iSCSI volume.
""" """
LOG.info(_LI("Extend volume for %s"), connection_properties) LOG.info("Extend volume for %s", connection_properties)
volume_paths = self.get_volume_paths(connection_properties) volume_paths = self.get_volume_paths(connection_properties)
LOG.info(_LI("Found paths for volume %s"), volume_paths) LOG.info("Found paths for volume %s", volume_paths)
if volume_paths: if volume_paths:
return self._linuxscsi.extend_volume(volume_paths) return self._linuxscsi.extend_volume(volume_paths)
else: else:
LOG.warning(_LW("Couldn't find any volume paths on the host to " LOG.warning("Couldn't find any volume paths on the host to "
"extend volume for %(props)s"), "extend volume for %(props)s",
{'props': connection_properties}) {'props': connection_properties})
raise exception.VolumePathsNotFound() raise exception.VolumePathsNotFound()
@ -425,8 +425,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
if tries >= self.device_scan_attempts: if tries >= self.device_scan_attempts:
raise exception.VolumeDeviceNotFound(device=host_devices) raise exception.VolumeDeviceNotFound(device=host_devices)
LOG.info(_LI("ISCSI volume not yet found at: %(host_devices)s. " LOG.info("ISCSI volume not yet found at: %(host_devices)s. "
"Will rescan & retry. Try number: %(tries)s."), "Will rescan & retry. Try number: %(tries)s.",
{'host_devices': host_devices, 'tries': tries}) {'host_devices': host_devices, 'tries': tries})
if self.use_multipath: if self.use_multipath:
@ -499,7 +499,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
if multipath_device: if multipath_device:
break break
if not host_device: if not host_device:
LOG.error(_LE("No accessible volume device: %(host_devices)s"), LOG.error("No accessible volume device: %(host_devices)s",
{'host_devices': host_devices}) {'host_devices': host_devices})
raise exception.VolumeDeviceNotFound(device=host_devices) raise exception.VolumeDeviceNotFound(device=host_devices)
@ -588,7 +588,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
if l.startswith('InitiatorName='): if l.startswith('InitiatorName='):
return l[l.index('=') + 1:].strip() return l[l.index('=') + 1:].strip()
except putils.ProcessExecutionError: except putils.ProcessExecutionError:
LOG.warning(_LW("Could not find the iSCSI Initiator File %s"), LOG.warning("Could not find the iSCSI Initiator File %s",
file_path) file_path)
return None return None
@ -699,7 +699,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
# target exists, and if we get 255 (Not Found), then # target exists, and if we get 255 (Not Found), then
# we run --op new. This will also happen if another # we run --op new. This will also happen if another
# volume is using the same target. # volume is using the same target.
LOG.info(_LI("Trying to connect to iSCSI portal %(portal)s"), LOG.info("Trying to connect to iSCSI portal %(portal)s",
{"portal": connection_properties['target_portal']}) {"portal": connection_properties['target_portal']})
try: try:
self._run_iscsiadm(connection_properties, ()) self._run_iscsiadm(connection_properties, ())
@ -748,9 +748,9 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
# exit_code=15 means the session already exists, so it should # exit_code=15 means the session already exists, so it should
# be regarded as successful login. # be regarded as successful login.
if err.exit_code not in [15]: if err.exit_code not in [15]:
LOG.warning(_LW('Failed to login iSCSI target %(iqn)s ' LOG.warning('Failed to login iSCSI target %(iqn)s '
'on portal %(portal)s (exit code ' 'on portal %(portal)s (exit code '
'%(err)s).'), '%(err)s).',
{'iqn': connection_properties['target_iqn'], {'iqn': connection_properties['target_iqn'],
'portal': connection_properties[ 'portal': connection_properties[
'target_portal'], 'target_portal'],
@ -817,8 +817,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
mpath_map['/dev/' + m[1].split(" ")[0]] = mpath_dev mpath_map['/dev/' + m[1].split(" ")[0]] = mpath_dev
if mpath_line and not mpath_map: if mpath_line and not mpath_map:
LOG.warning(_LW("Failed to parse the output of multipath -ll. " LOG.warning("Failed to parse the output of multipath -ll. "
"stdout: %s"), out) "stdout: %s", out)
return mpath_map return mpath_map
def _run_iscsi_session(self): def _run_iscsi_session(self):
@ -903,11 +903,11 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
hctls = self._get_hosts_channels_targets_luns(ips_iqns_luns) hctls = self._get_hosts_channels_targets_luns(ips_iqns_luns)
except exception.HostChannelsTargetsNotFound as e: except exception.HostChannelsTargetsNotFound as e:
if not e.found: if not e.found:
LOG.error(_LE('iSCSI scan failed: %s'), e) LOG.error('iSCSI scan failed: %s', e)
return return
hctls = e.found hctls = e.found
LOG.warning(_LW('iSCSI scan: %(error)s\nScanning %(hosts)s'), LOG.warning('iSCSI scan: %(error)s\nScanning %(hosts)s',
{'error': e, 'hosts': [h for h, c, t, l in hctls]}) {'error': e, 'hosts': [h for h, c, t, l in hctls]})
for host_path, channel, target_id, target_lun in hctls: for host_path, channel, target_id, target_lun in hctls:

View File

@ -21,8 +21,8 @@ from oslo_log import log as logging
from oslo_utils import fileutils from oslo_utils import fileutils
from oslo_utils import netutils from oslo_utils import netutils
from os_brick.i18n import _, _LE
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick.initiator import linuxrbd from os_brick.initiator import linuxrbd
@ -194,7 +194,7 @@ class RBDConnector(base.BaseLinuxConnector):
try: try:
rbd_handle.read(4096) rbd_handle.read(4096)
except Exception as e: except Exception as e:
LOG.error(_LE("Failed to access RBD device handle: %(error)s"), LOG.error("Failed to access RBD device handle: %(error)s",
{"error": e}) {"error": e})
return False return False
finally: finally:

View File

@ -14,7 +14,6 @@
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _LW
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick.remotefs import remotefs from os_brick.remotefs import remotefs
@ -41,8 +40,8 @@ class RemoteFsConnector(base.BaseLinuxConnector):
kwargs.get(mount_type_lower + '_mount_point_base') or kwargs.get(mount_type_lower + '_mount_point_base') or
mount_point_base) mount_point_base)
else: else:
LOG.warning(_LW("Connection details not present." LOG.warning("Connection details not present."
" RemoteFsClient may not initialize properly.")) " RemoteFsClient may not initialize properly.")
if mount_type_lower == 'scality': if mount_type_lower == 'scality':
cls = remotefs.ScalityRemoteFsClient cls = remotefs.ScalityRemoteFsClient

View File

@ -21,8 +21,8 @@ from oslo_concurrency import lockutils
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _, _LI, _LW
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick import utils from os_brick import utils
@ -80,8 +80,8 @@ class ScaleIOConnector(base.BaseLinuxConnector):
return volume_paths return volume_paths
def _find_volume_path(self): def _find_volume_path(self):
LOG.info(_LI( LOG.info(
"Looking for volume %(volume_id)s, maximum tries: %(tries)s"), "Looking for volume %(volume_id)s, maximum tries: %(tries)s",
{'volume_id': self.volume_id, 'tries': self.device_scan_attempts} {'volume_id': self.volume_id, 'tries': self.device_scan_attempts}
) )
@ -91,7 +91,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
disk_filename = self._wait_for_volume_path(by_id_path) disk_filename = self._wait_for_volume_path(by_id_path)
full_disk_name = ("%(path)s/%(filename)s" % full_disk_name = ("%(path)s/%(filename)s" %
{'path': by_id_path, 'filename': disk_filename}) {'path': by_id_path, 'filename': disk_filename})
LOG.info(_LI("Full disk name is %(full_path)s"), LOG.info("Full disk name is %(full_path)s",
{'full_path': full_disk_name}) {'full_path': full_disk_name})
return full_disk_name return full_disk_name
@ -113,8 +113,8 @@ class ScaleIOConnector(base.BaseLinuxConnector):
disk_filename = None disk_filename = None
filenames = os.listdir(path) filenames = os.listdir(path)
LOG.info(_LI( LOG.info(
"Files found in %(path)s path: %(files)s "), "Files found in %(path)s path: %(files)s ",
{'path': path, 'files': filenames} {'path': path, 'files': filenames}
) )
@ -143,7 +143,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
} }
) )
LOG.info(_LI("ScaleIO get client id by ip request: %(request)s"), LOG.info("ScaleIO get client id by ip request: %(request)s",
{'request': request}) {'request': request})
r = requests.get( r = requests.get(
@ -166,7 +166,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
LOG.error(msg) LOG.error(msg)
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
LOG.info(_LI("ScaleIO sdc id is %(sdc_id)s."), LOG.info("ScaleIO sdc id is %(sdc_id)s.",
{'sdc_id': sdc_id}) {'sdc_id': sdc_id})
return sdc_id return sdc_id
@ -189,7 +189,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
) )
LOG.info( LOG.info(
_LI("ScaleIO get volume id by name request: %(request)s"), "ScaleIO get volume id by name request: %(request)s",
{'request': request} {'request': request}
) )
@ -217,15 +217,15 @@ class ScaleIOConnector(base.BaseLinuxConnector):
LOG.error(msg) LOG.error(msg)
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
LOG.info(_LI("ScaleIO volume id is %(volume_id)s."), LOG.info("ScaleIO volume id is %(volume_id)s.",
{'volume_id': volume_id}) {'volume_id': volume_id})
return volume_id return volume_id
def _check_response(self, response, request, is_get_request=True, def _check_response(self, response, request, is_get_request=True,
params=None): params=None):
if response.status_code == 401 or response.status_code == 403: if response.status_code == 401 or response.status_code == 403:
LOG.info(_LI("Token is invalid, " LOG.info("Token is invalid, "
"going to re-login to get a new one")) "going to re-login to get a new one")
login_request = ( login_request = (
"https://%(server_ip)s:%(server_port)s/api/login" % "https://%(server_ip)s:%(server_port)s/api/login" %
@ -306,15 +306,15 @@ class ScaleIOConnector(base.BaseLinuxConnector):
} }
) )
LOG.info(_LI("ScaleIO sdc query guid command: %(cmd)s"), LOG.info("ScaleIO sdc query guid command: %(cmd)s",
{'cmd': self.GET_GUID_CMD}) {'cmd': self.GET_GUID_CMD})
try: try:
(out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True, (out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True,
root_helper=self._root_helper) root_helper=self._root_helper)
LOG.info(_LI("Map volume %(cmd)s: stdout=%(out)s " LOG.info("Map volume %(cmd)s: stdout=%(out)s "
"stderr=%(err)s"), "stderr=%(err)s",
{'cmd': self.GET_GUID_CMD, 'out': out, 'err': err}) {'cmd': self.GET_GUID_CMD, 'out': out, 'err': err})
except putils.ProcessExecutionError as e: except putils.ProcessExecutionError as e:
@ -323,7 +323,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
guid = out guid = out
LOG.info(_LI("Current sdc guid: %(guid)s"), {'guid': guid}) LOG.info("Current sdc guid: %(guid)s", {'guid': guid})
params = {'guid': guid, 'allowMultipleMappings': 'TRUE'} params = {'guid': guid, 'allowMultipleMappings': 'TRUE'}
self.volume_id = self.volume_id or self._get_volume_id() self.volume_id = self.volume_id or self._get_volume_id()
@ -335,7 +335,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
'volume_id': self.volume_id} 'volume_id': self.volume_id}
) )
LOG.info(_LI("map volume request: %(request)s"), {'request': request}) LOG.info("map volume request: %(request)s", {'request': request})
r = requests.post( r = requests.post(
request, request,
data=json.dumps(params), data=json.dumps(params),
@ -349,9 +349,9 @@ class ScaleIOConnector(base.BaseLinuxConnector):
response = r.json() response = r.json()
error_code = response['errorCode'] error_code = response['errorCode']
if error_code == self.VOLUME_ALREADY_MAPPED_ERROR: if error_code == self.VOLUME_ALREADY_MAPPED_ERROR:
LOG.warning(_LW( LOG.warning(
"Ignoring error mapping volume %(volume_name)s: " "Ignoring error mapping volume %(volume_name)s: "
"volume already mapped."), "volume already mapped.",
{'volume_name': self.volume_name} {'volume_name': self.volume_name}
) )
else: else:
@ -382,7 +382,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
'volume_id': self.volume_id} 'volume_id': self.volume_id}
) )
LOG.info(_LI("Set client limit request: %(request)s"), LOG.info("Set client limit request: %(request)s",
{'request': request}) {'request': request})
r = requests.post( r = requests.post(
@ -395,7 +395,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
r = self._check_response(r, request, False, params) r = self._check_response(r, request, False, params)
if r.status_code != self.OK_STATUS_CODE: if r.status_code != self.OK_STATUS_CODE:
response = r.json() response = r.json()
LOG.info(_LI("Set client limit response: %(response)s"), LOG.info("Set client limit response: %(response)s",
{'response': response}) {'response': response})
msg = ( msg = (
_("Error setting client limits for volume " _("Error setting client limits for volume "
@ -421,9 +421,9 @@ class ScaleIOConnector(base.BaseLinuxConnector):
""" """
self.get_config(connection_properties) self.get_config(connection_properties)
self.volume_id = self.volume_id or self._get_volume_id() self.volume_id = self.volume_id or self._get_volume_id()
LOG.info(_LI( LOG.info(
"ScaleIO disconnect volume in ScaleIO brick volume driver." "ScaleIO disconnect volume in ScaleIO brick volume driver."
)) )
LOG.debug( LOG.debug(
_("ScaleIO Volume name: %(volume_name)s, SDC IP: %(sdc_ip)s, " _("ScaleIO Volume name: %(volume_name)s, SDC IP: %(sdc_ip)s, "
@ -432,14 +432,14 @@ class ScaleIOConnector(base.BaseLinuxConnector):
'server_ip': self.server_ip} 'server_ip': self.server_ip}
) )
LOG.info(_LI("ScaleIO sdc query guid command: %(cmd)s"), LOG.info("ScaleIO sdc query guid command: %(cmd)s",
{'cmd': self.GET_GUID_CMD}) {'cmd': self.GET_GUID_CMD})
try: try:
(out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True, (out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True,
root_helper=self._root_helper) root_helper=self._root_helper)
LOG.info( LOG.info(
_LI("Unmap volume %(cmd)s: stdout=%(out)s stderr=%(err)s"), "Unmap volume %(cmd)s: stdout=%(out)s stderr=%(err)s",
{'cmd': self.GET_GUID_CMD, 'out': out, 'err': err} {'cmd': self.GET_GUID_CMD, 'out': out, 'err': err}
) )
@ -449,7 +449,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
raise exception.BrickException(message=msg) raise exception.BrickException(message=msg)
guid = out guid = out
LOG.info(_LI("Current sdc guid: %(guid)s"), {'guid': guid}) LOG.info("Current sdc guid: %(guid)s", {'guid': guid})
params = {'guid': guid} params = {'guid': guid}
headers = {'content-type': 'application/json'} headers = {'content-type': 'application/json'}
@ -460,7 +460,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
'volume_id': self.volume_id} 'volume_id': self.volume_id}
) )
LOG.info(_LI("Unmap volume request: %(request)s"), LOG.info("Unmap volume request: %(request)s",
{'request': request}) {'request': request})
r = requests.post( r = requests.post(
request, request,
@ -475,9 +475,9 @@ class ScaleIOConnector(base.BaseLinuxConnector):
response = r.json() response = r.json()
error_code = response['errorCode'] error_code = response['errorCode']
if error_code == self.VOLUME_NOT_MAPPED_ERROR: if error_code == self.VOLUME_NOT_MAPPED_ERROR:
LOG.warning(_LW( LOG.warning(
"Ignoring error unmapping volume %(volume_id)s: " "Ignoring error unmapping volume %(volume_id)s: "
"volume not mapped."), {'volume_id': self.volume_name} "volume not mapped.", {'volume_id': self.volume_name}
) )
else: else:
msg = (_("Error unmapping volume %(volume_id)s: %(err)s") % msg = (_("Error unmapping volume %(volume_id)s: %(err)s") %

View File

@ -14,8 +14,8 @@
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _, _LE
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base
from os_brick.initiator import linuxsheepdog from os_brick.initiator import linuxsheepdog
@ -112,8 +112,8 @@ class SheepdogConnector(base.BaseLinuxConnector):
try: try:
sheepdog_handle.read(4096) sheepdog_handle.read(4096)
except Exception as e: except Exception as e:
LOG.error(_LE("Failed to access sheepdog device " LOG.error("Failed to access sheepdog device "
"handle: %(error)s"), "handle: %(error)s",
{"error": e}) {"error": e})
return False return False
finally: finally:

View File

@ -20,7 +20,6 @@ import os
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
from oslo_log import log as logging from oslo_log import log as logging
from os_brick.i18n import _LE, _LW
from os_brick.initiator import linuxscsi from os_brick.initiator import linuxscsi
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -57,8 +56,8 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
return [line.split('/')[4].split(':')[1:] return [line.split('/')[4].split(':')[1:]
for line in out.split('\n') if line.startswith(path)] for line in out.split('\n') if line.startswith(path)]
except Exception as exc: except Exception as exc:
LOG.error(_LE('Could not get HBA channel and SCSI target ID, ' LOG.error('Could not get HBA channel and SCSI target ID, '
'path: %(path)s, reason: %(reason)s'), 'path: %(path)s, reason: %(reason)s',
{'path': path, {'path': path,
'reason': exc}) 'reason': exc})
return None return None
@ -101,13 +100,13 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
# and systool is not installed # and systool is not installed
# 96 = nova.cmd.rootwrap.RC_NOEXECFOUND: # 96 = nova.cmd.rootwrap.RC_NOEXECFOUND:
if exc.exit_code == 96: if exc.exit_code == 96:
LOG.warning(_LW("systool is not installed")) LOG.warning("systool is not installed")
return [] return []
except OSError as exc: except OSError as exc:
# This handles the case where rootwrap is NOT used # This handles the case where rootwrap is NOT used
# and systool is not installed # and systool is not installed
if exc.errno == errno.ENOENT: if exc.errno == errno.ENOENT:
LOG.warning(_LW("systool is not installed")) LOG.warning("systool is not installed")
return [] return []
# No FC HBAs were found # No FC HBAs were found
@ -230,8 +229,8 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
try: try:
self.echo_scsi_command(zfcp_device_command, "1") self.echo_scsi_command(zfcp_device_command, "1")
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("port_rescan call for s390 failed exit" LOG.warning("port_rescan call for s390 failed exit"
" %(code)s, stderr %(stderr)s"), " %(code)s, stderr %(stderr)s",
{'code': exc.exit_code, 'stderr': exc.stderr}) {'code': exc.exit_code, 'stderr': exc.stderr})
zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" % zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" %
@ -240,8 +239,8 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
try: try:
self.echo_scsi_command(zfcp_device_command, lun) self.echo_scsi_command(zfcp_device_command, lun)
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("unit_add call for s390 failed exit %(code)s, " LOG.warning("unit_add call for s390 failed exit %(code)s, "
"stderr %(stderr)s"), "stderr %(stderr)s",
{'code': exc.exit_code, 'stderr': exc.stderr}) {'code': exc.exit_code, 'stderr': exc.stderr})
def deconfigure_scsi_device(self, device_number, target_wwn, lun): def deconfigure_scsi_device(self, device_number, target_wwn, lun):
@ -263,6 +262,6 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
try: try:
self.echo_scsi_command(zfcp_device_command, lun) self.echo_scsi_command(zfcp_device_command, lun)
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("unit_remove call for s390 failed exit %(code)s, " LOG.warning("unit_remove call for s390 failed exit %(code)s, "
"stderr %(stderr)s"), "stderr %(stderr)s",
{'code': exc.exit_code, 'stderr': exc.stderr}) {'code': exc.exit_code, 'stderr': exc.stderr})

View File

@ -16,7 +16,7 @@ import io
from oslo_log import log as logging from oslo_log import log as logging
from os_brick import exception from os_brick import exception
from os_brick.i18n import _, _LE, _LW from os_brick.i18n import _
from os_brick import utils from os_brick import utils
try: try:
@ -106,7 +106,7 @@ class RBDVolume(object):
snapshot=snapshot, snapshot=snapshot,
read_only=read_only) read_only=read_only)
except client.rbd.Error: except client.rbd.Error:
LOG.exception(_LE("error opening rbd image %s"), name) LOG.exception("error opening rbd image %s", name)
client.disconnect() client.disconnect()
raise raise
@ -217,7 +217,7 @@ class RBDVolumeIOWrapper(io.RawIOBase):
try: try:
self._rbd_volume.image.flush() self._rbd_volume.image.flush()
except AttributeError: except AttributeError:
LOG.warning(_LW("flush() not supported in this version of librbd")) LOG.warning("flush() not supported in this version of librbd")
def fileno(self): def fileno(self):
"""RBD does not have support for fileno() so we raise IOError. """RBD does not have support for fileno() so we raise IOError.

View File

@ -25,7 +25,6 @@ from oslo_log import log as logging
from os_brick import exception from os_brick import exception
from os_brick import executor from os_brick import executor
from os_brick.i18n import _LE, _LI, _LW
from os_brick.privileged import rootwrap as priv_rootwrap from os_brick.privileged import rootwrap as priv_rootwrap
from os_brick import utils from os_brick import utils
@ -118,7 +117,7 @@ class LinuxSCSI(executor.Executor):
execute('multipathd', 'show', 'status', execute('multipathd', 'show', 'status',
run_as_root=True, root_helper=root_helper) run_as_root=True, root_helper=root_helper)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.error(_LE('multipathd is not running: exit code %(err)s'), LOG.error('multipathd is not running: exit code %(err)s',
{'err': err.exit_code}) {'err': err.exit_code})
if enforce_multipath: if enforce_multipath:
raise raise
@ -147,8 +146,8 @@ class LinuxSCSI(executor.Executor):
self._execute('blockdev', '--flushbufs', device, run_as_root=True, self._execute('blockdev', '--flushbufs', device, run_as_root=True,
root_helper=self._root_helper) root_helper=self._root_helper)
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("Failed to flush IO buffers prior to removing " LOG.warning("Failed to flush IO buffers prior to removing "
"device: %(code)s"), {'code': exc.exit_code}) "device: %(code)s", {'code': exc.exit_code})
@utils.retry(exceptions=putils.ProcessExecutionError) @utils.retry(exceptions=putils.ProcessExecutionError)
def flush_multipath_device(self, device): def flush_multipath_device(self, device):
@ -160,7 +159,7 @@ class LinuxSCSI(executor.Executor):
if exc.exit_code == 1 and 'map in use' in exc.stdout: if exc.exit_code == 1 and 'map in use' in exc.stdout:
LOG.debug('Multipath is in use, cannot be flushed yet.') LOG.debug('Multipath is in use, cannot be flushed yet.')
raise raise
LOG.warning(_LW("multipath call failed exit %(code)s"), LOG.warning("multipath call failed exit %(code)s",
{'code': exc.exit_code}) {'code': exc.exit_code})
def flush_multipath_devices(self): def flush_multipath_devices(self):
@ -168,7 +167,7 @@ class LinuxSCSI(executor.Executor):
self._execute('multipath', '-F', run_as_root=True, self._execute('multipath', '-F', run_as_root=True,
root_helper=self._root_helper) root_helper=self._root_helper)
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("multipath call failed exit %(code)s"), LOG.warning("multipath call failed exit %(code)s",
{'code': exc.exit_code}) {'code': exc.exit_code})
@utils.retry(exceptions=exception.VolumeDeviceNotFound) @utils.retry(exceptions=exception.VolumeDeviceNotFound)
@ -236,7 +235,7 @@ class LinuxSCSI(executor.Executor):
/dev/mapper/<WWN> /dev/mapper/<WWN>
""" """
LOG.info(_LI("Find Multipath device file for volume WWN %(wwn)s"), LOG.info("Find Multipath device file for volume WWN %(wwn)s",
{'wwn': wwn}) {'wwn': wwn})
# First look for the common path # First look for the common path
wwn_dict = {'wwn': wwn} wwn_dict = {'wwn': wwn}
@ -257,8 +256,8 @@ class LinuxSCSI(executor.Executor):
pass pass
# couldn't find a path # couldn't find a path
LOG.warning(_LW("couldn't find a valid multipath device path for " LOG.warning("couldn't find a valid multipath device path for "
"%(wwn)s"), wwn_dict) "%(wwn)s", wwn_dict)
return None return None
def find_multipath_device(self, device): def find_multipath_device(self, device):
@ -279,7 +278,7 @@ class LinuxSCSI(executor.Executor):
run_as_root=True, run_as_root=True,
root_helper=self._root_helper) root_helper=self._root_helper)
except putils.ProcessExecutionError as exc: except putils.ProcessExecutionError as exc:
LOG.warning(_LW("multipath call failed exit %(code)s"), LOG.warning("multipath call failed exit %(code)s",
{'code': exc.exit_code}) {'code': exc.exit_code})
raise exception.CommandExecutionFailed( raise exception.CommandExecutionFailed(
cmd='multipath -l %s' % device) cmd='multipath -l %s' % device)
@ -302,7 +301,7 @@ class LinuxSCSI(executor.Executor):
try: try:
os.stat(mdev) os.stat(mdev)
except OSError: except OSError:
LOG.warning(_LW("Couldn't find multipath device %s"), LOG.warning("Couldn't find multipath device %s",
mdev) mdev)
return None return None
@ -409,18 +408,17 @@ class LinuxSCSI(executor.Executor):
self.multipath_reconfigure() self.multipath_reconfigure()
size = self.get_device_size(mpath_device) size = self.get_device_size(mpath_device)
LOG.info(_LI("mpath(%(device)s) current size %(size)s"), LOG.info("mpath(%(device)s) current size %(size)s",
{'device': mpath_device, 'size': size}) {'device': mpath_device, 'size': size})
result = self.multipath_resize_map(scsi_wwn) result = self.multipath_resize_map(scsi_wwn)
if 'fail' in result: if 'fail' in result:
msg = (_LI("Multipathd failed to update the size mapping of " LOG.error("Multipathd failed to update the size mapping of "
"multipath device %(scsi_wwn)s volume %(volume)s") % "multipath device %(scsi_wwn)s volume %(volume)s",
{'scsi_wwn': scsi_wwn, 'volume': volume_paths}) {'scsi_wwn': scsi_wwn, 'volume': volume_paths})
LOG.error(msg)
return None return None
new_size = self.get_device_size(mpath_device) new_size = self.get_device_size(mpath_device)
LOG.info(_LI("mpath(%(device)s) new size %(size)s"), LOG.info("mpath(%(device)s) new size %(size)s",
{'device': mpath_device, 'size': new_size}) {'device': mpath_device, 'size': new_size})
return new_size return new_size

View File

@ -17,8 +17,8 @@ from os_win import utilsfactory
from oslo_log import log as logging from oslo_log import log as logging
from os_brick import exception from os_brick import exception
from os_brick.i18n import _
from os_brick import initiator from os_brick import initiator
from os_brick.i18n import _, _LE
from os_brick.initiator import initiator_connector from os_brick.initiator import initiator_connector
from os_brick import utils from os_brick import utils
@ -45,10 +45,10 @@ class BaseWindowsConnector(initiator_connector.InitiatorConnector):
mpio_enabled = hostutils.check_server_feature( mpio_enabled = hostutils.check_server_feature(
hostutils.FEATURE_MPIO) hostutils.FEATURE_MPIO)
if not mpio_enabled: if not mpio_enabled:
err_msg = _LE( err_msg = _("Using multipath connections for iSCSI and FC disks "
"Using multipath connections for iSCSI and FC disks " "requires the Multipath IO Windows feature to be "
"requires the Multipath IO Windows feature to be " "enabled. MPIO must be configured to claim such "
"enabled. MPIO must be configured to claim such devices.") "devices.")
LOG.error(err_msg) LOG.error(err_msg)
if enforce_multipath: if enforce_multipath:
raise exception.BrickException(err_msg) raise exception.BrickException(err_msg)
@ -82,8 +82,8 @@ class BaseWindowsConnector(initiator_connector.InitiatorConnector):
dev.read(1) dev.read(1)
except IOError: except IOError:
LOG.exception( LOG.exception(
_LE("Failed to access the device on the path " "Failed to access the device on the path "
"%(path)s"), {"path": path}) "%(path)s", {"path": path})
return False return False
return True return True

View File

@ -18,7 +18,7 @@ from os_win import utilsfactory
from oslo_log import log as logging from oslo_log import log as logging
from os_brick import exception from os_brick import exception
from os_brick.i18n import _, _LE, _LI, _LW from os_brick.i18n import _
from os_brick.initiator.connectors import base_iscsi from os_brick.initiator.connectors import base_iscsi
from os_brick.initiator.windows import base as win_conn_base from os_brick.initiator.windows import base as win_conn_base
from os_brick import utils from os_brick import utils
@ -43,17 +43,16 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
""" """
valid_initiator_list = True valid_initiator_list = True
if not self.initiator_list: if not self.initiator_list:
LOG.info(_LI("No iSCSI initiator was explicitly requested. " LOG.info("No iSCSI initiator was explicitly requested. "
"The Microsoft iSCSI initiator will choose the " "The Microsoft iSCSI initiator will choose the "
"initiator when establishing sessions.")) "initiator when establishing sessions.")
else: else:
available_initiators = self._iscsi_utils.get_iscsi_initiators() available_initiators = self._iscsi_utils.get_iscsi_initiators()
for initiator in self.initiator_list: for initiator in self.initiator_list:
if initiator not in available_initiators: if initiator not in available_initiators:
msg = _LW("The requested initiator %(req_initiator)s " LOG.warning("The requested initiator %(req_initiator)s "
"is not in the list of available initiators: " "is not in the list of available initiators: "
"%(avail_initiators)s.") "%(avail_initiators)s.",
LOG.warning(msg,
dict(req_initiator=initiator, dict(req_initiator=initiator,
avail_initiators=available_initiators)) avail_initiators=available_initiators))
valid_initiator_list = False valid_initiator_list = False
@ -85,14 +84,14 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
target_iqn, target_iqn,
target_lun) in self._get_all_paths(connection_properties): target_lun) in self._get_all_paths(connection_properties):
try: try:
msg = _LI("Attempting to establish an iSCSI session to " LOG.info("Attempting to establish an iSCSI session to "
"target %(target_iqn)s on portal %(target_portal)s " "target %(target_iqn)s on portal %(target_portal)s "
"accessing LUN %(target_lun)s using initiator " "accessing LUN %(target_lun)s using initiator "
"%(initiator_name)s.") "%(initiator_name)s.",
LOG.info(msg, dict(target_portal=target_portal, dict(target_portal=target_portal,
target_iqn=target_iqn, target_iqn=target_iqn,
target_lun=target_lun, target_lun=target_lun,
initiator_name=initiator_name)) initiator_name=initiator_name))
self._iscsi_utils.login_storage_target( self._iscsi_utils.login_storage_target(
target_lun=target_lun, target_lun=target_lun,
target_iqn=target_iqn, target_iqn=target_iqn,
@ -118,7 +117,7 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
if not self.use_multipath: if not self.use_multipath:
break break
except os_win_exc.OSWinException: except os_win_exc.OSWinException:
LOG.exception(_LE("Could not establish the iSCSI session.")) LOG.exception("Could not establish the iSCSI session.")
if not volume_connected: if not volume_connected:
raise exception.BrickException( raise exception.BrickException(

View File

@ -23,7 +23,6 @@ import re
from os_brick import exception from os_brick import exception
from os_brick import executor from os_brick import executor
from os_brick.i18n import _LE, _LI
from os_brick.privileged import rootwrap as priv_rootwrap from os_brick.privileged import rootwrap as priv_rootwrap
from os_brick import utils from os_brick import utils
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
@ -88,14 +87,14 @@ class LVM(executor.Executor):
try: try:
self._create_vg(physical_volumes) self._create_vg(physical_volumes)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error creating Volume Group')) LOG.exception('Error creating Volume Group')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise exception.VolumeGroupCreationFailed(vg_name=self.vg_name) raise exception.VolumeGroupCreationFailed(vg_name=self.vg_name)
if self._vg_exists() is False: if self._vg_exists() is False:
LOG.error(_LE('Unable to locate Volume Group %s'), vg_name) LOG.error('Unable to locate Volume Group %s', vg_name)
raise exception.VolumeGroupNotFound(vg_name=vg_name) raise exception.VolumeGroupNotFound(vg_name=vg_name)
# NOTE: we assume that the VG has been activated outside of Cinder # NOTE: we assume that the VG has been activated outside of Cinder
@ -181,10 +180,10 @@ class LVM(executor.Executor):
free_space = pool_size - consumed_space free_space = pool_size - consumed_space
free_space = round(free_space, 2) free_space = round(free_space, 2)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error querying thin pool about data_percent')) LOG.exception('Error querying thin pool about data_percent')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
return free_space return free_space
@ -298,8 +297,8 @@ class LVM(executor.Executor):
with excutils.save_and_reraise_exception(reraise=True) as ctx: with excutils.save_and_reraise_exception(reraise=True) as ctx:
if "not found" in err.stderr or "Failed to find" in err.stderr: if "not found" in err.stderr or "Failed to find" in err.stderr:
ctx.reraise = False ctx.reraise = False
LOG.info(_LI("Logical Volume not found when querying " LOG.info("Logical Volume not found when querying "
"LVM info. (vg_name=%(vg)s, lv_name=%(lv)s"), "LVM info. (vg_name=%(vg)s, lv_name=%(lv)s",
{'vg': vg_name, 'lv': lv_name}) {'vg': vg_name, 'lv': lv_name})
out = None out = None
@ -421,7 +420,7 @@ class LVM(executor.Executor):
vg_list = self.get_all_volume_groups(self._root_helper, self.vg_name) vg_list = self.get_all_volume_groups(self._root_helper, self.vg_name)
if len(vg_list) != 1: if len(vg_list) != 1:
LOG.error(_LE('Unable to find VG: %s'), self.vg_name) LOG.error('Unable to find VG: %s', self.vg_name)
raise exception.VolumeGroupNotFound(vg_name=self.vg_name) raise exception.VolumeGroupNotFound(vg_name=self.vg_name)
self.vg_size = float(vg_list[0]['size']) self.vg_size = float(vg_list[0]['size'])
@ -510,9 +509,9 @@ class LVM(executor.Executor):
""" """
if not LVM.supports_thin_provisioning(self._root_helper): if not LVM.supports_thin_provisioning(self._root_helper):
LOG.error(_LE('Requested to setup thin provisioning, ' LOG.error('Requested to setup thin provisioning, '
'however current LVM version does not ' 'however current LVM version does not '
'support it.')) 'support it.')
return None return None
if name is None: if name is None:
@ -572,10 +571,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error creating Volume')) LOG.exception('Error creating Volume')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise
@utils.retry(putils.ProcessExecutionError) @utils.retry(putils.ProcessExecutionError)
@ -589,7 +588,7 @@ class LVM(executor.Executor):
""" """
source_lvref = self.get_volume(source_lv_name) source_lvref = self.get_volume(source_lv_name)
if source_lvref is None: if source_lvref is None:
LOG.error(_LE("Trying to create snapshot by non-existent LV: %s"), LOG.error("Trying to create snapshot by non-existent LV: %s",
source_lv_name) source_lv_name)
raise exception.VolumeDeviceNotFound(device=source_lv_name) raise exception.VolumeDeviceNotFound(device=source_lv_name)
cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '--name', name, '--snapshot', cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '--name', name, '--snapshot',
@ -603,10 +602,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error creating snapshot')) LOG.exception('Error creating snapshot')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise
def _mangle_lv_name(self, name): def _mangle_lv_name(self, name):
@ -639,10 +638,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error deactivating LV')) LOG.exception('Error deactivating LV')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise
# Wait until lv is deactivated to return in # Wait until lv is deactivated to return in
@ -696,10 +695,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error activating LV')) LOG.exception('Error activating LV')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise
@utils.retry(putils.ProcessExecutionError) @utils.retry(putils.ProcessExecutionError)
@ -785,10 +784,10 @@ class LVM(executor.Executor):
self._execute(*cmd, root_helper=self._root_helper, self._execute(*cmd, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error extending Volume')) LOG.exception('Error extending Volume')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise
def vg_mirror_free_space(self, mirror_count): def vg_mirror_free_space(self, mirror_count):
@ -823,8 +822,8 @@ class LVM(executor.Executor):
root_helper=self._root_helper, root_helper=self._root_helper,
run_as_root=True) run_as_root=True)
except putils.ProcessExecutionError as err: except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error renaming logical volume')) LOG.exception('Error renaming logical volume')
LOG.error(_LE('Cmd :%s'), err.cmd) LOG.error('Cmd :%s', err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout) LOG.error('StdOut :%s', err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr) LOG.error('StdErr :%s', err.stderr)
raise raise

View File

@ -25,7 +25,7 @@ import six
from os_brick import exception from os_brick import exception
from os_brick import executor from os_brick import executor
from os_brick.i18n import _, _LI from os_brick.i18n import _
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -99,7 +99,7 @@ class RemoteFsClient(executor.Executor):
mount_path = self.get_mount_point(share) mount_path = self.get_mount_point(share)
if mount_path in self._read_mounts(): if mount_path in self._read_mounts():
LOG.info(_LI('Already mounted: %s'), mount_path) LOG.info('Already mounted: %s', mount_path)
return return
self._execute('mkdir', '-p', mount_path, check_exit_code=0) self._execute('mkdir', '-p', mount_path, check_exit_code=0)
@ -256,7 +256,7 @@ class ScalityRemoteFsClient(RemoteFsClient):
same method signature for class inheritance purpose. same method signature for class inheritance purpose.
""" """
if self._mount_base in self._read_mounts(): if self._mount_base in self._read_mounts():
LOG.info(_LI('Already mounted: %s'), self._mount_base) LOG.info('Already mounted: %s', self._mount_base)
return return
self._execute('mkdir', '-p', self._mount_base, check_exit_code=0) self._execute('mkdir', '-p', self._mount_base, check_exit_code=0)
super(ScalityRemoteFsClient, self)._do_mount( super(ScalityRemoteFsClient, self)._do_mount(

View File

@ -23,7 +23,7 @@ from oslo_log import log as logging
from os_win import utilsfactory from os_win import utilsfactory
from os_brick import exception from os_brick import exception
from os_brick.i18n import _, _LI from os_brick.i18n import _
from os_brick.remotefs import remotefs from os_brick.remotefs import remotefs
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -77,7 +77,7 @@ class WindowsRemoteFsClient(remotefs.RemoteFsClient):
self._smbutils.is_local_share(share_norm_path)) self._smbutils.is_local_share(share_norm_path))
if use_local_path: if use_local_path:
LOG.info(_LI("Skipping mounting local share %(share_path)s."), LOG.info("Skipping mounting local share %(share_path)s.",
dict(share_path=share_norm_path)) dict(share_path=share_norm_path))
else: else:
mount_options = " ".join( mount_options = " ".join(