diff --git a/os_brick/encryptors/__init__.py b/os_brick/encryptors/__init__.py index 1d5a6eb..914bccc 100644 --- a/os_brick/encryptors/__init__.py +++ b/os_brick/encryptors/__init__.py @@ -14,7 +14,6 @@ # under the License. from os_brick.encryptors import nop -from os_brick.i18n import _LE, _LW from oslo_log import log as logging 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. # Until then continue to allow both the class name and path to be used. if provider in LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP: - LOG.warning(_LW("Use of the in tree encryptor class %(provider)s" - " by directly referencing the implementation class" - " will be blocked in the Pike release of" - " os-brick."), {'provider': provider}) + LOG.warning("Use of the in tree encryptor class %(provider)s" + " by directly referencing the implementation class" + " will be blocked in the Pike release of" + " os-brick.", {'provider': provider}) provider = LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP[provider] if provider in FORMAT_TO_FRONTEND_ENCRYPTOR_MAP: @@ -78,9 +77,9 @@ def get_volume_encryptor(root_helper, elif provider is None: provider = "os_brick.encryptors.nop.NoOpEncryptor" else: - LOG.warning(_LW("Use of the out of tree encryptor class " - "%(provider)s will be blocked with the Pike " - "release of os-brick."), {'provider': provider}) + LOG.warning("Use of the out of tree encryptor class " + "%(provider)s will be blocked with the Pike " + "release of os-brick.", {'provider': provider}) try: encryptor = importutils.import_object( @@ -91,7 +90,7 @@ def get_volume_encryptor(root_helper, execute, **kwargs) 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}) raise @@ -111,12 +110,11 @@ def get_encryption_metadata(context, volume_api, volume_id, connection_info): metadata = volume_api.get_volume_encryption_metadata(context, volume_id) if not metadata: - LOG.warning(_LW( - 'Volume %s should be encrypted but there is no ' - 'encryption metadata.'), volume_id) + LOG.warning('Volume %s should be encrypted but there is no ' + 'encryption metadata.', volume_id) except Exception as e: - LOG.error(_LE("Failed to retrieve encryption metadata for " - "volume %(volume_id)s: %(exception)s"), + LOG.error("Failed to retrieve encryption metadata for " + "volume %(volume_id)s: %(exception)s", {'volume_id': volume_id, 'exception': e}) raise diff --git a/os_brick/encryptors/cryptsetup.py b/os_brick/encryptors/cryptsetup.py index 37439e5..1cdaa04 100644 --- a/os_brick/encryptors/cryptsetup.py +++ b/os_brick/encryptors/cryptsetup.py @@ -20,7 +20,6 @@ import os from os_brick.encryptors import base from os_brick import exception -from os_brick.i18n import _LW, _LI from oslo_concurrency import processutils 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 # case, we will omit the warning message. if e.exit_code != 1: - LOG.warning(_LW('cryptsetup status %(dev_name)s exited ' - 'abnormally (status %(exit_code)s): %(err)s'), + LOG.warning('cryptsetup status %(dev_name)s exited ' + 'abnormally (status %(exit_code)s): %(err)s', {"dev_name": dev_name, "exit_code": e.exit_code, "err": e.stderr}) return False @@ -157,9 +156,9 @@ class CryptsetupEncryptor(base.VolumeEncryptor): if e.exit_code == 2: # NOTE(lyarwood): Workaround bug#1633518 by attempting to use # a mangled passphrase to open the device.. - LOG.info(_LI("Unable to open %s with the current passphrase, " - "attempting to use a mangled passphrase to open " - "the volume."), self.dev_path) + LOG.info("Unable to open %s with the current passphrase, " + "attempting to use a mangled passphrase to open " + "the volume.", self.dev_path) self._open_volume(self._get_mangled_passphrase(key), **kwargs) # modify the original symbolic link to refer to the decrypted device diff --git a/os_brick/encryptors/luks.py b/os_brick/encryptors/luks.py index 4dd70e3..93cf9f9 100644 --- a/os_brick/encryptors/luks.py +++ b/os_brick/encryptors/luks.py @@ -14,7 +14,6 @@ # under the License. from os_brick.encryptors import cryptsetup -from os_brick.i18n import _LI, _LW from os_brick.privileged import rootwrap as priv_rootwrap from oslo_concurrency import processutils as putils from oslo_log import log as logging @@ -38,8 +37,8 @@ def is_luks(root_helper, device, execute=None): check_exit_code=True) return True except putils.ProcessExecutionError as e: - LOG.warning(_LW("isLuks exited abnormally (status %(exit_code)s): " - "%(stderr)s"), + LOG.warning("isLuks exited abnormally (status %(exit_code)s): " + "%(stderr)s", {"exit_code": e.exit_code, "stderr": e.stderr}) return False @@ -157,8 +156,8 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor): self.dev_path, execute=self._execute): # the device has never been formatted; format it and try again - LOG.info(_LI("%s is not a valid LUKS device;" - " formatting device for first use"), + LOG.info("%s is not a valid LUKS device;" + " formatting device for first use", self.dev_path) self._format_volume(passphrase, **kwargs) self._open_volume(passphrase, **kwargs) @@ -166,9 +165,9 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor): # NOTE(lyarwood): Workaround bug#1633518 by replacing any # mangled passphrases that are found on the volume. # TODO(lyarwood): Remove workaround during R. - LOG.warning(_LW("%s is not usable with the current " - "passphrase, attempting to use a mangled " - "passphrase to open the volume."), + LOG.warning("%s is not usable with the current " + "passphrase, attempting to use a mangled " + "passphrase to open the volume.", self.dev_path) self._unmangle_volume(key, passphrase, **kwargs) self._open_volume(passphrase, **kwargs) diff --git a/os_brick/exception.py b/os_brick/exception.py index 3fa11bb..754a190 100644 --- a/os_brick/exception.py +++ b/os_brick/exception.py @@ -16,7 +16,7 @@ import six -from os_brick.i18n import _, _LE +from os_brick.i18n import _ from oslo_log import log as logging @@ -51,11 +51,11 @@ class BrickException(Exception): except Exception: # kwargs doesn't match a variable in the message # log the issue and the kwargs - LOG.exception(_LE("Exception in string format operation. " - "msg='%s'"), self.message) + LOG.exception("Exception in string format operation. " + "msg='%s'", self.message) for name, value in kwargs.items(): - LOG.error(_LE("%(name)s: %(value)s"), {'name': name, - 'value': value}) + LOG.error("%(name)s: %(value)s", {'name': name, + 'value': value}) # at least get the core message out if something happened message = self.message diff --git a/os_brick/i18n.py b/os_brick/i18n.py index 0ec6c2e..0fdd4a6 100644 --- a/os_brick/i18n.py +++ b/os_brick/i18n.py @@ -26,13 +26,3 @@ _translators = i18n.TranslatorFactory(domain=DOMAIN) # The primary translation function using the well-known name "_" _ = _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 diff --git a/os_brick/initiator/connectors/aoe.py b/os_brick/initiator/connectors/aoe.py index 360cf8a..1496bfc 100644 --- a/os_brick/initiator/connectors/aoe.py +++ b/os_brick/initiator/connectors/aoe.py @@ -21,7 +21,6 @@ from oslo_service import loopingcall from os_brick import exception from os_brick import initiator -from os_brick.i18n import _LI from os_brick.initiator.connectors import base from os_brick import utils @@ -104,8 +103,8 @@ class AoEConnector(base.BaseLinuxConnector): if waiting_status['tries'] >= self.device_scan_attempts: raise exception.VolumeDeviceNotFound(device=aoe_path) - LOG.info(_LI("AoE volume not yet found at: %(path)s. " - "Try number: %(tries)s"), + LOG.info("AoE volume not yet found at: %(path)s. " + "Try number: %(tries)s", {'path': aoe_device, 'tries': waiting_status['tries']}) self._aoe_discover() diff --git a/os_brick/initiator/connectors/base.py b/os_brick/initiator/connectors/base.py index 51c5bc1..df51a51 100644 --- a/os_brick/initiator/connectors/base.py +++ b/os_brick/initiator/connectors/base.py @@ -22,7 +22,6 @@ from oslo_log import log as logging from os_brick import exception from os_brick import initiator -from os_brick.i18n import _LE, _LW from os_brick.initiator import host_driver from os_brick.initiator import initiator_connector 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, root_helper=self._root_helper) except putils.ProcessExecutionError as e: - LOG.error(_LE("Failed to access the device on the path " - "%(path)s: %(error)s."), + LOG.error("Failed to access the device on the path " + "%(path)s: %(error)s.", {"path": path, "error": e.stderr}) return False # 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. self._linuxscsi.wait_for_rw(device_wwn, device_path) except exception.BlockDeviceReadOnly: - LOG.warning(_LW('Block device %s is still read-only. ' - 'Continuing anyway.'), device_path) + LOG.warning('Block device %s is still read-only. ' + 'Continuing anyway.', device_path) return device_path, multipath_id diff --git a/os_brick/initiator/connectors/disco.py b/os_brick/initiator/connectors/disco.py index 09bae78..a9b7afb 100644 --- a/os_brick/initiator/connectors/disco.py +++ b/os_brick/initiator/connectors/disco.py @@ -21,8 +21,8 @@ from oslo_concurrency import lockutils from oslo_log import log as logging import six -from os_brick.i18n import _, _LI, _LE from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick import utils @@ -128,7 +128,7 @@ class DISCOConnector(base.BaseLinuxConnector): msg = _("Detach volume failed") raise exception.BrickException(message=msg) else: - LOG.info(_LI("Volume already detached from host")) + LOG.info("Volume already detached from host") def _mount_disco_volume(self, path, volume_id): """Send request to mount volume on physical host.""" @@ -146,7 +146,7 @@ class DISCOConnector(base.BaseLinuxConnector): msg = _("Attach volume failed") raise exception.BrickException(message=msg) 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): """Connect to TCP socket.""" @@ -171,7 +171,7 @@ class DISCOConnector(base.BaseLinuxConnector): break if sock is None: - LOG.error(_LE("Cannot connect TCP socket")) + LOG.error("Cannot connect TCP socket") return sock def _send_disco_vol_cmd(self, client_ip, client_port, op_code, vol_id): diff --git a/os_brick/initiator/connectors/fibre_channel.py b/os_brick/initiator/connectors/fibre_channel.py index f80b7cf..6d5d96e 100644 --- a/os_brick/initiator/connectors/fibre_channel.py +++ b/os_brick/initiator/connectors/fibre_channel.py @@ -19,7 +19,6 @@ from oslo_log import log as logging from oslo_service import loopingcall import six -from os_brick.i18n import _LE, _LI, _LW from os_brick import exception from os_brick import initiator from os_brick.initiator.connectors import base @@ -105,8 +104,8 @@ class FibreChannelConnector(base.BaseLinuxConnector): if volume_paths: return self._linuxscsi.extend_volume(volume_paths) else: - LOG.warning(_LW("Couldn't find any volume paths on the host to " - "extend volume for %(props)s"), + LOG.warning("Couldn't find any volume paths on the host to " + "extend volume for %(props)s", {'props': connection_properties}) raise exception.VolumePathsNotFound() @@ -133,8 +132,7 @@ class FibreChannelConnector(base.BaseLinuxConnector): if len(host_devices) == 0: # this is empty because we don't have any FC HBAs - LOG.warning( - _LW("We are unable to locate any Fibre Channel devices")) + LOG.warning("We are unable to locate any Fibre Channel devices") raise exception.NoFibreChannelHostsFound() # The /dev/disk/by-path/... node is not always present immediately @@ -153,11 +151,11 @@ class FibreChannelConnector(base.BaseLinuxConnector): raise loopingcall.LoopingCallDone() 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() - LOG.info(_LI("Fibre Channel volume device not yet found. " - "Will rescan & retry. Try number: %(tries)s."), + LOG.info("Fibre Channel volume device not yet found. " + "Will rescan & retry. Try number: %(tries)s.", {'tries': tries}) self._linuxfc.rescan_hosts(hbas, diff --git a/os_brick/initiator/connectors/hgst.py b/os_brick/initiator/connectors/hgst.py index 54f990f..d676151 100644 --- a/os_brick/initiator/connectors/hgst.py +++ b/os_brick/initiator/connectors/hgst.py @@ -18,8 +18,8 @@ import socket from oslo_concurrency import processutils as putils from oslo_log import log as logging -from os_brick.i18n import _, _LE from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick import utils @@ -48,8 +48,8 @@ class HGSTConnector(base.BaseLinuxConnector): def _log_cli_err(self, err): """Dumps the full command output to a logfile in error cases.""" - LOG.error(_LE("CLI fail: '%(cmd)s' = %(code)s\nout: %(stdout)s\n" - "err: %(stderr)s"), + LOG.error("CLI fail: '%(cmd)s' = %(code)s\nout: %(stdout)s\n" + "err: %(stderr)s", {'cmd': err.cmd, 'code': err.exit_code, 'stdout': err.stdout, 'stderr': err.stderr}) diff --git a/os_brick/initiator/connectors/huawei.py b/os_brick/initiator/connectors/huawei.py index 8866dd1..2a4d1ef 100644 --- a/os_brick/initiator/connectors/huawei.py +++ b/os_brick/initiator/connectors/huawei.py @@ -17,8 +17,8 @@ import os from oslo_concurrency import lockutils from oslo_log import log as logging -from os_brick.i18n import _, _LE from os_brick import exception +from os_brick.i18n import _ from os_brick.initiator.connectors import base from os_brick import utils @@ -45,8 +45,8 @@ class HuaweiStorHyperConnector(base.BaseLinuxConnector): self.cli_path) if not os.path.isfile(self.cli_path): self.iscliexist = False - LOG.error(_LE('SDS CLI file not found, ' - 'HuaweiStorHyperConnector init failed.')) + LOG.error('SDS CLI file not found, ' + 'HuaweiStorHyperConnector init failed.') super(HuaweiStorHyperConnector, self).__init__(root_helper, driver=driver, *args, **kwargs) @@ -168,7 +168,7 @@ class HuaweiStorHyperConnector(base.BaseLinuxConnector): LOG.debug('%(method)s volume returns %(analyse_result)s.', {'method': method, 'analyse_result': analyse_result}) if clilog: - LOG.error(_LE("SDS CLI output some log: %s."), clilog) + LOG.error("SDS CLI output some log: %s.", clilog) return analyse_result def _analyze_output(self, out): diff --git a/os_brick/initiator/connectors/iscsi.py b/os_brick/initiator/connectors/iscsi.py index b923b7b..a651c0a 100644 --- a/os_brick/initiator/connectors/iscsi.py +++ b/os_brick/initiator/connectors/iscsi.py @@ -25,8 +25,8 @@ from oslo_concurrency import processutils as putils from oslo_log import log as logging from oslo_utils import strutils -from os_brick.i18n import _, _LE, _LI, _LW from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick.initiator.connectors import base_iscsi @@ -112,8 +112,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): iscsi_sessions = [] if err: - LOG.warning(_LW("Couldn't find iscsi sessions because " - "iscsiadm err: %s"), + LOG.warning("Couldn't find iscsi sessions because " + "iscsiadm err: %s", err) else: # parse the output from iscsiadm @@ -163,7 +163,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): target_props = None connected_to_portal = False 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 try: 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) else: - LOG.info(_LI("Multipath discovery for iSCSI not enabled.")) + LOG.info("Multipath discovery for iSCSI not enabled.") iscsi_sessions = [] if not connect_to_portal: iscsi_sessions = self._get_iscsi_sessions() @@ -223,8 +223,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): host_devices = self._get_device_path(props) break else: - LOG.warning(_LW( - 'Failed to connect to iSCSI portal %(portal)s.'), + LOG.warning( + 'Failed to connect to iSCSI portal %(portal)s.', {'portal': props['target_portal']}) else: # 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: return transport_iface - LOG.warning(_LW("No useable transport found for iscsi iface %s. " - "Falling back to default transport."), + LOG.warning("No useable transport found for iscsi iface %s. " + "Falling back to default transport.", transport_iface) return 'default' @@ -323,8 +323,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): connection_properties ) else: - LOG.error(_LE("Unable to find target portal: " - "%(target_portal)s."), + LOG.error("Unable to find target portal: " + "%(target_portal)s.", {'target_portal': connection_properties[ 'target_portal']}) raise @@ -373,15 +373,15 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): Try and update the local kernel's size information 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) - LOG.info(_LI("Found paths for volume %s"), volume_paths) + LOG.info("Found paths for volume %s", volume_paths) if volume_paths: return self._linuxscsi.extend_volume(volume_paths) else: - LOG.warning(_LW("Couldn't find any volume paths on the host to " - "extend volume for %(props)s"), + LOG.warning("Couldn't find any volume paths on the host to " + "extend volume for %(props)s", {'props': connection_properties}) raise exception.VolumePathsNotFound() @@ -425,8 +425,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): if tries >= self.device_scan_attempts: raise exception.VolumeDeviceNotFound(device=host_devices) - LOG.info(_LI("ISCSI volume not yet found at: %(host_devices)s. " - "Will rescan & retry. Try number: %(tries)s."), + LOG.info("ISCSI volume not yet found at: %(host_devices)s. " + "Will rescan & retry. Try number: %(tries)s.", {'host_devices': host_devices, 'tries': tries}) if self.use_multipath: @@ -499,7 +499,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): if multipath_device: break 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}) raise exception.VolumeDeviceNotFound(device=host_devices) @@ -588,7 +588,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): if l.startswith('InitiatorName='): return l[l.index('=') + 1:].strip() 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) return None @@ -699,7 +699,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): # target exists, and if we get 255 (Not Found), then # we run --op new. This will also happen if another # 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']}) try: 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 # be regarded as successful login. if err.exit_code not in [15]: - LOG.warning(_LW('Failed to login iSCSI target %(iqn)s ' - 'on portal %(portal)s (exit code ' - '%(err)s).'), + LOG.warning('Failed to login iSCSI target %(iqn)s ' + 'on portal %(portal)s (exit code ' + '%(err)s).', {'iqn': connection_properties['target_iqn'], 'portal': connection_properties[ 'target_portal'], @@ -817,8 +817,8 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): mpath_map['/dev/' + m[1].split(" ")[0]] = mpath_dev if mpath_line and not mpath_map: - LOG.warning(_LW("Failed to parse the output of multipath -ll. " - "stdout: %s"), out) + LOG.warning("Failed to parse the output of multipath -ll. " + "stdout: %s", out) return mpath_map 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) except exception.HostChannelsTargetsNotFound as e: if not e.found: - LOG.error(_LE('iSCSI scan failed: %s'), e) + LOG.error('iSCSI scan failed: %s', e) return 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]}) for host_path, channel, target_id, target_lun in hctls: diff --git a/os_brick/initiator/connectors/rbd.py b/os_brick/initiator/connectors/rbd.py index 1f060db..a6a129e 100644 --- a/os_brick/initiator/connectors/rbd.py +++ b/os_brick/initiator/connectors/rbd.py @@ -21,8 +21,8 @@ from oslo_log import log as logging from oslo_utils import fileutils from oslo_utils import netutils -from os_brick.i18n import _, _LE from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick.initiator import linuxrbd @@ -194,7 +194,7 @@ class RBDConnector(base.BaseLinuxConnector): try: rbd_handle.read(4096) 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}) return False finally: diff --git a/os_brick/initiator/connectors/remotefs.py b/os_brick/initiator/connectors/remotefs.py index 50f11c1..afced8f 100644 --- a/os_brick/initiator/connectors/remotefs.py +++ b/os_brick/initiator/connectors/remotefs.py @@ -14,7 +14,6 @@ from oslo_log import log as logging -from os_brick.i18n import _LW from os_brick import initiator from os_brick.initiator.connectors import base from os_brick.remotefs import remotefs @@ -41,8 +40,8 @@ class RemoteFsConnector(base.BaseLinuxConnector): kwargs.get(mount_type_lower + '_mount_point_base') or mount_point_base) else: - LOG.warning(_LW("Connection details not present." - " RemoteFsClient may not initialize properly.")) + LOG.warning("Connection details not present." + " RemoteFsClient may not initialize properly.") if mount_type_lower == 'scality': cls = remotefs.ScalityRemoteFsClient diff --git a/os_brick/initiator/connectors/scaleio.py b/os_brick/initiator/connectors/scaleio.py index 09ae68b..ab97b42 100644 --- a/os_brick/initiator/connectors/scaleio.py +++ b/os_brick/initiator/connectors/scaleio.py @@ -21,8 +21,8 @@ from oslo_concurrency import lockutils from oslo_concurrency import processutils as putils from oslo_log import log as logging -from os_brick.i18n import _, _LI, _LW from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick import utils @@ -80,8 +80,8 @@ class ScaleIOConnector(base.BaseLinuxConnector): return volume_paths def _find_volume_path(self): - LOG.info(_LI( - "Looking for volume %(volume_id)s, maximum tries: %(tries)s"), + LOG.info( + "Looking for volume %(volume_id)s, maximum tries: %(tries)s", {'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) full_disk_name = ("%(path)s/%(filename)s" % {'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}) return full_disk_name @@ -113,8 +113,8 @@ class ScaleIOConnector(base.BaseLinuxConnector): disk_filename = None filenames = os.listdir(path) - LOG.info(_LI( - "Files found in %(path)s path: %(files)s "), + LOG.info( + "Files found in %(path)s path: %(files)s ", {'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}) r = requests.get( @@ -166,7 +166,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): LOG.error(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}) return sdc_id @@ -189,7 +189,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): ) LOG.info( - _LI("ScaleIO get volume id by name request: %(request)s"), + "ScaleIO get volume id by name request: %(request)s", {'request': request} ) @@ -217,15 +217,15 @@ class ScaleIOConnector(base.BaseLinuxConnector): LOG.error(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}) return volume_id def _check_response(self, response, request, is_get_request=True, params=None): if response.status_code == 401 or response.status_code == 403: - LOG.info(_LI("Token is invalid, " - "going to re-login to get a new one")) + LOG.info("Token is invalid, " + "going to re-login to get a new one") login_request = ( "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}) try: (out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True, root_helper=self._root_helper) - LOG.info(_LI("Map volume %(cmd)s: stdout=%(out)s " - "stderr=%(err)s"), + LOG.info("Map volume %(cmd)s: stdout=%(out)s " + "stderr=%(err)s", {'cmd': self.GET_GUID_CMD, 'out': out, 'err': err}) except putils.ProcessExecutionError as e: @@ -323,7 +323,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): raise exception.BrickException(message=msg) 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'} self.volume_id = self.volume_id or self._get_volume_id() @@ -335,7 +335,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): '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( request, data=json.dumps(params), @@ -349,9 +349,9 @@ class ScaleIOConnector(base.BaseLinuxConnector): response = r.json() error_code = response['errorCode'] if error_code == self.VOLUME_ALREADY_MAPPED_ERROR: - LOG.warning(_LW( + LOG.warning( "Ignoring error mapping volume %(volume_name)s: " - "volume already mapped."), + "volume already mapped.", {'volume_name': self.volume_name} ) else: @@ -382,7 +382,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): 'volume_id': self.volume_id} ) - LOG.info(_LI("Set client limit request: %(request)s"), + LOG.info("Set client limit request: %(request)s", {'request': request}) r = requests.post( @@ -395,7 +395,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): r = self._check_response(r, request, False, params) if r.status_code != self.OK_STATUS_CODE: response = r.json() - LOG.info(_LI("Set client limit response: %(response)s"), + LOG.info("Set client limit response: %(response)s", {'response': response}) msg = ( _("Error setting client limits for volume " @@ -421,9 +421,9 @@ class ScaleIOConnector(base.BaseLinuxConnector): """ self.get_config(connection_properties) self.volume_id = self.volume_id or self._get_volume_id() - LOG.info(_LI( + LOG.info( "ScaleIO disconnect volume in ScaleIO brick volume driver." - )) + ) LOG.debug( _("ScaleIO Volume name: %(volume_name)s, SDC IP: %(sdc_ip)s, " @@ -432,14 +432,14 @@ class ScaleIOConnector(base.BaseLinuxConnector): '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}) try: (out, err) = self._execute(*self.GET_GUID_CMD, run_as_root=True, root_helper=self._root_helper) 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} ) @@ -449,7 +449,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): raise exception.BrickException(message=msg) guid = out - LOG.info(_LI("Current sdc guid: %(guid)s"), {'guid': guid}) + LOG.info("Current sdc guid: %(guid)s", {'guid': guid}) params = {'guid': guid} headers = {'content-type': 'application/json'} @@ -460,7 +460,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): 'volume_id': self.volume_id} ) - LOG.info(_LI("Unmap volume request: %(request)s"), + LOG.info("Unmap volume request: %(request)s", {'request': request}) r = requests.post( request, @@ -475,9 +475,9 @@ class ScaleIOConnector(base.BaseLinuxConnector): response = r.json() error_code = response['errorCode'] if error_code == self.VOLUME_NOT_MAPPED_ERROR: - LOG.warning(_LW( + LOG.warning( "Ignoring error unmapping volume %(volume_id)s: " - "volume not mapped."), {'volume_id': self.volume_name} + "volume not mapped.", {'volume_id': self.volume_name} ) else: msg = (_("Error unmapping volume %(volume_id)s: %(err)s") % diff --git a/os_brick/initiator/connectors/sheepdog.py b/os_brick/initiator/connectors/sheepdog.py index d5ee3aa..090feb6 100644 --- a/os_brick/initiator/connectors/sheepdog.py +++ b/os_brick/initiator/connectors/sheepdog.py @@ -14,8 +14,8 @@ from oslo_log import log as logging -from os_brick.i18n import _, _LE from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator from os_brick.initiator.connectors import base from os_brick.initiator import linuxsheepdog @@ -112,8 +112,8 @@ class SheepdogConnector(base.BaseLinuxConnector): try: sheepdog_handle.read(4096) except Exception as e: - LOG.error(_LE("Failed to access sheepdog device " - "handle: %(error)s"), + LOG.error("Failed to access sheepdog device " + "handle: %(error)s", {"error": e}) return False finally: diff --git a/os_brick/initiator/linuxfc.py b/os_brick/initiator/linuxfc.py index e7d270c..ab72544 100644 --- a/os_brick/initiator/linuxfc.py +++ b/os_brick/initiator/linuxfc.py @@ -20,7 +20,6 @@ import os from oslo_concurrency import processutils as putils from oslo_log import log as logging -from os_brick.i18n import _LE, _LW from os_brick.initiator import linuxscsi LOG = logging.getLogger(__name__) @@ -57,8 +56,8 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI): return [line.split('/')[4].split(':')[1:] for line in out.split('\n') if line.startswith(path)] except Exception as exc: - LOG.error(_LE('Could not get HBA channel and SCSI target ID, ' - 'path: %(path)s, reason: %(reason)s'), + LOG.error('Could not get HBA channel and SCSI target ID, ' + 'path: %(path)s, reason: %(reason)s', {'path': path, 'reason': exc}) return None @@ -101,13 +100,13 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI): # and systool is not installed # 96 = nova.cmd.rootwrap.RC_NOEXECFOUND: if exc.exit_code == 96: - LOG.warning(_LW("systool is not installed")) + LOG.warning("systool is not installed") return [] except OSError as exc: # This handles the case where rootwrap is NOT used # and systool is not installed if exc.errno == errno.ENOENT: - LOG.warning(_LW("systool is not installed")) + LOG.warning("systool is not installed") return [] # No FC HBAs were found @@ -230,8 +229,8 @@ class LinuxFibreChannelS390X(LinuxFibreChannel): try: self.echo_scsi_command(zfcp_device_command, "1") except putils.ProcessExecutionError as exc: - LOG.warning(_LW("port_rescan call for s390 failed exit" - " %(code)s, stderr %(stderr)s"), + LOG.warning("port_rescan call for s390 failed exit" + " %(code)s, stderr %(stderr)s", {'code': exc.exit_code, 'stderr': exc.stderr}) zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" % @@ -240,8 +239,8 @@ class LinuxFibreChannelS390X(LinuxFibreChannel): try: self.echo_scsi_command(zfcp_device_command, lun) except putils.ProcessExecutionError as exc: - LOG.warning(_LW("unit_add call for s390 failed exit %(code)s, " - "stderr %(stderr)s"), + LOG.warning("unit_add call for s390 failed exit %(code)s, " + "stderr %(stderr)s", {'code': exc.exit_code, 'stderr': exc.stderr}) def deconfigure_scsi_device(self, device_number, target_wwn, lun): @@ -263,6 +262,6 @@ class LinuxFibreChannelS390X(LinuxFibreChannel): try: self.echo_scsi_command(zfcp_device_command, lun) except putils.ProcessExecutionError as exc: - LOG.warning(_LW("unit_remove call for s390 failed exit %(code)s, " - "stderr %(stderr)s"), + LOG.warning("unit_remove call for s390 failed exit %(code)s, " + "stderr %(stderr)s", {'code': exc.exit_code, 'stderr': exc.stderr}) diff --git a/os_brick/initiator/linuxrbd.py b/os_brick/initiator/linuxrbd.py index 69ebe31..cbc0e17 100644 --- a/os_brick/initiator/linuxrbd.py +++ b/os_brick/initiator/linuxrbd.py @@ -16,7 +16,7 @@ import io from oslo_log import log as logging from os_brick import exception -from os_brick.i18n import _, _LE, _LW +from os_brick.i18n import _ from os_brick import utils try: @@ -106,7 +106,7 @@ class RBDVolume(object): snapshot=snapshot, read_only=read_only) except client.rbd.Error: - LOG.exception(_LE("error opening rbd image %s"), name) + LOG.exception("error opening rbd image %s", name) client.disconnect() raise @@ -217,7 +217,7 @@ class RBDVolumeIOWrapper(io.RawIOBase): try: self._rbd_volume.image.flush() 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): """RBD does not have support for fileno() so we raise IOError. diff --git a/os_brick/initiator/linuxscsi.py b/os_brick/initiator/linuxscsi.py index bb84016..e5898aa 100644 --- a/os_brick/initiator/linuxscsi.py +++ b/os_brick/initiator/linuxscsi.py @@ -25,7 +25,6 @@ from oslo_log import log as logging from os_brick import exception 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 import utils @@ -118,7 +117,7 @@ class LinuxSCSI(executor.Executor): execute('multipathd', 'show', 'status', run_as_root=True, root_helper=root_helper) 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}) if enforce_multipath: raise @@ -147,8 +146,8 @@ class LinuxSCSI(executor.Executor): self._execute('blockdev', '--flushbufs', device, run_as_root=True, root_helper=self._root_helper) except putils.ProcessExecutionError as exc: - LOG.warning(_LW("Failed to flush IO buffers prior to removing " - "device: %(code)s"), {'code': exc.exit_code}) + LOG.warning("Failed to flush IO buffers prior to removing " + "device: %(code)s", {'code': exc.exit_code}) @utils.retry(exceptions=putils.ProcessExecutionError) 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: LOG.debug('Multipath is in use, cannot be flushed yet.') raise - LOG.warning(_LW("multipath call failed exit %(code)s"), + LOG.warning("multipath call failed exit %(code)s", {'code': exc.exit_code}) def flush_multipath_devices(self): @@ -168,7 +167,7 @@ class LinuxSCSI(executor.Executor): self._execute('multipath', '-F', run_as_root=True, root_helper=self._root_helper) 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}) @utils.retry(exceptions=exception.VolumeDeviceNotFound) @@ -236,7 +235,7 @@ class LinuxSCSI(executor.Executor): /dev/mapper/ """ - 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}) # First look for the common path wwn_dict = {'wwn': wwn} @@ -257,8 +256,8 @@ class LinuxSCSI(executor.Executor): pass # couldn't find a path - LOG.warning(_LW("couldn't find a valid multipath device path for " - "%(wwn)s"), wwn_dict) + LOG.warning("couldn't find a valid multipath device path for " + "%(wwn)s", wwn_dict) return None def find_multipath_device(self, device): @@ -279,7 +278,7 @@ class LinuxSCSI(executor.Executor): run_as_root=True, root_helper=self._root_helper) 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}) raise exception.CommandExecutionFailed( cmd='multipath -l %s' % device) @@ -302,7 +301,7 @@ class LinuxSCSI(executor.Executor): try: os.stat(mdev) except OSError: - LOG.warning(_LW("Couldn't find multipath device %s"), + LOG.warning("Couldn't find multipath device %s", mdev) return None @@ -409,18 +408,17 @@ class LinuxSCSI(executor.Executor): self.multipath_reconfigure() 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}) result = self.multipath_resize_map(scsi_wwn) if 'fail' in result: - msg = (_LI("Multipathd failed to update the size mapping of " - "multipath device %(scsi_wwn)s volume %(volume)s") % - {'scsi_wwn': scsi_wwn, 'volume': volume_paths}) - LOG.error(msg) + LOG.error("Multipathd failed to update the size mapping of " + "multipath device %(scsi_wwn)s volume %(volume)s", + {'scsi_wwn': scsi_wwn, 'volume': volume_paths}) return None 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}) return new_size diff --git a/os_brick/initiator/windows/base.py b/os_brick/initiator/windows/base.py index 34cfcfd..5b65525 100644 --- a/os_brick/initiator/windows/base.py +++ b/os_brick/initiator/windows/base.py @@ -17,8 +17,8 @@ from os_win import utilsfactory from oslo_log import log as logging from os_brick import exception +from os_brick.i18n import _ from os_brick import initiator -from os_brick.i18n import _, _LE from os_brick.initiator import initiator_connector from os_brick import utils @@ -45,10 +45,10 @@ class BaseWindowsConnector(initiator_connector.InitiatorConnector): mpio_enabled = hostutils.check_server_feature( hostutils.FEATURE_MPIO) if not mpio_enabled: - err_msg = _LE( - "Using multipath connections for iSCSI and FC disks " - "requires the Multipath IO Windows feature to be " - "enabled. MPIO must be configured to claim such devices.") + err_msg = _("Using multipath connections for iSCSI and FC disks " + "requires the Multipath IO Windows feature to be " + "enabled. MPIO must be configured to claim such " + "devices.") LOG.error(err_msg) if enforce_multipath: raise exception.BrickException(err_msg) @@ -82,8 +82,8 @@ class BaseWindowsConnector(initiator_connector.InitiatorConnector): dev.read(1) except IOError: LOG.exception( - _LE("Failed to access the device on the path " - "%(path)s"), {"path": path}) + "Failed to access the device on the path " + "%(path)s", {"path": path}) return False return True diff --git a/os_brick/initiator/windows/iscsi.py b/os_brick/initiator/windows/iscsi.py index 83b3291..14e8099 100644 --- a/os_brick/initiator/windows/iscsi.py +++ b/os_brick/initiator/windows/iscsi.py @@ -18,7 +18,7 @@ from os_win import utilsfactory from oslo_log import log as logging 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.windows import base as win_conn_base from os_brick import utils @@ -43,17 +43,16 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector, """ valid_initiator_list = True if not self.initiator_list: - LOG.info(_LI("No iSCSI initiator was explicitly requested. " - "The Microsoft iSCSI initiator will choose the " - "initiator when establishing sessions.")) + LOG.info("No iSCSI initiator was explicitly requested. " + "The Microsoft iSCSI initiator will choose the " + "initiator when establishing sessions.") else: available_initiators = self._iscsi_utils.get_iscsi_initiators() for initiator in self.initiator_list: if initiator not in available_initiators: - msg = _LW("The requested initiator %(req_initiator)s " - "is not in the list of available initiators: " - "%(avail_initiators)s.") - LOG.warning(msg, + LOG.warning("The requested initiator %(req_initiator)s " + "is not in the list of available initiators: " + "%(avail_initiators)s.", dict(req_initiator=initiator, avail_initiators=available_initiators)) valid_initiator_list = False @@ -85,14 +84,14 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector, target_iqn, target_lun) in self._get_all_paths(connection_properties): try: - msg = _LI("Attempting to establish an iSCSI session to " - "target %(target_iqn)s on portal %(target_portal)s " - "accessing LUN %(target_lun)s using initiator " - "%(initiator_name)s.") - LOG.info(msg, dict(target_portal=target_portal, - target_iqn=target_iqn, - target_lun=target_lun, - initiator_name=initiator_name)) + LOG.info("Attempting to establish an iSCSI session to " + "target %(target_iqn)s on portal %(target_portal)s " + "accessing LUN %(target_lun)s using initiator " + "%(initiator_name)s.", + dict(target_portal=target_portal, + target_iqn=target_iqn, + target_lun=target_lun, + initiator_name=initiator_name)) self._iscsi_utils.login_storage_target( target_lun=target_lun, target_iqn=target_iqn, @@ -118,7 +117,7 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector, if not self.use_multipath: break 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: raise exception.BrickException( diff --git a/os_brick/local_dev/lvm.py b/os_brick/local_dev/lvm.py index 8dbf65e..9cf81e1 100644 --- a/os_brick/local_dev/lvm.py +++ b/os_brick/local_dev/lvm.py @@ -23,7 +23,6 @@ import re from os_brick import exception from os_brick import executor -from os_brick.i18n import _LE, _LI from os_brick.privileged import rootwrap as priv_rootwrap from os_brick import utils from oslo_concurrency import processutils as putils @@ -88,14 +87,14 @@ class LVM(executor.Executor): try: self._create_vg(physical_volumes) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error creating Volume Group')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error creating Volume Group') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise exception.VolumeGroupCreationFailed(vg_name=self.vg_name) 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) # 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 = round(free_space, 2) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error querying thin pool about data_percent')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error querying thin pool about data_percent') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) return free_space @@ -298,8 +297,8 @@ class LVM(executor.Executor): with excutils.save_and_reraise_exception(reraise=True) as ctx: if "not found" in err.stderr or "Failed to find" in err.stderr: ctx.reraise = False - LOG.info(_LI("Logical Volume not found when querying " - "LVM info. (vg_name=%(vg)s, lv_name=%(lv)s"), + LOG.info("Logical Volume not found when querying " + "LVM info. (vg_name=%(vg)s, lv_name=%(lv)s", {'vg': vg_name, 'lv': lv_name}) out = None @@ -421,7 +420,7 @@ class LVM(executor.Executor): vg_list = self.get_all_volume_groups(self._root_helper, self.vg_name) 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) 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): - LOG.error(_LE('Requested to setup thin provisioning, ' - 'however current LVM version does not ' - 'support it.')) + LOG.error('Requested to setup thin provisioning, ' + 'however current LVM version does not ' + 'support it.') return None if name is None: @@ -572,10 +571,10 @@ class LVM(executor.Executor): root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error creating Volume')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error creating Volume') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise @utils.retry(putils.ProcessExecutionError) @@ -589,7 +588,7 @@ class LVM(executor.Executor): """ source_lvref = self.get_volume(source_lv_name) 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) raise exception.VolumeDeviceNotFound(device=source_lv_name) cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '--name', name, '--snapshot', @@ -603,10 +602,10 @@ class LVM(executor.Executor): root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error creating snapshot')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error creating snapshot') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise def _mangle_lv_name(self, name): @@ -639,10 +638,10 @@ class LVM(executor.Executor): root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error deactivating LV')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error deactivating LV') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise # Wait until lv is deactivated to return in @@ -696,10 +695,10 @@ class LVM(executor.Executor): root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error activating LV')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error activating LV') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise @utils.retry(putils.ProcessExecutionError) @@ -785,10 +784,10 @@ class LVM(executor.Executor): self._execute(*cmd, root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error extending Volume')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error extending Volume') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise def vg_mirror_free_space(self, mirror_count): @@ -823,8 +822,8 @@ class LVM(executor.Executor): root_helper=self._root_helper, run_as_root=True) except putils.ProcessExecutionError as err: - LOG.exception(_LE('Error renaming logical volume')) - LOG.error(_LE('Cmd :%s'), err.cmd) - LOG.error(_LE('StdOut :%s'), err.stdout) - LOG.error(_LE('StdErr :%s'), err.stderr) + LOG.exception('Error renaming logical volume') + LOG.error('Cmd :%s', err.cmd) + LOG.error('StdOut :%s', err.stdout) + LOG.error('StdErr :%s', err.stderr) raise diff --git a/os_brick/remotefs/remotefs.py b/os_brick/remotefs/remotefs.py index 4b32010..529f02b 100644 --- a/os_brick/remotefs/remotefs.py +++ b/os_brick/remotefs/remotefs.py @@ -25,7 +25,7 @@ import six from os_brick import exception from os_brick import executor -from os_brick.i18n import _, _LI +from os_brick.i18n import _ LOG = logging.getLogger(__name__) @@ -99,7 +99,7 @@ class RemoteFsClient(executor.Executor): mount_path = self.get_mount_point(share) if mount_path in self._read_mounts(): - LOG.info(_LI('Already mounted: %s'), mount_path) + LOG.info('Already mounted: %s', mount_path) return self._execute('mkdir', '-p', mount_path, check_exit_code=0) @@ -256,7 +256,7 @@ class ScalityRemoteFsClient(RemoteFsClient): same method signature for class inheritance purpose. """ 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 self._execute('mkdir', '-p', self._mount_base, check_exit_code=0) super(ScalityRemoteFsClient, self)._do_mount( diff --git a/os_brick/remotefs/windows_remotefs.py b/os_brick/remotefs/windows_remotefs.py index 4853daf..598efd8 100644 --- a/os_brick/remotefs/windows_remotefs.py +++ b/os_brick/remotefs/windows_remotefs.py @@ -23,7 +23,7 @@ from oslo_log import log as logging from os_win import utilsfactory from os_brick import exception -from os_brick.i18n import _, _LI +from os_brick.i18n import _ from os_brick.remotefs import remotefs LOG = logging.getLogger(__name__) @@ -77,7 +77,7 @@ class WindowsRemoteFsClient(remotefs.RemoteFsClient): self._smbutils.is_local_share(share_norm_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)) else: mount_options = " ".join(