Logging not using oslo.i18n guidelines (brick)

Multi-patch set for easier chunks. This one addresses
the backup and common cinder directories.

Updates have already been made to the os-brick project.

There have been quite a few instances found where the
i18n guidelines are not being followed. I believe this
has helped lead to some of the confusion around how to
correctly do this. Other developers see this code and
assume it is an example of the correct usage.

This patch attempts to clean up most of those violations
in the existing codebase to hopefully help avoid some of
that confusion in reviews.

Some issues address:
* Correct log translation markers for different log levels
* Passing format values as arguments to call, not preformatting
* Not forcing translation via six.text_type and others

Guidelines can be found here:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Hacking checks will not be able to identify all violations of
the guidelines, but it could be useful for catching obvious ones
such as LOG.info("No markers!").

Change-Id: I993a0a567383dfe6fca13dfcc76758ea3a46e1dd
Partial-bug: 1433216
This commit is contained in:
Sean McGinnis 2015-04-09 10:32:03 -05:00
parent c7ca4b95b5
commit 976cfe77d1
7 changed files with 128 additions and 131 deletions

View File

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

View File

@ -115,7 +115,8 @@ class InitiatorConnector(executor.Executor):
arch=platform.machine(),
*args, **kwargs):
"""Build a Connector object based upon protocol and architecture."""
LOG.debug("Factory for %s on %s" % (protocol, arch))
LOG.debug("Factory for %(proto)s on %(arch)s",
{'proto': protocol, 'arch': arch})
protocol = protocol.upper()
if protocol == "ISCSI":
return ISCSIConnector(root_helper=root_helper,
@ -189,7 +190,7 @@ class InitiatorConnector(executor.Executor):
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 %(info)s.") %
"%(path)s: %(error)s %(info)s."),
{"path": path, "error": e.stderr,
"info": info})
return False
@ -305,7 +306,7 @@ class ISCSIConnector(InitiatorConnector):
target_props = props
break
else:
LOG.warn(_LW(
LOG.warning(_LW(
'Failed to login to any of the iSCSI targets.'))
host_devices = self._get_device_path(target_props)
@ -318,10 +319,10 @@ class ISCSIConnector(InitiatorConnector):
if tries >= self.device_scan_attempts:
raise exception.VolumeDeviceNotFound(device=host_devices)
LOG.warn(_LW("ISCSI volume not yet found at: %(host_devices)s. "
"Will rescan & retry. Try number: %(tries)s"),
{'host_devices': host_devices,
'tries': tries})
LOG.warning(_LW("ISCSI volume not yet found at: %(host_devices)s. "
"Will rescan & retry. Try number: %(tries)s"),
{'host_devices': host_devices,
'tries': tries})
# The rescan isn't documented as being necessary(?), but it helps
if self.use_multipath:
@ -437,9 +438,8 @@ class ISCSIConnector(InitiatorConnector):
if l.startswith('InitiatorName='):
return l[l.index('=') + 1:].strip()
except putils.ProcessExecutionError:
msg = (_("Could not find the iSCSI Initiator File %s")
% file_path)
LOG.warn(msg)
LOG.warning(_LW("Could not find the iSCSI Initiator File %s"),
file_path)
return None
def _run_iscsiadm(self, connection_properties, iscsi_command, **kwargs):
@ -451,8 +451,8 @@ class ISCSIConnector(InitiatorConnector):
*iscsi_command, run_as_root=True,
root_helper=self._root_helper,
check_exit_code=check_exit_code)
LOG.debug("iscsiadm %s: stdout=%s stderr=%s" %
(iscsi_command, out, err))
LOG.debug("iscsiadm %(cmd)s: stdout=%(out)s stderr=%(err)s",
{'cmd': iscsi_command, 'out': out, 'err': err})
return (out, err)
def _iscsiadm_update(self, connection_properties, property_key,
@ -469,7 +469,7 @@ class ISCSIConnector(InitiatorConnector):
def _disconnect_volume_multipath_iscsi(self, connection_properties,
multipath_name):
"""This removes a multipath device and it's LUNs."""
LOG.debug("Disconnect multipath device %s" % multipath_name)
LOG.debug("Disconnect multipath device %s", multipath_name)
block_devices = self.driver.get_all_block_devices()
devices = []
for dev in block_devices:
@ -566,11 +566,12 @@ class ISCSIConnector(InitiatorConnector):
# exit_code=15 means the session already exists, so it should
# be regarded as successful login.
if err.exit_code not in [15]:
LOG.warn(_LW('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'],
'err': err.exit_code})
LOG.warning(
_LW('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'],
'err': err.exit_code})
return False
self._iscsiadm_update(connection_properties,
@ -630,8 +631,8 @@ class ISCSIConnector(InitiatorConnector):
run_as_root=True,
root_helper=self._root_helper,
check_exit_code=check_exit_code)
LOG.debug("iscsiadm %s: stdout=%s stderr=%s" %
(iscsi_command, out, err))
LOG.debug("iscsiadm %(cmd)s: stdout=%(out)s stderr=%(err)s",
{'cmd': iscsi_command, 'out': out, 'err': err})
return (out, err)
def _run_multipath(self, multipath_command, **kwargs):
@ -641,8 +642,8 @@ class ISCSIConnector(InitiatorConnector):
run_as_root=True,
root_helper=self._root_helper,
check_exit_code=check_exit_code)
LOG.debug("multipath %s: stdout=%s stderr=%s" %
(multipath_command, out, err))
LOG.debug("multipath %(cmd)s: stdout=%(out)s stderr=%(err)s",
{'cmd': multipath_command, 'out': out, 'err': err})
return (out, err)
def _rescan_iscsi(self):
@ -694,7 +695,7 @@ class FibreChannelConnector(InitiatorConnector):
target_iqn - iSCSI Qualified Name
target_lun - LUN id of the volume
"""
LOG.debug("execute = %s" % self._execute)
LOG.debug("execute = %s", self._execute)
device_info = {'type': 'block'}
hbas = self._linuxfc.get_fc_hbas_info()
@ -706,8 +707,8 @@ class FibreChannelConnector(InitiatorConnector):
if len(host_devices) == 0:
# this is empty because we don't have any FC HBAs
msg = _("We are unable to locate any Fibre Channel devices")
LOG.warn(msg)
LOG.warning(_LW("We are unable to locate any Fibre Channel "
"devices"))
raise exception.NoFibreChannelHostsFound()
# The /dev/disk/by-path/... node is not always present immediately
@ -726,13 +727,12 @@ class FibreChannelConnector(InitiatorConnector):
raise loopingcall.LoopingCallDone()
if self.tries >= self.device_scan_attempts:
msg = _("Fibre Channel volume device not found.")
LOG.error(msg)
LOG.error(_LE("Fibre Channel volume device not found."))
raise exception.NoFibreChannelVolumeDeviceFound()
LOG.warn(_LW("Fibre volume not yet found. "
"Will rescan & retry. Try number: %(tries)s"),
{'tries': tries})
LOG.warning(_LW("Fibre volume not yet found. "
"Will rescan & retry. Try number: %(tries)s"),
{'tries': tries})
self._linuxfc.rescan_hosts(hbas)
self.tries = self.tries + 1
@ -755,8 +755,8 @@ class FibreChannelConnector(InitiatorConnector):
if self.use_multipath:
mdev_info = self._linuxscsi.find_multipath_device(self.device_name)
if mdev_info is not None:
LOG.debug("Multipath device discovered %(device)s"
% {'device': mdev_info['device']})
LOG.debug("Multipath device discovered %(device)s",
{'device': mdev_info['device']})
device_path = mdev_info['device']
devices = mdev_info['devices']
device_info['multipath_id'] = mdev_info['id']
@ -836,7 +836,7 @@ class FibreChannelConnector(InitiatorConnector):
multipath_id = device_info['multipath_id']
mdev_info = self._linuxscsi.find_multipath_device(multipath_id)
devices = mdev_info['devices']
LOG.debug("devices to remove = %s" % devices)
LOG.debug("devices to remove = %s", devices)
self._linuxscsi.flush_multipath_device(multipath_id)
self._remove_devices(connection_properties, devices)
@ -984,10 +984,10 @@ class AoEConnector(InitiatorConnector):
if waiting_status['tries'] >= self.device_scan_attempts:
raise exception.VolumeDeviceNotFound(device=aoe_path)
LOG.warn(_LW("AoE volume not yet found at: %(path)s. "
"Try number: %(tries)s"),
{'path': aoe_device,
'tries': waiting_status['tries']})
LOG.warning(_LW("AoE volume not yet found at: %(path)s. "
"Try number: %(tries)s"),
{'path': aoe_device,
'tries': waiting_status['tries']})
self._aoe_discover()
waiting_status['tries'] += 1
@ -1023,7 +1023,7 @@ class AoEConnector(InitiatorConnector):
root_helper=self._root_helper,
check_exit_code=0)
LOG.debug('aoe-discover: stdout=%(out)s stderr%(err)s' %
LOG.debug('aoe-discover: stdout=%(out)s stderr%(err)s',
{'out': out, 'err': err})
def _aoe_revalidate(self, aoe_device):
@ -1033,7 +1033,7 @@ class AoEConnector(InitiatorConnector):
root_helper=self._root_helper,
check_exit_code=0)
LOG.debug('aoe-revalidate %(dev)s: stdout=%(out)s stderr%(err)s' %
LOG.debug('aoe-revalidate %(dev)s: stdout=%(out)s stderr%(err)s',
{'dev': aoe_device, 'out': out, 'err': err})
def _aoe_flush(self, aoe_device):
@ -1042,7 +1042,7 @@ class AoEConnector(InitiatorConnector):
run_as_root=True,
root_helper=self._root_helper,
check_exit_code=0)
LOG.debug('aoe-flush %(dev)s: stdout=%(out)s stderr%(err)s' %
LOG.debug('aoe-flush %(dev)s: stdout=%(out)s stderr%(err)s',
{'dev': aoe_device, 'out': out, 'err': err})
@ -1066,8 +1066,8 @@ class RemoteFsConnector(InitiatorConnector):
kwargs.get('glusterfs_mount_point_base') or\
mount_point_base
else:
LOG.warn(_LW("Connection details not present."
" RemoteFsClient may not initialize properly."))
LOG.warning(_LW("Connection details not present."
" RemoteFsClient may not initialize properly."))
self._remotefsclient = remotefs.RemoteFsClient(mount_type, root_helper,
execute=execute,
*args, **kwargs)
@ -1150,8 +1150,8 @@ class HuaweiStorHyperConnector(InitiatorConnector):
self.cli_path = os.getenv('HUAWEISDSHYPERVISORCLI_PATH')
if not self.cli_path:
self.cli_path = '/usr/local/bin/sds/sds_cli'
LOG.debug("CLI path is not configured, using default %s."
% self.cli_path)
LOG.debug("CLI path is not configured, using default %s.",
self.cli_path)
if not os.path.isfile(self.cli_path):
self.iscliexist = False
LOG.error(_LE('SDS CLI file not found, '
@ -1164,8 +1164,8 @@ class HuaweiStorHyperConnector(InitiatorConnector):
@synchronized('connect_volume')
def connect_volume(self, connection_properties):
"""Connect to a volume."""
LOG.debug("Connect_volume connection properties: %s."
% connection_properties)
LOG.debug("Connect_volume connection properties: %s.",
connection_properties)
out = self._attach_volume(connection_properties['volume_id'])
if not out or int(out['ret_code']) not in (self.attached_success_code,
self.has_been_attached_code,
@ -1186,7 +1186,7 @@ class HuaweiStorHyperConnector(InitiatorConnector):
@synchronized('connect_volume')
def disconnect_volume(self, connection_properties, device_info):
"""Disconnect a volume from the local host."""
LOG.debug("Disconnect_volume: %s." % connection_properties)
LOG.debug("Disconnect_volume: %s.", connection_properties)
out = self._detach_volume(connection_properties['volume_id'])
if not out or int(out['ret_code']) not in (self.attached_success_code,
self.vbs_unnormal_code,
@ -1196,9 +1196,9 @@ class HuaweiStorHyperConnector(InitiatorConnector):
raise exception.BrickException(msg=msg)
def is_volume_connected(self, volume_name):
"""Check if volume already connected to host"""
LOG.debug('Check if volume %s already connected to a host.'
% volume_name)
"""Check if volume already connected to host."""
LOG.debug('Check if volume %s already connected to a host.',
volume_name)
out = self._query_attached_volume(volume_name)
if out:
return int(out['ret_code']) == 0
@ -1225,11 +1225,10 @@ class HuaweiStorHyperConnector(InitiatorConnector):
out, clilog = self._execute(*cmd, run_as_root=False,
root_helper=self._root_helper)
analyse_result = self._analyze_output(out)
LOG.debug('%(method)s volume returns %(analyse_result)s.'
% {'method': method, 'analyse_result': analyse_result})
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(_LE("SDS CLI output some log: %s."), clilog)
return analyse_result
def _analyze_output(self, out):
@ -1238,10 +1237,10 @@ class HuaweiStorHyperConnector(InitiatorConnector):
analyse_result = {}
out_temp = out.split('\n')
for line in out_temp:
LOG.debug("Line is %s." % line)
LOG.debug("Line is %s.", line)
if line.find('=') != -1:
key, val = line.split('=', 1)
LOG.debug(key + " = " + val)
LOG.debug("key %(k)s = %(v)s", {'k': key, 'v': val})
if key in ['ret_code', 'ret_desc', 'dev_addr']:
analyse_result[key] = val
return analyse_result

View File

@ -48,13 +48,13 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
# and systool is not installed
# 96 = nova.cmd.rootwrap.RC_NOEXECFOUND:
if exc.exit_code == 96:
LOG.warn(_LW("systool is not installed"))
LOG.warning(_LW("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.warn(_LW("systool is not installed"))
LOG.warning(_LW("systool is not installed"))
return []
# No FC HBAs were found
@ -184,9 +184,9 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
try:
self.echo_scsi_command(zfcp_device_command, lun)
except putils.ProcessExecutionError as exc:
msg = _LW("unit_add call for s390 failed exit (%(code)s), "
"stderr (%(stderr)s)")
LOG.warn(msg, {'code': exc.exit_code, 'stderr': exc.stderr})
LOG.warning(_LW("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):
"""Write the LUN to the port's unit_remove attribute.
@ -207,6 +207,6 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
try:
self.echo_scsi_command(zfcp_device_command, lun)
except putils.ProcessExecutionError as exc:
msg = _LW("unit_remove call for s390 failed exit (%(code)s), "
"stderr (%(stderr)s)")
LOG.warn(msg, {'code': exc.exit_code, 'stderr': exc.stderr})
LOG.warning(_LW("unit_remove call for s390 failed exit (%(code)s)"
", stderr (%(stderr)s)"),
{'code': exc.exit_code, 'stderr': exc.stderr})

View File

@ -24,7 +24,7 @@ from oslo_log import log as logging
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _, _LW, _LE
from cinder.i18n import _LW, _LE
from cinder.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
@ -65,7 +65,8 @@ class LinuxSCSI(executor.Executor):
# flush any outstanding IO first
self.flush_device_io(device)
LOG.debug("Remove SCSI device(%s) with %s" % (device, path))
LOG.debug("Remove SCSI device(%(dev)s) with %(path)s",
{'dev': device, 'path': path})
self.echo_scsi_command(path, "1")
def wait_for_volume_removal(self, volume_path):
@ -76,9 +77,8 @@ class LinuxSCSI(executor.Executor):
volume_path)
if os.path.exists(volume_path):
if self.tries >= self.scan_attempts:
msg = _LE("Exceeded the number of attempts to detect "
"volume removal.")
LOG.error(msg)
LOG.error(_LE("Exceeded the number of attempts to detect "
"volume removal."))
raise exception.VolumePathNotRemoved(
volume_path=volume_path)
@ -122,11 +122,11 @@ class LinuxSCSI(executor.Executor):
and the multipath device itself.
"""
LOG.debug("remove multipath device %s" % multipath_name)
LOG.debug("remove multipath device %s", multipath_name)
mpath_dev = self.find_multipath_device(multipath_name)
if mpath_dev:
devices = mpath_dev['devices']
LOG.debug("multipath LUNs to remove %s" % devices)
LOG.debug("multipath LUNs to remove %s", devices)
for device in devices:
self.remove_scsi_device(device['device'])
self.flush_multipath_device(mpath_dev['id'])
@ -134,30 +134,30 @@ class LinuxSCSI(executor.Executor):
def flush_device_io(self, device):
"""This is used to flush any remaining IO in the buffers."""
try:
LOG.debug("Flushing IO for device %s" % device)
LOG.debug("Flushing IO for device %s", device)
self._execute('blockdev', '--flushbufs', device, run_as_root=True,
root_helper=self._root_helper)
except putils.ProcessExecutionError as exc:
msg = _("Failed to flush IO buffers prior to removing"
" device: (%(code)s)") % {'code': exc.exit_code}
LOG.warn(msg)
LOG.warning(_LW("Failed to flush IO buffers prior to removing"
" device: (%(code)s)"),
{'code': exc.exit_code})
def flush_multipath_device(self, device):
try:
LOG.debug("Flush multipath device %s" % device)
LOG.debug("Flush multipath device %s", device)
self._execute('multipath', '-f', device, run_as_root=True,
root_helper=self._root_helper)
except putils.ProcessExecutionError as exc:
LOG.warn(_LW("multipath call failed exit (%(code)s)")
% {'code': exc.exit_code})
LOG.warning(_LW("multipath call failed exit (%(code)s)"),
{'code': exc.exit_code})
def flush_multipath_devices(self):
try:
self._execute('multipath', '-F', run_as_root=True,
root_helper=self._root_helper)
except putils.ProcessExecutionError as exc:
LOG.warn(_LW("multipath call failed exit (%(code)s)")
% {'code': exc.exit_code})
LOG.warning(_LW("multipath call failed exit (%(code)s)"),
{'code': exc.exit_code})
def find_multipath_device(self, device):
"""Find a multipath device associated with a LUN device name.
@ -173,8 +173,8 @@ class LinuxSCSI(executor.Executor):
run_as_root=True,
root_helper=self._root_helper)
except putils.ProcessExecutionError as exc:
LOG.warn(_LW("multipath call failed exit (%(code)s)")
% {'code': exc.exit_code})
LOG.warning(_LW("multipath call failed exit (%(code)s)"),
{'code': exc.exit_code})
return None
if out:
@ -202,11 +202,11 @@ class LinuxSCSI(executor.Executor):
try:
os.stat(mdev)
except OSError:
LOG.warn(_LW("Couldn't find multipath device %s"), mdev)
LOG.warning(_LW("Couldn't find multipath device %s"), mdev)
return None
LOG.debug("Found multipath device = %(mdev)s"
% {'mdev': mdev})
LOG.debug("Found multipath device = %(mdev)s",
{'mdev': mdev})
device_lines = lines[3:]
for dev_line in device_lines:
if dev_line.find("policy") != -1:

View File

@ -28,7 +28,7 @@ from oslo_utils import excutils
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _, _LE, _LI
from cinder.i18n import _LE, _LI
from cinder import utils
@ -78,13 +78,13 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('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(_LE('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
@ -176,9 +176,9 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
return free_space
@ -279,9 +279,9 @@ class LVM(executor.Executor):
with excutils.save_and_reraise_exception(reraise=True) as ctx:
if "not found" in err.stderr:
ctx.reraise = False
msg = _LI("'Not found' when querying LVM info. "
"(vg_name=%(vg)s, lv_name=%(lv)s")
LOG.info(msg, {'vg': vg_name, 'lv': lv_name})
LOG.info(_LI("'Not found' when querying LVM info. "
"(vg_name=%(vg)s, lv_name=%(lv)s"),
{'vg': vg_name, 'lv': lv_name})
out = None
lv_list = []
@ -401,7 +401,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(_LE('Unable to find VG: %s'), self.vg_name)
raise exception.VolumeGroupNotFound(vg_name=self.vg_name)
self.vg_size = float(vg_list[0]['size'])
@ -502,10 +502,10 @@ class LVM(executor.Executor):
size_str = self._calculate_thin_pool_size()
cmd = ['lvcreate', '-T', '-L', size_str, vg_pool_name]
LOG.debug('Creating thin pool \'%(pool)s\' with size %(size)s of '
'total %(free)sg' % {'pool': vg_pool_name,
'size': size_str,
'free': self.vg_free_space})
LOG.debug("Creating thin pool '%(pool)s' with size %(size)s of "
"total %(free)sg", {'pool': vg_pool_name,
'size': size_str,
'free': self.vg_free_space})
self._execute(*cmd,
root_helper=self._root_helper,
@ -546,9 +546,9 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
raise
@utils.retry(putils.ProcessExecutionError)
@ -562,8 +562,8 @@ 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")
% source_lv_name)
LOG.error(_LE("Trying to create snapshot by non-existent LV: %s"),
source_lv_name)
raise exception.VolumeDeviceNotFound(device=source_lv_name)
cmd = ['lvcreate', '--name', name,
'--snapshot', '%s/%s' % (self.vg_name, source_lv_name)]
@ -577,9 +577,9 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
raise
def _mangle_lv_name(self, name):
@ -620,9 +620,9 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
raise
def delete(self, name):
@ -649,10 +649,9 @@ class LVM(executor.Executor):
'%s/%s' % (self.vg_name, name),
root_helper=self._root_helper, run_as_root=True)
except putils.ProcessExecutionError as err:
mesg = (_('Error reported running lvremove: CMD: %(command)s, '
'RESPONSE: %(response)s') %
{'command': err.cmd, 'response': err.stderr})
LOG.debug(mesg)
LOG.debug('Error reported running lvremove: CMD: %(command)s, '
'RESPONSE: %(response)s',
{'command': err.cmd, 'response': err.stderr})
LOG.debug('Attempting udev settle and retry of lvremove...')
run_udevadm_settle()
@ -704,9 +703,9 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
raise
def vg_mirror_free_space(self, mirror_count):
@ -742,7 +741,7 @@ class LVM(executor.Executor):
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.error(_LE('Cmd :%s'), err.cmd)
LOG.error(_LE('StdOut :%s'), err.stdout)
LOG.error(_LE('StdErr :%s'), err.stderr)
raise

View File

@ -93,7 +93,7 @@ class RemoteFsClient(object):
mount_path = self.get_mount_point(share)
if mount_path in self._read_mounts():
LOG.info(_LI('Already mounted: %s') % mount_path)
LOG.info(_LI('Already mounted: %s'), mount_path)
return
self._execute('mkdir', '-p', mount_path, check_exit_code=0)
@ -127,8 +127,8 @@ class RemoteFsClient(object):
options = self._nfs_mount_type_opts[mnt_type]
try:
self._do_mount('nfs', nfs_share, mount_path, options, flags)
LOG.debug('Mounted %(sh)s using %(mnt_type)s.'
% {'sh': nfs_share, 'mnt_type': mnt_type})
LOG.debug('Mounted %(sh)s using %(mnt_type)s.',
{'sh': nfs_share, 'mnt_type': mnt_type})
return
except Exception as e:
mnt_errors[mnt_type] = six.text_type(e)

View File

@ -131,7 +131,6 @@ def validate_log_translations(logical_line, filename):
# of patches are done to address these issues. It should be
# removed completely when bug 1433216 is closed.
ignore_dirs = [
"cinder/brick",
"cinder/db",
"cinder/openstack",
"cinder/scheduler",