Implementing the use of _L’x’/i18n markers

Placing the _Lx markers back into the code.  No other cleaner solution has
has been implemented. Patches will be submitted in a series of sub
directories and in a fashion that is manageable.
This is the third commit of this kind

Change-Id: I33b0bb05b1c1ea91dc5a1e93eaadceea1f23fcc9
Partial-Bug: #1384312
This commit is contained in:
Mike Mason 2014-11-06 13:37:37 +00:00
parent 8414a9e627
commit abedc10343
26 changed files with 149 additions and 148 deletions

View File

@ -26,7 +26,7 @@ from cinder.api.views import backups as backup_views
from cinder.api import xmlutil
from cinder import backup as backupAPI
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import utils
@ -175,7 +175,7 @@ class BackupsController(wsgi.Controller):
LOG.debug('delete called for member %s', id)
context = req.environ['cinder.context']
LOG.info(_('Delete backup with id: %s'), id, context=context)
LOG.info(_LI('Delete backup with id: %s'), id, context=context)
try:
self.backup_api.delete(context, id)
@ -249,8 +249,8 @@ class BackupsController(wsgi.Controller):
name = backup.get('name', None)
description = backup.get('description', None)
LOG.info(_("Creating backup of volume %(volume_id)s in container"
" %(container)s"),
LOG.info(_LI("Creating backup of volume %(volume_id)s in container"
" %(container)s"),
{'volume_id': volume_id, 'container': container},
context=context)
@ -282,7 +282,7 @@ class BackupsController(wsgi.Controller):
restore = body['restore']
volume_id = restore.get('volume_id', None)
LOG.info(_("Restoring backup %(backup_id)s to volume %(volume_id)s"),
LOG.info(_LI("Restoring backup %(backup_id)s to volume %(volume_id)s"),
{'backup_id': id, 'volume_id': volume_id},
context=context)

View File

@ -26,7 +26,7 @@ from cinder.api.views import cgsnapshots as cgsnapshot_views
from cinder.api import xmlutil
from cinder import consistencygroup as consistencygroupAPI
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import utils
@ -110,7 +110,7 @@ class CgsnapshotsController(wsgi.Controller):
LOG.debug('delete called for member %s', id)
context = req.environ['cinder.context']
LOG.info(_('Delete cgsnapshot with id: %s'), id, context=context)
LOG.info(_LI('Delete cgsnapshot with id: %s'), id, context=context)
try:
cgsnapshot = self.cgsnapshot_api.get_cgsnapshot(
@ -183,7 +183,7 @@ class CgsnapshotsController(wsgi.Controller):
name = cgsnapshot.get('name', None)
description = cgsnapshot.get('description', None)
LOG.info(_("Creating cgsnapshot %(name)s."),
LOG.info(_LI("Creating cgsnapshot %(name)s."),
{'name': name},
context=context)

View File

@ -26,7 +26,7 @@ from cinder.api.views import consistencygroups as consistencygroup_views
from cinder.api import xmlutil
from cinder import consistencygroup as consistencygroupAPI
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import utils
@ -118,7 +118,7 @@ class ConsistencyGroupsController(wsgi.Controller):
cg_body = body['consistencygroup']
force = cg_body.get('force', False)
LOG.info(_('Delete consistency group with id: %s'), id,
LOG.info(_LI('Delete consistency group with id: %s'), id,
context=context)
try:
@ -181,7 +181,7 @@ class ConsistencyGroupsController(wsgi.Controller):
raise exc.HTTPBadRequest(explanation=msg)
availability_zone = consistencygroup.get('availability_zone', None)
LOG.info(_("Creating consistency group %(name)s."),
LOG.info(_LI("Creating consistency group %(name)s."),
{'name': name},
context=context)

View File

@ -25,7 +25,7 @@ from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder import utils
@ -178,7 +178,7 @@ class HostController(wsgi.Controller):
"""Sets the specified host's ability to accept new volumes."""
context = req.environ['cinder.context']
state = "enabled" if enabled else "disabled"
LOG.info(_("Setting host %(host)s to %(state)s."),
LOG.info(_LI("Setting host %(host)s to %(state)s."),
{'host': host, 'state': state})
result = self.api.set_host_enabled(context,
host=host,

View File

@ -23,7 +23,7 @@ from cinder.api.openstack import wsgi
from cinder.api.views import qos_specs as view_qos_specs
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import strutils
from cinder import rpc
@ -76,7 +76,7 @@ class QoSSpecsKeyDeserializer(wsgi.XMLDeserializer):
dom = utils.safe_minidom_parse_string(string)
key_node = self.find_first_child_named(dom, 'keys')
if not key_node:
LOG.info(_("Unable to parse XML input."))
LOG.info(_LI("Unable to parse XML input."))
msg = _("Unable to parse XML request. "
"Please provide XML in correct format.")
raise webob.exc.HTTPBadRequest(explanation=msg)

View File

@ -19,7 +19,7 @@ from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import replication as replicationAPI
from cinder import volume
@ -67,8 +67,8 @@ class VolumeReplicationController(wsgi.Controller):
context = req.environ['cinder.context']
try:
vol = self.volume_api.get(context, id)
LOG.info(_('Attempting to promote secondary replica to primary'
' for volume %s.'),
LOG.info(_LI('Attempting to promote secondary replica to primary'
' for volume %s.'),
str(id),
context=context)
self.replication_api.promote(context, vol)
@ -85,8 +85,8 @@ class VolumeReplicationController(wsgi.Controller):
context = req.environ['cinder.context']
try:
vol = self.volume_api.get(context, id)
LOG.info(_('Attempting to sync secondary replica with primary'
' for volume %s.'),
LOG.info(_LI('Attempting to sync secondary replica with primary'
' for volume %s.'),
str(id),
context=context)
self.replication_api.reenable(context, vol)

View File

@ -22,7 +22,7 @@ from cinder.api.openstack import wsgi
from cinder.api.views import transfers as transfer_view
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import transfer as transferAPI
from cinder import utils
@ -160,7 +160,7 @@ class VolumeTransferController(wsgi.Controller):
name = transfer.get('name', None)
LOG.info(_("Creating transfer of volume %s"),
LOG.info(_LI("Creating transfer of volume %s"),
volume_id,
context=context)
@ -194,7 +194,7 @@ class VolumeTransferController(wsgi.Controller):
msg = _("Incorrect request body format")
raise exc.HTTPBadRequest(explanation=msg)
LOG.info(_("Accepting transfer %s"), transfer_id,
LOG.info(_LI("Accepting transfer %s"), transfer_id,
context=context)
try:
@ -215,7 +215,7 @@ class VolumeTransferController(wsgi.Controller):
"""Delete a transfer."""
context = req.environ['cinder.context']
LOG.info(_("Delete transfer with id: %s"), id, context=context)
LOG.info(_LI("Delete transfer with id: %s"), id, context=context)
try:
self.transfer_api.delete(context, transfer_id=id)

View File

@ -18,7 +18,7 @@ from webob import exc
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder import volume
@ -51,7 +51,7 @@ class VolumeUnmanageController(wsgi.Controller):
context = req.environ['cinder.context']
authorize(context)
LOG.info(_("Unmanage volume with id: %s"), id, context=context)
LOG.info(_LI("Unmanage volume with id: %s"), id, context=context)
try:
vol = self.volume_api.get(context, id)

View File

@ -24,7 +24,7 @@ import cinder.api.openstack
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
import cinder.policy
@ -181,7 +181,7 @@ class ExtensionManager(object):
"""
def __init__(self):
LOG.info(_('Initializing extension manager.'))
LOG.info(_LI('Initializing extension manager.'))
self.cls_list = CONF.osapi_volume_extension
self.extensions = {}
@ -196,7 +196,7 @@ class ExtensionManager(object):
return
alias = ext.alias
LOG.info(_('Loaded extension: %s'), alias)
LOG.info(_LI('Loaded extension: %s'), alias)
if alias in self.extensions:
raise exception.Error("Found duplicate extension: %s" % alias)
@ -241,7 +241,7 @@ class ExtensionManager(object):
LOG.debug('Ext namespace: %s', extension.namespace)
LOG.debug('Ext updated: %s', extension.updated)
except AttributeError as ex:
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
LOG.exception(_LE("Exception loading extension: %s"), unicode(ex))
return False
return True

View File

@ -19,7 +19,7 @@ import webob.exc
from cinder.api.openstack import wsgi
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder import utils
from cinder import wsgi as base_wsgi
@ -43,7 +43,7 @@ class FaultWrapper(base_wsgi.Middleware):
def _error(self, inner, req):
if not isinstance(inner, exception.QuotaError):
LOG.exception(_("Caught error: %s"), unicode(inner))
LOG.exception(_LE("Caught error: %s"), unicode(inner))
safe = getattr(inner, 'safe', False)
headers = getattr(inner, 'headers', None)
status = getattr(inner, 'code', 500)
@ -51,7 +51,7 @@ class FaultWrapper(base_wsgi.Middleware):
status = 500
msg_dict = dict(url=req.url, status=status)
LOG.info(_("%(url)s returned with HTTP %(status)d") % msg_dict)
LOG.info(_LI("%(url)s returned with HTTP %(status)d") % msg_dict)
outer = self.status_to_type(status)
if headers:
outer.headers = headers

View File

@ -21,7 +21,7 @@ WSGI middleware for OpenStack API controllers.
import routes
from cinder.api.openstack import wsgi
from cinder.i18n import _
from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
from cinder import wsgi as base_wsgi
@ -111,8 +111,8 @@ class APIRouter(base_wsgi.Router):
controller = extension.controller
if collection not in self.resources:
LOG.warning(_('Extension %(ext_name)s: Cannot extend '
'resource %(collection)s: No such resource'),
LOG.warning(_LW('Extension %(ext_name)s: Cannot extend '
'resource %(collection)s: No such resource'),
{'ext_name': extension.extension.name,
'collection': collection})
continue

View File

@ -26,7 +26,7 @@ import webob
from cinder import exception
from cinder import i18n
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import jsonutils
from cinder.openstack.common import log as logging
from cinder import utils
@ -755,10 +755,10 @@ class ResourceExceptionHandler(object):
ex_value, exc_info=exc_info)
raise Fault(webob.exc.HTTPBadRequest())
elif isinstance(ex_value, Fault):
LOG.info(_("Fault thrown: %s"), unicode(ex_value))
LOG.info(_LI("Fault thrown: %s"), unicode(ex_value))
raise ex_value
elif isinstance(ex_value, webob.exc.HTTPException):
LOG.info(_("HTTP exception thrown: %s"), unicode(ex_value))
LOG.info(_LI("HTTP exception thrown: %s"), unicode(ex_value))
raise Fault(ex_value)
# We didn't handle the exception

View File

@ -22,7 +22,7 @@ from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import strutils
from cinder import utils
@ -117,7 +117,7 @@ class SnapshotsController(wsgi.Controller):
"""Delete a snapshot."""
context = req.environ['cinder.context']
LOG.info(_("Delete snapshot with id: %s"), id, context=context)
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
try:
snapshot = self.volume_api.get_snapshot(context, id)

View File

@ -24,7 +24,7 @@ from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import uuidutils
from cinder import utils
@ -112,7 +112,7 @@ def _translate_volume_summary_view(context, vol, image_id=None):
if image_id:
d['image_id'] = image_id
LOG.info(_("vol=%s"), vol, context=context)
LOG.info(_LI("vol=%s"), vol, context=context)
if vol.get('volume_metadata'):
metadata = vol.get('volume_metadata')
@ -243,7 +243,7 @@ class VolumeController(wsgi.Controller):
"""Delete a volume."""
context = req.environ['cinder.context']
LOG.info(_("Delete volume with id: %s"), id, context=context)
LOG.info(_LI("Delete volume with id: %s"), id, context=context)
try:
volume = self.volume_api.get(context, id)
@ -368,7 +368,7 @@ class VolumeController(wsgi.Controller):
elif size is None and kwargs['source_volume'] is not None:
size = kwargs['source_volume']['size']
LOG.info(_("Create volume of %s GB"), size, context=context)
LOG.info(_LI("Create volume of %s GB"), size, context=context)
image_href = None
image_uuid = None

View File

@ -22,7 +22,7 @@ from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import strutils
from cinder import utils
@ -118,7 +118,7 @@ class SnapshotsController(wsgi.Controller):
"""Delete a snapshot."""
context = req.environ['cinder.context']
LOG.info(_("Delete snapshot with id: %s"), id, context=context)
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
try:
snapshot = self.volume_api.get_snapshot(context, id)

View File

@ -27,7 +27,7 @@ from cinder.api.v2.views import volumes as volume_views
from cinder.api import xmlutil
from cinder import consistencygroup as consistencygroupAPI
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import uuidutils
from cinder import utils
@ -183,7 +183,7 @@ class VolumeController(wsgi.Controller):
"""Delete a volume."""
context = req.environ['cinder.context']
LOG.info(_("Delete volume with id: %s"), id, context=context)
LOG.info(_LI("Delete volume with id: %s"), id, context=context)
try:
volume = self.volume_api.get(context, id)
@ -367,7 +367,7 @@ class VolumeController(wsgi.Controller):
elif size is None and kwargs['source_replica'] is not None:
size = kwargs['source_replica']['size']
LOG.info(_("Create volume of %s GB"), size, context=context)
LOG.info(_LI("Create volume of %s GB"), size, context=context)
if self.ext_mgr.is_loaded('os-image-create'):
image_href = volume.get('imageRef')

View File

@ -23,7 +23,7 @@ from cinder.brick.initiator import host_driver
from cinder.brick.initiator import linuxfc
from cinder.brick.initiator import linuxscsi
from cinder.brick.remotefs import remotefs
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
@ -137,8 +137,8 @@ class InitiatorConnector(executor.Executor):
out, info = self._execute(*cmd, run_as_root=run_as_root,
root_helper=self._root_helper)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to access the device on the path "
"%(path)s: %(error)s %(info)s.") %
LOG.error(_LE("Failed to access the device on the path "
"%(path)s: %(error)s %(info)s.") %
{"path": path, "error": e.stderr,
"info": info})
return False

View File

@ -28,7 +28,7 @@ import six
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _
from cinder.i18n import _, _LE, _LI, _LW
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
@ -145,7 +145,7 @@ class TgtAdm(TargetAdmin):
return backing_lun
def _recreate_backing_lun(self, iqn, tid, name, path):
LOG.warning(_('Attempting recreate of backing lun...'))
LOG.warning(_LW('Attempting recreate of backing lun...'))
# Since we think the most common case of this is a dev busy
# (create vol from snapshot) we're going to add a sleep here
@ -163,9 +163,9 @@ class TgtAdm(TargetAdmin):
LOG.debug('StdOut from recreate backing lun: %s' % out)
LOG.debug('StdErr from recreate backing lun: %s' % err)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to recover attempt to create "
"iscsi backing lun for volume "
"id:%(vol_id)s: %(e)s")
LOG.error(_LE("Failed to recover attempt to create "
"iscsi backing lun for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': name, 'e': e})
def _get_target_chap_auth(self, name):
@ -204,7 +204,7 @@ class TgtAdm(TargetAdmin):
path, chap_str,
write_cache)
LOG.info(_('Creating iscsi_target for: %s') % vol_id)
LOG.info(_LI('Creating iscsi_target for: %s') % vol_id)
volumes_dir = self.volumes_dir
volume_path = os.path.join(volumes_dir, vol_id)
@ -243,8 +243,8 @@ class TgtAdm(TargetAdmin):
run_as_root=True)
LOG.debug("Targets after update: %s" % out)
except putils.ProcessExecutionError as e:
LOG.warning(_("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
LOG.warning(_LW("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': e})
#Don't forget to remove the persistent file we created
@ -254,11 +254,10 @@ class TgtAdm(TargetAdmin):
iqn = '%s%s' % (self.iscsi_target_prefix, vol_id)
tid = self._get_target(iqn)
if tid is None:
LOG.error(_("Failed to create iscsi target for volume "
"id:%(vol_id)s. Please ensure your tgtd config file "
"contains 'include %(volumes_dir)s/*'") % {
'vol_id': vol_id,
'volumes_dir': volumes_dir, })
LOG.error(_LE("Failed to create iscsi target for volume "
"id:%(vol_id)s. Please ensure your tgtd config file "
"contains 'include %(volumes_dir)s/*'") % {
'vol_id': vol_id, 'volumes_dir': volumes_dir, })
raise exception.NotFound()
# NOTE(jdg): Sometimes we have some issues with the backing lun
@ -284,12 +283,12 @@ class TgtAdm(TargetAdmin):
return tid
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
LOG.info(_('Removing iscsi_target for: %s') % vol_id)
LOG.info(_LI('Removing iscsi_target for: %s') % vol_id)
vol_uuid_file = vol_name
volume_path = os.path.join(self.volumes_dir, vol_uuid_file)
if not os.path.exists(volume_path):
LOG.warning(_('Volume path %s does not exist, '
'nothing to remove.') % volume_path)
LOG.warning(_LW('Volume path %s does not exist, '
'nothing to remove.') % volume_path)
return
if os.path.isfile(volume_path):
@ -307,8 +306,8 @@ class TgtAdm(TargetAdmin):
run_as_root=True,
attempts=CONF.num_shell_tries)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to remove iscsi target for volume "
"id:%(vol_id)s: %(e)s")
LOG.error(_LE("Failed to remove iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': e})
raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
@ -324,15 +323,15 @@ class TgtAdm(TargetAdmin):
# https://bugs.launchpad.net/cinder/+bug/1304122
if self._get_target(iqn):
try:
LOG.warning(_('Silent failure of target removal '
'detected, retry....'))
LOG.warning(_LW('Silent failure of target removal '
'detected, retry....'))
self._execute('tgt-admin',
'--delete',
iqn,
run_as_root=True)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to remove iscsi target for volume "
"id:%(vol_id)s: %(e)s")
LOG.error(_LE("Failed to remove iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': e})
raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
@ -402,14 +401,14 @@ class IetAdm(TargetAdmin):
f.close()
except putils.ProcessExecutionError as e:
vol_id = name.split(':')[1]
LOG.error(_("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
LOG.error(_LE("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': e})
raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
return tid
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
LOG.info(_('Removing iscsi_target for volume: %s') % vol_id)
LOG.info(_LI('Removing iscsi_target for volume: %s') % vol_id)
self._delete_logicalunit(tid, lun, **kwargs)
self._delete_target(tid, **kwargs)
vol_uuid_file = vol_name
@ -503,7 +502,7 @@ class LioAdm(TargetAdmin):
try:
self._execute('cinder-rtstool', 'verify')
except (OSError, putils.ProcessExecutionError):
LOG.error(_('cinder-rtstool is not installed correctly'))
LOG.error(_LE('cinder-rtstool is not installed correctly'))
raise
def _get_target(self, iqn):
@ -523,7 +522,7 @@ class LioAdm(TargetAdmin):
vol_id = name.split(':')[1]
LOG.info(_('Creating iscsi_target for volume: %s') % vol_id)
LOG.info(_LI('Creating iscsi_target for volume: %s') % vol_id)
if chap_auth is not None:
(chap_auth_userid, chap_auth_password) = chap_auth.split(' ')[1:]
@ -543,8 +542,8 @@ class LioAdm(TargetAdmin):
command_args.extend(extra_args)
self._execute(*command_args, run_as_root=True)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to create iscsi target for volume "
"id:%s.") % vol_id)
LOG.error(_LE("Failed to create iscsi target for volume "
"id:%s.") % vol_id)
LOG.error("%s" % e)
raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
@ -552,14 +551,14 @@ class LioAdm(TargetAdmin):
iqn = '%s%s' % (self.iscsi_target_prefix, vol_id)
tid = self._get_target(iqn)
if tid is None:
LOG.error(_("Failed to create iscsi target for volume "
"id:%s.") % vol_id)
LOG.error(_LE("Failed to create iscsi target for volume "
"id:%s.") % vol_id)
raise exception.NotFound()
return tid
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
LOG.info(_('Removing iscsi_target: %s') % vol_id)
LOG.info(_LI('Removing iscsi_target: %s') % vol_id)
vol_uuid_name = vol_name
iqn = '%s%s' % (self.iscsi_target_prefix, vol_uuid_name)
@ -569,8 +568,8 @@ class LioAdm(TargetAdmin):
iqn,
run_as_root=True)
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to remove iscsi target for volume "
"id:%s.") % vol_id)
LOG.error(_LE("Failed to remove iscsi target for volume "
"id:%s.") % vol_id)
LOG.error("%s" % e)
raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
@ -598,7 +597,7 @@ class LioAdm(TargetAdmin):
connector['initiator'],
run_as_root=True)
except putils.ProcessExecutionError:
LOG.error(_("Failed to add initiator iqn %s to target.") %
LOG.error(_LE("Failed to add initiator iqn %s to target.") %
connector['initiator'])
raise exception.ISCSITargetAttachFailed(volume_id=volume['id'])
@ -612,7 +611,7 @@ class LioAdm(TargetAdmin):
connector['initiator'],
run_as_root=True)
except putils.ProcessExecutionError:
LOG.error(_("Failed to delete initiator iqn %s to target.") %
LOG.error(_LE("Failed to delete initiator iqn %s to target.") %
connector['initiator'])
raise exception.ISCSITargetAttachFailed(volume_id=volume['id'])

View File

@ -24,9 +24,8 @@ import time
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _
from cinder.i18n import _, _LE, _LW
from cinder.openstack.common import excutils
from cinder.openstack.common.gettextutils import _LW
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
@ -75,10 +74,10 @@ class LVM(executor.Executor):
try:
self._create_vg(physical_volumes)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error creating Volume Group'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise exception.VolumeGroupCreationFailed(vg_name=self.vg_name)
if self._vg_exists() is False:
@ -157,10 +156,10 @@ class LVM(executor.Executor):
free_space = pool_size - consumed_space
free_space = round(free_space, 2)
except putils.ProcessExecutionError as err:
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)
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)
return free_space
@ -259,7 +258,7 @@ class LVM(executor.Executor):
run_as_root=True)
total_time = time.time() - lvs_start
if total_time > 60:
LOG.warning(_('Took %s seconds to get logical volumes.'),
LOG.warning(_LW('Took %s seconds to get logical volumes.'),
total_time)
lv_list = []
@ -368,7 +367,8 @@ class LVM(executor.Executor):
run_as_root=True)
total_time = time.time() - start_vgs
if total_time > 60:
LOG.warning(_('Took %s seconds to get volume groups.'), total_time)
LOG.warning(_LW('Took %s seconds to get '
'volume groups.'), total_time)
vg_list = []
if out is not None:
@ -504,10 +504,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error creating Volume'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise
def create_lv_snapshot(self, name, source_lv_name, lv_type='default'):
@ -534,10 +534,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error creating snapshot'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise
def _mangle_lv_name(self, name):
@ -577,10 +577,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error activating LV'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise
def delete(self, name):
@ -658,10 +658,10 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error extending Volume'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise
def vg_mirror_free_space(self, mirror_count):
@ -696,8 +696,8 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_('Error renaming logical volume'))
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
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)
raise

View File

@ -22,7 +22,7 @@ import re
import six
from cinder.brick import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
@ -93,7 +93,7 @@ class RemoteFsClient(object):
mount_path = self.get_mount_point(share)
if mount_path in self._read_mounts():
LOG.info(_('Already mounted: %s') % mount_path)
LOG.info(_LI('Already mounted: %s') % mount_path)
return
self._execute('mkdir', '-p', mount_path, check_exit_code=0)

View File

@ -28,7 +28,7 @@ from oslo.config import cfg
import six
import webob.exc
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
@ -90,7 +90,7 @@ class CinderException(Exception):
exc_info = sys.exc_info()
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception(_('Exception in string format operation'))
LOG.exception(_LE('Exception in string format operation'))
for name, value in kwargs.iteritems():
LOG.error("%s: %s" % (name, value))
if CONF.fatal_exception_format_errors:

View File

@ -24,7 +24,7 @@ from oslo.config import cfg
from cinder import context
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
@ -780,7 +780,8 @@ class QuotaEngine(object):
# usage resynchronization and the reservation expiration
# mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal.
LOG.exception(_("Failed to commit reservations %s") % reservations)
LOG.exception(_LE("Failed to commit "
"reservations %s") % reservations)
def rollback(self, context, reservations, project_id=None):
"""Roll back reservations.
@ -800,8 +801,8 @@ class QuotaEngine(object):
# usage resynchronization and the reservation expiration
# mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal.
LOG.exception(_("Failed to roll back reservations "
"%s") % reservations)
LOG.exception(_LE("Failed to roll back reservations "
"%s") % reservations)
def destroy_all_by_project(self, context, project_id):
"""Destroy all quotas, usages, and reservations associated with a

View File

@ -26,7 +26,7 @@ from oslo.config import cfg
import paramiko
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)
@ -79,8 +79,8 @@ class SSHPool(pools.Pool):
if 'hosts_key_file' in kwargs.keys():
self.hosts_key_file = kwargs.pop('hosts_key_file')
LOG.info(_("Secondary ssh hosts key file %(kwargs)s will be "
"loaded along with %(conf)s from /etc/cinder.conf.") %
LOG.info(_LI("Secondary ssh hosts key file %(kwargs)s will be "
"loaded along with %(conf)s from /etc/cinder.conf.") %
{'kwargs': self.hosts_key_file,
'conf': CONF.ssh_hosts_key_file})

View File

@ -22,7 +22,7 @@ import time
from oslo.config import cfg
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder.image import image_utils
from cinder.openstack.common import excutils
from cinder.openstack.common import fileutils
@ -228,8 +228,8 @@ class VolumeDriver(object):
self._is_non_recoverable(ex.stderr, non_recoverable):
raise
LOG.exception(_("Recovering from a failed execute. "
"Try number %s"), tries)
LOG.exception(_LE("Recovering from a failed execute. "
"Try number %s"), tries)
time.sleep(tries ** 2)
def _detach_volume(self, context, attach_info, volume, properties,
@ -262,8 +262,8 @@ class VolumeDriver(object):
LOG.debug(("volume %s: removing export"), volume['id'])
self.remove_export(context, volume)
except Exception as ex:
LOG.exception(_("Error detaching volume %(volume)s, "
"due to remove export failure."),
LOG.exception(_LE("Error detaching volume %(volume)s, "
"due to remove export failure."),
{"volume": volume['id']})
raise exception.RemoveExportException(volume=volume['id'],
reason=ex)
@ -471,9 +471,9 @@ class VolumeDriver(object):
model_update)
except exception.CinderException as ex:
if model_update:
LOG.exception(_("Failed updating model of volume "
"%(volume_id)s with driver provided model "
"%(model)s") %
LOG.exception(_LE("Failed updating model of volume "
"%(volume_id)s with driver provided "
"model %(model)s") %
{'volume_id': volume['id'],
'model': model_update})
raise exception.ExportFailure(reason=ex)

View File

@ -26,7 +26,7 @@ from oslo.db import exception as db_exc
from cinder import context
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
@ -42,7 +42,7 @@ def create(context, name, extra_specs=None):
dict(name=name,
extra_specs=extra_specs))
except db_exc.DBError as e:
LOG.exception(_('DB error: %s') % e)
LOG.exception(_LE('DB error: %s') % e)
raise exception.VolumeTypeCreateFailed(name=name,
extra_specs=extra_specs)
return type_ref

View File

@ -36,7 +36,7 @@ import webob.dec
import webob.exc
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import network_utils
@ -186,7 +186,7 @@ class Server(object):
{'host': host, 'port': port})
(self._host, self._port) = self._socket.getsockname()[0:2]
LOG.info(_("%(name)s listening on %(_host)s:%(_port)s") %
LOG.info(_LI("%(name)s listening on %(_host)s:%(_port)s") %
{'name': self.name, '_host': self._host, '_port': self._port})
def start(self):
@ -231,8 +231,9 @@ class Server(object):
**ssl_kwargs)
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_("Failed to start %(name)s on %(_host)s:"
"%(_port)s with SSL support.") % self.__dict__)
LOG.error(_LE("Failed to start %(name)s on %(_host)s:"
"%(_port)s with SSL "
"support.") % self.__dict__)
wsgi_kwargs = {
'func': eventlet.wsgi.server,
@ -264,7 +265,7 @@ class Server(object):
:returns: None
"""
LOG.info(_("Stopping WSGI server."))
LOG.info(_LI("Stopping WSGI server."))
if self._server is not None:
# Resize pool to stop new requests from being processed
self._pool.resize(0)
@ -283,7 +284,7 @@ class Server(object):
self._pool.waitall()
self._server.wait()
except greenlet.GreenletExit:
LOG.info(_("WSGI server has stopped."))
LOG.info(_LI("WSGI server has stopped."))
def reset(self):
"""Reset server greenpool size to default.