Convert files to use _LE and friends

LOG.warn etc. should be translated separately and thus messages need to
be marked with _LW for LOG.warn, _LI for LOG.info and _LE for LOG.errors
and LOG.exception.

Mark all LOG invocations with proper translation marker.

Use ',' instead of '%' when adding variables to log messages to allow
lazy evaluation.

Add new hacking checks for these.

Change-Id: I31d3ee50f30c63d7d647b1c2b1eae50bf96f0c74
This commit is contained in:
Andreas Jaeger 2014-10-27 21:19:44 +01:00
parent 6c84cf095c
commit 15641fba88
43 changed files with 407 additions and 308 deletions

View File

@ -12,9 +12,40 @@ Manila Specific Commandments
- [M319] Validate that debug level logs are not translated. - [M319] Validate that debug level logs are not translated.
- [M323] Ensure that the _() function is explicitly imported to ensure proper translations. - [M323] Ensure that the _() function is explicitly imported to ensure proper translations.
- [M325] str() cannot be used on an exception. Remove use or use six.text_type() - [M325] str() cannot be used on an exception. Remove use or use six.text_type()
- [M326] Translated messages cannot be concatenated. String should be included in translated message. - [M326] Translated messages cannot be concatenated. String should be
included in translated message.
- [M328] LOG.critical messages require translations _LC()!
- [M328] LOG.error and LOG.exception messages require translations _LE()!
- [M329] LOG.info messages require translations _LI()!
- [M330] LOG.warning messages require translations _LW()!
- [M331] Log messages require translations!
LOG Translations
----------------
LOG.debug messages will not get translated. Use ``_LI()`` for
``LOG.info``, ``_LW`` for ``LOG.warning``, ``_LE`` for ``LOG.error``
and ``LOG.exception``, and ``_LC()`` for ``LOG.critical``.
``_()`` is preferred for any user facing message, even if it is also
going to a log file. This ensures that the translated version of the
message will be available to the user.
The log marker functions (``_LI()``, ``_LW()``, ``_LE()``, and ``_LC()``)
must only be used when the message is only sent directly to the log.
Anytime that the message will be passed outside of the current context
(for example as part of an exception) the ``_()`` marker function
must be used.
A common pattern is to define a single message object and use it more
than once, for the log call and the exception. In that case, ``_()``
must be used because the message is going to appear in an exception that
may be presented to the user.
For more details about translations, see
http://docs.openstack.org/developer/oslo.i18n/guidelines.html
Creating Unit Tests Creating Unit Tests
------------------- -------------------
For every new feature, unit tests should be created that both test and For every new feature, unit tests should be created that both test and

View File

@ -43,7 +43,7 @@ from manila import i18n
i18n.enable_lazy() i18n.enable_lazy()
from manila.common import config # Need to register global_opts # noqa from manila.common import config # Need to register global_opts # noqa
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import service from manila import service
from manila import utils from manila import utils
@ -63,12 +63,12 @@ if __name__ == '__main__':
try: try:
servers.append(service.WSGIService('osapi_share')) servers.append(service.WSGIService('osapi_share'))
except (Exception, SystemExit): except (Exception, SystemExit):
LOG.exception(_('Failed to load osapi_share')) LOG.exception(_LE('Failed to load osapi_share'))
for binary in ['manila-share', 'manila-scheduler', 'manila-api']: for binary in ['manila-share', 'manila-scheduler', 'manila-api']:
try: try:
servers.append(service.Service.create(binary=binary)) servers.append(service.Service.create(binary=binary))
except (Exception, SystemExit): except (Exception, SystemExit):
LOG.exception(_('Failed to load %s'), binary) LOG.exception(_LE('Failed to load %s'), binary)
service.serve(*servers) service.serve(*servers)
service.wait() service.wait()

View File

@ -15,7 +15,7 @@
# under the License. # under the License.
from manila.api.middleware import auth from manila.api.middleware import auth
from manila.i18n import _ from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -24,14 +24,14 @@ LOG = logging.getLogger(__name__)
class ManilaKeystoneContext(auth.ManilaKeystoneContext): class ManilaKeystoneContext(auth.ManilaKeystoneContext):
def __init__(self, application): def __init__(self, application):
LOG.warn(_('manila.api.auth:ManilaKeystoneContext is deprecated. ' LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. '
'Please use ' 'Please use '
'manila.api.middleware.auth:ManilaKeystoneContext ' 'manila.api.middleware.auth:ManilaKeystoneContext '
'instead.')) 'instead.'))
super(ManilaKeystoneContext, self).__init__(application) super(ManilaKeystoneContext, self).__init__(application)
def pipeline_factory(loader, global_conf, **local_conf): def pipeline_factory(loader, global_conf, **local_conf):
LOG.warn(_('manila.api.auth:pipeline_factory is deprecated. Please use ' LOG.warn(_LW('manila.api.auth:pipeline_factory is deprecated. Please use '
'manila.api.middleware.auth:pipeline_factory instead.')) 'manila.api.middleware.auth:pipeline_factory instead.'))
auth.pipeline_factory(loader, global_conf, **local_conf) auth.pipeline_factory(loader, global_conf, **local_conf)

View File

@ -26,7 +26,9 @@ import manila.api.openstack
from manila.api.openstack import wsgi from manila.api.openstack import wsgi
from manila.api import xmlutil from manila.api import xmlutil
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.i18n import _LI
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
import manila.policy import manila.policy
@ -180,7 +182,7 @@ class ExtensionManager(object):
""" """
def __init__(self): def __init__(self):
LOG.info(_('Initializing extension manager.')) LOG.info(_LI('Initializing extension manager.'))
self.cls_list = CONF.osapi_share_extension self.cls_list = CONF.osapi_share_extension
@ -196,7 +198,7 @@ class ExtensionManager(object):
return return
alias = ext.alias alias = ext.alias
LOG.info(_('Loaded extension: %s'), alias) LOG.info(_LI('Loaded extension: %s'), alias)
if alias in self.extensions: if alias in self.extensions:
raise exception.Error("Found duplicate extension: %s" % alias) raise exception.Error("Found duplicate extension: %s" % alias)
@ -241,7 +243,7 @@ class ExtensionManager(object):
LOG.debug('Ext namespace: %s', extension.namespace) LOG.debug('Ext namespace: %s', extension.namespace)
LOG.debug('Ext updated: %s', extension.updated) LOG.debug('Ext updated: %s', extension.updated)
except AttributeError as ex: except AttributeError as ex:
LOG.exception(_("Exception loading extension: %s"), LOG.exception(_LE("Exception loading extension: %s"),
six.text_type(ex)) six.text_type(ex))
return False return False
@ -276,10 +278,11 @@ class ExtensionManager(object):
'standard_extensions') 'standard_extensions')
new_contrib_path = 'manila.api.contrib.standard_extensions' new_contrib_path = 'manila.api.contrib.standard_extensions'
if old_contrib_path in extensions: if old_contrib_path in extensions:
LOG.warn(_('osapi_share_extension is set to deprecated path: %s'), LOG.warn(_LW('osapi_share_extension is set to deprecated path: '
'%s'),
old_contrib_path) old_contrib_path)
LOG.warn(_('Please set your flag or manila.conf settings for ' LOG.warn(_LW('Please set your flag or manila.conf settings for '
'osapi_share_extension to: %s'), new_contrib_path) 'osapi_share_extension to: %s'), new_contrib_path)
extensions = [e.replace(old_contrib_path, new_contrib_path) extensions = [e.replace(old_contrib_path, new_contrib_path)
for e in extensions] for e in extensions]
@ -287,8 +290,8 @@ class ExtensionManager(object):
try: try:
self.load_extension(ext_factory) self.load_extension(ext_factory)
except Exception as exc: except Exception as exc:
LOG.warn(_('Failed to load extension %(ext_factory)s: ' LOG.warn(_LW('Failed to load extension %(ext_factory)s: '
'%(exc)s'), '%(exc)s'),
{"ext_factory": ext_factory, "exc": exc}) {"ext_factory": ext_factory, "exc": exc})
@ -356,9 +359,9 @@ def load_standard_extensions(ext_mgr, logger, path, package, ext_list=None):
try: try:
ext_mgr.load_extension(classpath) ext_mgr.load_extension(classpath)
except Exception as exc: except Exception as exc:
logger.warn(_('Failed to load extension %(classpath)s: ' logger.warn(_LW('Failed to load extension %(classpath)s: '
'%(exc)s') '%(exc)s'),
% {"classpath": classpath, "exc": exc}) {"classpath": classpath, "exc": exc})
# Now, let's consider any subdirectories we may have... # Now, let's consider any subdirectories we may have...
subdirs = [] subdirs = []
@ -381,8 +384,8 @@ def load_standard_extensions(ext_mgr, logger, path, package, ext_list=None):
try: try:
ext(ext_mgr) ext(ext_mgr)
except Exception as exc: except Exception as exc:
logger.warn(_('Failed to load extension %(ext_name)s: ' logger.warn(_LW('Failed to load extension %(ext_name)s: '
'%(exc)s') % '%(exc)s'),
{"ext_name": ext_name, "exc": exc}) {"ext_name": ext_name, "exc": exc})
# Update the list of directories we'll explore... # Update the list of directories we'll explore...

View File

@ -19,7 +19,8 @@ import webob.dec
import webob.exc import webob.exc
from manila.api.openstack import wsgi from manila.api.openstack import wsgi
from manila.i18n import _ from manila.i18n import _LE
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import utils from manila import utils
from manila import wsgi as base_wsgi from manila import wsgi as base_wsgi
@ -42,7 +43,7 @@ class FaultWrapper(base_wsgi.Middleware):
status, webob.exc.HTTPInternalServerError)() status, webob.exc.HTTPInternalServerError)()
def _error(self, inner, req): def _error(self, inner, req):
LOG.exception(_("Caught error: %s"), six.text_type(inner)) LOG.exception(_LE("Caught error: %s"), six.text_type(inner))
safe = getattr(inner, 'safe', False) safe = getattr(inner, 'safe', False)
headers = getattr(inner, 'headers', None) headers = getattr(inner, 'headers', None)
@ -51,7 +52,7 @@ class FaultWrapper(base_wsgi.Middleware):
status = 500 status = 500
msg_dict = dict(url=req.url, status=status) 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) outer = self.status_to_type(status)
if headers: if headers:
outer.headers = headers outer.headers = headers

View File

@ -23,6 +23,7 @@ import routes
from manila.api.openstack import wsgi from manila.api.openstack import wsgi
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LW
from manila import utils from manila import utils
from manila import wsgi as base_wsgi from manila import wsgi as base_wsgi
@ -107,8 +108,8 @@ class APIRouter(base_wsgi.Router):
controller = extension.controller controller = extension.controller
if collection not in self.resources: if collection not in self.resources:
LOG.warning(_('Extension %(ext_name)s: Cannot extend ' LOG.warning(_LW('Extension %(ext_name)s: Cannot extend '
'resource %(collection)s: No such resource'), 'resource %(collection)s: No such resource'),
{'ext_name': ext_name, 'collection': collection}) {'ext_name': ext_name, 'collection': collection})
continue continue
@ -126,8 +127,8 @@ class APIRouter(base_wsgi.Router):
class FaultWrapper(base_wsgi.Middleware): class FaultWrapper(base_wsgi.Middleware):
def __init__(self, application): def __init__(self, application):
LOG.warn(_('manila.api.openstack:FaultWrapper is deprecated. Please ' LOG.warn(_LW('manila.api.openstack:FaultWrapper is deprecated. Please '
'use manila.api.middleware.fault:FaultWrapper instead.')) 'use manila.api.middleware.fault:FaultWrapper instead.'))
# Avoid circular imports from here. # Avoid circular imports from here.
from manila.api.middleware import fault from manila.api.middleware import fault
super(FaultWrapper, self).__init__(fault.FaultWrapper(application)) super(FaultWrapper, self).__init__(fault.FaultWrapper(application))

View File

@ -16,13 +16,13 @@
from manila.api import urlmap from manila.api import urlmap
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.i18n import _ from manila.i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def urlmap_factory(loader, global_conf, **local_conf): def urlmap_factory(loader, global_conf, **local_conf):
LOG.warn(_('manila.api.openstack.urlmap:urlmap_factory is deprecated. ' LOG.warn(_LW('manila.api.openstack.urlmap:urlmap_factory is deprecated. '
'Please use manila.api.urlmap:urlmap_factory instead.')) 'Please use manila.api.urlmap:urlmap_factory instead.'))
urlmap.urlmap_factory(loader, global_conf, **local_conf) urlmap.urlmap_factory(loader, global_conf, **local_conf)

View File

@ -15,7 +15,7 @@
# under the License. # under the License.
from manila.api.v1.router import APIRouter as v1_router from manila.api.v1.router import APIRouter as v1_router
from manila.i18n import _ from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -23,6 +23,6 @@ LOG = logging.getLogger(__name__)
class APIRouter(v1_router): class APIRouter(v1_router):
def __init__(self, ext_mgr=None): def __init__(self, ext_mgr=None):
LOG.warn(_('manila.api.openstack.volume:APIRouter is deprecated. ' LOG.warn(_LW('manila.api.openstack.volume:APIRouter is deprecated. '
'Please use manila.api.v1.router:APIRouter instead.')) 'Please use manila.api.v1.router:APIRouter instead.'))
super(APIRouter, self).__init__(ext_mgr) super(APIRouter, self).__init__(ext_mgr)

View File

@ -22,6 +22,8 @@ import webob
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import utils from manila import utils
from manila import wsgi from manila import wsgi
@ -578,14 +580,14 @@ class ResourceExceptionHandler(object):
code=ex_value.code, explanation=six.text_type(ex_value))) code=ex_value.code, explanation=six.text_type(ex_value)))
elif isinstance(ex_value, TypeError): elif isinstance(ex_value, TypeError):
exc_info = (ex_type, ex_value, ex_traceback) exc_info = (ex_type, ex_value, ex_traceback)
LOG.error(_('Exception handling resource: %s'), LOG.error(_LE('Exception handling resource: %s'),
ex_value, exc_info=exc_info) ex_value, exc_info=exc_info)
raise Fault(webob.exc.HTTPBadRequest()) raise Fault(webob.exc.HTTPBadRequest())
elif isinstance(ex_value, Fault): elif isinstance(ex_value, Fault):
LOG.info(_("Fault thrown: %s"), six.text_type(ex_value)) LOG.info(_LI("Fault thrown: %s"), six.text_type(ex_value))
raise ex_value raise ex_value
elif isinstance(ex_value, webob.exc.HTTPException): elif isinstance(ex_value, webob.exc.HTTPException):
LOG.info(_("HTTP exception thrown: %s"), six.text_type(ex_value)) LOG.info(_LI("HTTP exception thrown: %s"), six.text_type(ex_value))
raise Fault(ex_value) raise Fault(ex_value)
# We didn't handle the exception # We didn't handle the exception

View File

@ -15,7 +15,7 @@
# under the License. # under the License.
from manila.api.middleware import sizelimit from manila.api.middleware import sizelimit
from manila.i18n import _ from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
class RequestBodySizeLimiter(sizelimit.RequestBodySizeLimiter): class RequestBodySizeLimiter(sizelimit.RequestBodySizeLimiter):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
LOG.warn(_('manila.api.sizelimit:RequestBodySizeLimiter is ' LOG.warn(_LW('manila.api.sizelimit:RequestBodySizeLimiter is '
'deprecated. Please use manila.api.middleware.sizelimit:' 'deprecated. Please use manila.api.middleware.sizelimit: '
'RequestBodySizeLimiter instead')) 'RequestBodySizeLimiter instead'))
super(RequestBodySizeLimiter, self).__init__(*args, **kwargs) super(RequestBodySizeLimiter, self).__init__(*args, **kwargs)

View File

@ -27,6 +27,7 @@ from manila.common import constants
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import policy from manila import policy
@ -81,7 +82,7 @@ class SecurityServiceController(wsgi.Controller):
"""Delete a security service.""" """Delete a security service."""
context = req.environ['manila.context'] context = req.environ['manila.context']
LOG.info(_("Delete security service with id: %s"), LOG.info(_LI("Delete security service with id: %s"),
id, context=context) id, context=context)
try: try:

View File

@ -28,6 +28,8 @@ from manila.api import xmlutil
from manila.db import api as db_api from manila.db import api as db_api
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import policy from manila import policy
from manila import quota from manila import quota
@ -117,8 +119,8 @@ class ShareNetworkController(wsgi.Controller):
context, project_id=share_network['project_id'], context, project_id=share_network['project_id'],
share_networks=-1) share_networks=-1)
except Exception: except Exception:
msg = _("Failed to update usages deleting share-network.") LOG.exception(_LE("Failed to update usages deleting "
LOG.exception(msg) "share-network."))
else: else:
QUOTAS.commit(context, reservations, QUOTAS.commit(context, reservations,
project_id=share_network['project_id']) project_id=share_network['project_id'])
@ -264,12 +266,12 @@ class ShareNetworkController(wsgi.Controller):
return (usages[name]['reserved'] + usages[name]['in_use']) return (usages[name]['reserved'] + usages[name]['in_use'])
if 'share_networks' in overs: if 'share_networks' in overs:
msg = _("Quota exceeded for %(s_pid)s, tried to create " LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
"share-network (%(d_consumed)d of %(d_quota)d " "share-network (%(d_consumed)d of %(d_quota)d "
"already consumed)") "already consumed)"), {
LOG.warn(msg, {'s_pid': context.project_id, 's_pid': context.project_id,
'd_consumed': _consumed('share_networks'), 'd_consumed': _consumed('share_networks'),
'd_quota': quotas['share_networks']}) 'd_quota': quotas['share_networks']})
raise exception.ShareNetworksLimitExceeded( raise exception.ShareNetworksLimitExceeded(
allowed=quotas['share_networks']) allowed=quotas['share_networks'])
else: else:

View File

@ -24,7 +24,7 @@ from manila.api.openstack import wsgi
from manila.api.views import share_snapshots as snapshot_views from manila.api.views import share_snapshots as snapshot_views
from manila.api import xmlutil from manila.api import xmlutil
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import share from manila import share
@ -82,7 +82,7 @@ class ShareSnapshotsController(wsgi.Controller):
"""Delete a snapshot.""" """Delete a snapshot."""
context = req.environ['manila.context'] context = req.environ['manila.context']
LOG.info(_("Delete snapshot with id: %s"), id, context=context) LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
try: try:
snapshot = self.share_api.get_snapshot(context, id) snapshot = self.share_api.get_snapshot(context, id)
@ -181,8 +181,8 @@ class ShareSnapshotsController(wsgi.Controller):
share_id = snapshot['share_id'] share_id = snapshot['share_id']
share = self.share_api.get(context, share_id) share = self.share_api.get(context, share_id)
msg = _("Create snapshot from share %s") LOG.info(_LI("Create snapshot from share %s"),
LOG.info(msg, share_id, context=context) share_id, context=context)
# NOTE(rushiagr): v2 API allows name instead of display_name # NOTE(rushiagr): v2 API allows name instead of display_name
if 'name' in snapshot: if 'name' in snapshot:

View File

@ -27,6 +27,7 @@ from manila.api.views import shares as share_views
from manila.api import xmlutil from manila.api import xmlutil
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import uuidutils from manila.openstack.common import uuidutils
from manila import share from manila import share
@ -84,7 +85,7 @@ class ShareController(wsgi.Controller):
"""Delete a share.""" """Delete a share."""
context = req.environ['manila.context'] context = req.environ['manila.context']
LOG.info(_("Delete share with id: %s"), id, context=context) LOG.info(_LI("Delete share with id: %s"), id, context=context)
try: try:
share = self.share_api.get(context, id) share = self.share_api.get(context, id)
@ -212,7 +213,7 @@ class ShareController(wsgi.Controller):
size = share['size'] size = share['size']
share_proto = share['share_proto'].upper() share_proto = share['share_proto'].upper()
msg = (_("Create %(share_proto)s share of %(size)s GB") % msg = (_LI("Create %(share_proto)s share of %(size)s GB") %
{'share_proto': share_proto, 'size': size}) {'share_proto': share_proto, 'size': size})
LOG.info(msg, context=context) LOG.info(msg, context=context)

View File

@ -23,6 +23,7 @@ from oslo.utils import timeutils
import six import six
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LW
from manila.openstack.common import context as common_context from manila.openstack.common import context as common_context
from manila.openstack.common import local from manila.openstack.common import local
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -56,7 +57,7 @@ class RequestContext(object):
because they possibly came in from older rpc messages. because they possibly came in from older rpc messages.
""" """
if kwargs: if kwargs:
LOG.warn(_('Arguments dropped when creating context: %s'), LOG.warn(_LW('Arguments dropped when creating context: %s'),
str(kwargs)) str(kwargs))
self.user_id = user_id self.user_id = user_id

View File

@ -28,7 +28,7 @@ from alembic import op
from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Boolean, Column, DateTime, ForeignKey
from sqlalchemy import Integer, MetaData, String, Table, UniqueConstraint from sqlalchemy import Integer, MetaData, String, Table, UniqueConstraint
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -400,7 +400,7 @@ def upgrade():
table.create() table.create()
except Exception: except Exception:
LOG.info(repr(table)) LOG.info(repr(table))
LOG.exception(_('Exception while creating table.')) LOG.exception(_LE('Exception while creating table.'))
raise raise
if migrate_engine.name == "mysql": if migrate_engine.name == "mysql":

View File

@ -37,6 +37,8 @@ from manila.common import constants
from manila.db.sqlalchemy import models from manila.db.sqlalchemy import models
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -945,8 +947,8 @@ def quota_reserve(context, resources, project_quotas, user_quotas, deltas,
session.add(usage_ref) session.add(usage_ref)
if unders: if unders:
LOG.warning(_("Change will make usage less than 0 for the following " LOG.warning(_LW("Change will make usage less than 0 for the following "
"resources: %s"), unders) "resources: %s"), unders)
if overs: if overs:
if project_quotas == user_quotas: if project_quotas == user_quotas:
usages = project_usages usages = project_usages
@ -2115,8 +2117,8 @@ def volume_type_destroy(context, id):
results = model_query(context, models.Share, session=session). \ results = model_query(context, models.Share, session=session). \
filter_by(volume_type_id=id).all() filter_by(volume_type_id=id).all()
if results: if results:
msg = _('VolumeType %s deletion failed, VolumeType in use.') % id LOG.error(_LE('VolumeType %s deletion failed, VolumeType in use.'),
LOG.error(msg) id)
raise exception.VolumeTypeInUse(volume_type_id=id) raise exception.VolumeTypeInUse(volume_type_id=id)
model_query(context, models.VolumeTypeExtraSpecs, session=session).\ model_query(context, models.VolumeTypeExtraSpecs, session=session).\
filter_by(volume_type_id=id).update( filter_by(volume_type_id=id).update(

View File

@ -27,6 +27,7 @@ import six
import webob.exc import webob.exc
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import processutils from manila.openstack.common import processutils
@ -89,9 +90,10 @@ class ManilaException(Exception):
except Exception as e: except Exception as e:
# kwargs doesn't match a variable in the message # kwargs doesn't match a variable in the message
# log the issue and the kwargs # log the issue and the kwargs
LOG.exception(_('Exception in string format operation.')) LOG.exception(_LE('Exception in string format operation.'))
for name, value in six.iteritems(kwargs): for name, value in six.iteritems(kwargs):
LOG.error("%s: %s" % (name, value)) LOG.error(_LE("%(name)s: %(value)s"), {
'name': name, 'value': value})
if CONF.fatal_exception_format_errors: if CONF.fatal_exception_format_errors:
raise e raise e
else: else:

View File

@ -16,6 +16,8 @@
import ast import ast
import re import re
import pep8
""" """
Guidelines for writing new hacking checks Guidelines for writing new hacking checks
@ -33,6 +35,16 @@ Guidelines for writing new hacking checks
UNDERSCORE_IMPORT_FILES = [] UNDERSCORE_IMPORT_FILES = []
log_translation = re.compile(
r"(.)*LOG\.(audit|error|info|critical|exception)\(\s*('|\")")
log_translation_LC = re.compile(
r"(.)*LOG\.(critical)\(\s*(_\(|'|\")")
log_translation_LE = re.compile(
r"(.)*LOG\.(error|exception)\(\s*(_\(|'|\")")
log_translation_LI = re.compile(
r"(.)*LOG\.(info)\(\s*(_\(|'|\")")
log_translation_LW = re.compile(
r"(.)*LOG\.(warning|warn)\(\s*(_\(|'|\")")
translated_log = re.compile( translated_log = re.compile(
r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)" r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)"
"\(\s*_\(\s*('|\")") "\(\s*_\(\s*('|\")")
@ -104,6 +116,32 @@ def no_translate_debug_logs(logical_line, filename):
yield(0, "M319 Don't translate debug level logs") yield(0, "M319 Don't translate debug level logs")
def validate_log_translations(logical_line, physical_line, filename):
# Translations are not required in the test and tempest
# directories.
if ("manila/tests" in filename or
"contrib/tempest" in filename):
return
if pep8.noqa(physical_line):
return
msg = "M327: LOG.critical messages require translations `_LC()`!"
if log_translation_LC.match(logical_line):
yield (0, msg)
msg = ("M328: LOG.error and LOG.exception messages require translations "
"`_LE()`!")
if log_translation_LE.match(logical_line):
yield (0, msg)
msg = "M329: LOG.info messages require translations `_LI()`!"
if log_translation_LI.match(logical_line):
yield (0, msg)
msg = "M330: LOG.warning messages require translations `_LW()`!"
if log_translation_LW.match(logical_line):
yield (0, msg)
msg = "M331: Log messages require translations!"
if log_translation.match(logical_line):
yield (0, msg)
def check_explicit_underscore_import(logical_line, filename): def check_explicit_underscore_import(logical_line, filename):
"""Check for explicit import of the _ function """Check for explicit import of the _ function
@ -184,6 +222,7 @@ class CheckForTransAdd(BaseASTChecker):
def factory(register): def factory(register):
register(validate_log_translations)
register(check_explicit_underscore_import) register(check_explicit_underscore_import)
register(no_translate_debug_logs) register(no_translate_debug_logs)
register(CheckForStrExc) register(CheckForStrExc)

View File

@ -55,7 +55,7 @@ from oslo.config import cfg
import six import six
from manila.db import base from manila.db import base
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.scheduler import rpcapi as scheduler_rpcapi from manila.scheduler import rpcapi as scheduler_rpcapi
from manila import version from manila import version
@ -160,8 +160,8 @@ class Manager(base.Base):
except Exception as e: except Exception as e:
if raise_on_error: if raise_on_error:
raise raise
LOG.exception(_("Error during %(full_task_name)s: %(e)s"), LOG.exception(_LE("Error during %(full_task_name)s: %(e)s"),
locals()) {'full_task_name': full_task_name, 'e': e})
def init_host(self): def init_host(self):
"""Handle initialization if this is a standalone service. """Handle initialization if this is a standalone service.

View File

@ -21,6 +21,8 @@ import six
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.network.linux import ip_lib from manila.network.linux import ip_lib
from manila.network.linux import ovs_lib from manila.network.linux import ovs_lib
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -154,7 +156,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
namespace_obj.add_device_to_namespace(ns_dev) namespace_obj.add_device_to_namespace(ns_dev)
else: else:
LOG.warn(_("Device %s already exists"), device_name) LOG.warn(_LW("Device %s already exists"), device_name)
ns_dev.link.set_up() ns_dev.link.set_up()
@device_name_synchronized @device_name_synchronized
@ -170,7 +172,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
try: try:
ovs.delete_port(tap_name) ovs.delete_port(tap_name)
except RuntimeError: except RuntimeError:
LOG.error(_("Failed unplugging interface '%s'"), LOG.error(_LE("Failed unplugging interface '%s'"),
device_name) device_name)
@ -199,7 +201,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
else: else:
ns_veth = ip.device(device_name) ns_veth = ip.device(device_name)
root_veth = ip.device(tap_name) root_veth = ip.device(tap_name)
LOG.warn(_("Device %s already exists"), device_name) LOG.warn(_LW("Device %s already exists"), device_name)
root_veth.link.set_up() root_veth.link.set_up()
ns_veth.link.set_up() ns_veth.link.set_up()
@ -212,5 +214,5 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
device.link.delete() device.link.delete()
LOG.debug("Unplugged interface '%s'", device_name) LOG.debug("Unplugged interface '%s'", device_name)
except RuntimeError: except RuntimeError:
LOG.error(_("Failed unplugging interface '%s'"), LOG.error(_LE("Failed unplugging interface '%s'"),
device_name) device_name)

View File

@ -15,7 +15,7 @@
import re import re
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import utils from manila import utils
@ -45,7 +45,8 @@ class OVSBridge:
try: try:
return utils.execute(*full_args, run_as_root=True) return utils.execute(*full_args, run_as_root=True)
except Exception as e: except Exception as e:
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"), LOG.error(_LE("Unable to execute %(cmd)s. Exception: "
"%(exception)s"),
{'cmd': full_args, 'exception': e}) {'cmd': full_args, 'exception': e})
def reset_bridge(self): def reset_bridge(self):

View File

@ -19,7 +19,7 @@ from oslo.config import cfg
from manila import context from manila import context
from manila.db import base from manila.db import base
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.network import neutron from manila.network import neutron
from manila.network.neutron import constants as neutron_constants from manila.network.neutron import constants as neutron_constants
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -129,7 +129,7 @@ class API(base.Base):
port = self.client.create_port(port_req_body).get('port', {}) port = self.client.create_port(port_req_body).get('port', {})
return port return port
except neutron_client_exc.NeutronClientException as e: except neutron_client_exc.NeutronClientException as e:
LOG.exception(_('Neutron error creating port on network %s') % LOG.exception(_LE('Neutron error creating port on network %s'),
network_id) network_id)
if e.status_code == 409: if e.status_code == 409:
raise exception.PortLimitExceeded() raise exception.PortLimitExceeded()

View File

@ -25,7 +25,7 @@ import six
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -980,7 +980,8 @@ class QuotaEngine(object):
# usage resynchronization and the reservation expiration # usage resynchronization and the reservation expiration
# mechanisms will resolve the issue. The exception is # mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal. # 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)
return return
LOG.debug("Committed reservations %s", reservations) LOG.debug("Committed reservations %s", reservations)
@ -1003,7 +1004,7 @@ class QuotaEngine(object):
# usage resynchronization and the reservation expiration # usage resynchronization and the reservation expiration
# mechanisms will resolve the issue. The exception is # mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal. # logged, however, because this is less than optimal.
LOG.exception(_("Failed to roll back reservations %s"), LOG.exception(_LE("Failed to roll back reservations %s"),
reservations) reservations)
return return
LOG.debug("Rolled back reservations %s", reservations) LOG.debug("Rolled back reservations %s", reservations)

View File

@ -24,6 +24,7 @@ from oslo.config import cfg
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.scheduler import driver from manila.scheduler import driver
from manila.scheduler import scheduler_options from manila.scheduler import scheduler_options
@ -208,13 +209,12 @@ class FilterScheduler(driver.Scheduler):
return # no previously attempted hosts, skip return # no previously attempted hosts, skip
last_host = hosts[-1] last_host = hosts[-1]
msg = _("Error scheduling %(share_id)s from last share-service: " LOG.error(_LE("Error scheduling %(share_id)s from last share-service: "
"%(last_host)s : %(exc)s") % { "%(last_host)s : %(exc)s"), {
"share_id": share_id, "share_id": share_id,
"last_host": last_host, "last_host": last_host,
"exc": "exc" "exc": "exc"
} })
LOG.error(msg)
def populate_filter_properties_share(self, request_spec, def populate_filter_properties_share(self, request_spec,
filter_properties): filter_properties):

View File

@ -18,7 +18,8 @@
import math import math
from manila.i18n import _ from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common.scheduler import filters from manila.openstack.common.scheduler import filters
@ -35,8 +36,8 @@ class CapacityFilter(filters.BaseHostFilter):
if host_state.free_capacity_gb is None: if host_state.free_capacity_gb is None:
# Fail Safe # Fail Safe
LOG.error(_("Free capacity not set: " LOG.error(_LE("Free capacity not set: "
"volume node info collection broken.")) "volume node info collection broken."))
return False return False
free_space = host_state.free_capacity_gb free_space = host_state.free_capacity_gb
@ -49,9 +50,9 @@ class CapacityFilter(filters.BaseHostFilter):
reserved = float(host_state.reserved_percentage) / 100 reserved = float(host_state.reserved_percentage) / 100
free = math.floor(free_space * (1 - reserved)) free = math.floor(free_space * (1 - reserved))
if free < volume_size: if free < volume_size:
LOG.warning(_("Insufficient free space for volume creation " LOG.warning(_LW("Insufficient free space for volume creation "
"(requested / avail): " "(requested / avail): "
"%(requested)s/%(available)s"), "%(requested)s/%(available)s"),
{'requested': volume_size, {'requested': volume_size,
'available': free}) 'available': free})

View File

@ -25,7 +25,7 @@ import six
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common.scheduler import filters from manila.openstack.common.scheduler import filters
from manila.openstack.common.scheduler import weights from manila.openstack.common.scheduler import weights
@ -267,7 +267,7 @@ class HostManager(object):
share_services = db.service_get_all_by_topic(context, topic) share_services = db.service_get_all_by_topic(context, topic)
for service in share_services: for service in share_services:
if not utils.service_is_up(service) or service['disabled']: if not utils.service_is_up(service) or service['disabled']:
LOG.warn(_("service is down or disabled.")) LOG.warn(_LW("service is down or disabled."))
continue continue
host = service['host'] host = service['host']
capabilities = self.service_states.get(host, None) capabilities = self.service_states.get(host, None)

View File

@ -26,7 +26,7 @@ from oslo.utils import importutils
from manila import context from manila import context
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LW
from manila import manager from manila import manager
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import rpc from manila import rpc
@ -90,7 +90,7 @@ class SchedulerManager(manager.Manager):
def _set_share_error_state_and_notify(self, method, context, ex, def _set_share_error_state_and_notify(self, method, context, ex,
request_spec): request_spec):
LOG.warning(_("Failed to schedule_%(method)s: %(ex)s"), LOG.warning(_LW("Failed to schedule_%(method)s: %(ex)s"),
{"method": method, "ex": ex}) {"method": method, "ex": ex})
share_state = {'status': 'error'} share_state = {'status': 'error'}

View File

@ -27,7 +27,7 @@ from oslo.config import cfg
from oslo.serialization import jsonutils from oslo.serialization import jsonutils
from oslo.utils import timeutils from oslo.utils import timeutils
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
scheduler_json_config_location_opt = cfg.StrOpt( scheduler_json_config_location_opt = cfg.StrOpt(
@ -65,8 +65,8 @@ class SchedulerOptions(object):
try: try:
return os.path.getmtime(filename) return os.path.getmtime(filename)
except os.error as e: except os.error as e:
LOG.exception(_("Could not stat scheduler options file " LOG.exception(_LE("Could not stat scheduler options file "
"%(filename)s: '%(e)s'"), "%(filename)s: '%(e)s'"),
{"filename": filename, "e": e}) {"filename": filename, "e": e})
raise raise
@ -75,8 +75,8 @@ class SchedulerOptions(object):
try: try:
return jsonutils.load(handle) return jsonutils.load(handle)
except ValueError as e: except ValueError as e:
LOG.exception(_("Could not decode scheduler options: " LOG.exception(_LE("Could not decode scheduler options: "
"'%(e)s'"), {"e": e}) "'%(e)s'"), {"e": e})
return {} return {}
def _get_time_now(self): def _get_time_now(self):

View File

@ -34,7 +34,9 @@ from oslo.utils import importutils
from manila import context from manila import context
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.i18n import _LI
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import loopingcall from manila.openstack.common import loopingcall
from manila import rpc from manila import rpc
@ -120,7 +122,7 @@ class Launcher(object):
""" """
def sigterm(sig, frame): def sigterm(sig, frame):
LOG.info(_("SIGTERM received")) LOG.info(_LI("SIGTERM received"))
# NOTE(jk0): Raise a ^C which is caught by the caller and cleanly # NOTE(jk0): Raise a ^C which is caught by the caller and cleanly
# shuts down the service. This does not yet handle eventlet # shuts down the service. This does not yet handle eventlet
# threads. # threads.
@ -170,7 +172,7 @@ class ProcessLauncher(object):
# dies unexpectedly # dies unexpectedly
self.readpipe.read() self.readpipe.read()
LOG.info(_('Parent process has died unexpectedly, exiting')) LOG.info(_LI('Parent process has died unexpectedly, exiting'))
sys.exit(1) sys.exit(1)
@ -209,7 +211,7 @@ class ProcessLauncher(object):
# start up quickly but ensure we don't fork off children that # start up quickly but ensure we don't fork off children that
# die instantly too quickly. # die instantly too quickly.
if time.time() - wrap.forktimes[0] < wrap.workers: if time.time() - wrap.forktimes[0] < wrap.workers:
LOG.info(_('Forking too fast, sleeping')) LOG.info(_LI('Forking too fast, sleeping'))
time.sleep(1) time.sleep(1)
wrap.forktimes.pop(0) wrap.forktimes.pop(0)
@ -227,19 +229,19 @@ class ProcessLauncher(object):
except SignalExit as exc: except SignalExit as exc:
signame = {signal.SIGTERM: 'SIGTERM', signame = {signal.SIGTERM: 'SIGTERM',
signal.SIGINT: 'SIGINT'}[exc.signo] signal.SIGINT: 'SIGINT'}[exc.signo]
LOG.info(_('Caught %s, exiting'), signame) LOG.info(_LI('Caught %s, exiting'), signame)
status = exc.code status = exc.code
except SystemExit as exc: except SystemExit as exc:
status = exc.code status = exc.code
except BaseException: except BaseException:
LOG.exception(_('Unhandled exception')) LOG.exception(_LE('Unhandled exception'))
status = 2 status = 2
finally: finally:
wrap.server.stop() wrap.server.stop()
os._exit(status) os._exit(status)
LOG.info(_('Started child %d'), pid) LOG.info(_LI('Started child %d'), pid)
wrap.children.add(pid) wrap.children.add(pid)
self.children[pid] = wrap self.children[pid] = wrap
@ -249,7 +251,7 @@ class ProcessLauncher(object):
def launch_server(self, server, workers=1): def launch_server(self, server, workers=1):
wrap = ServerWrapper(server, workers) wrap = ServerWrapper(server, workers)
self.totalwrap = self.totalwrap + 1 self.totalwrap = self.totalwrap + 1
LOG.info(_('Starting %d workers'), wrap.workers) LOG.info(_LI('Starting %d workers'), wrap.workers)
while (self.running and len(wrap.children) < wrap.workers while (self.running and len(wrap.children) < wrap.workers
and not wrap.failed): and not wrap.failed):
self._start_child(wrap) self._start_child(wrap)
@ -268,13 +270,15 @@ class ProcessLauncher(object):
code = 0 code = 0
if os.WIFSIGNALED(status): if os.WIFSIGNALED(status):
sig = os.WTERMSIG(status) sig = os.WTERMSIG(status)
LOG.info(_('Child %(pid)d killed by signal %(sig)d'), locals()) LOG.info(_LI('Child %(pid)d killed by signal %(sig)d'),
{'pid': pid, 'sig': sig})
else: else:
code = os.WEXITSTATUS(status) code = os.WEXITSTATUS(status)
LOG.info(_('Child %(pid)d exited with status %(code)d'), locals()) LOG.info(_LI('Child %(pid)d exited with status %(code)d'),
{'pid': pid, 'code': code})
if pid not in self.children: if pid not in self.children:
LOG.warning(_('pid %d not in child list'), pid) LOG.warning(_LW('pid %d not in child list'), pid)
return None return None
wrap = self.children.pop(pid) wrap = self.children.pop(pid)
@ -282,7 +286,7 @@ class ProcessLauncher(object):
if 2 == code: if 2 == code:
wrap.failed = True wrap.failed = True
self.failedwrap = self.failedwrap + 1 self.failedwrap = self.failedwrap + 1
LOG.info(_('_wait_child %d'), self.failedwrap) LOG.info(_LI('_wait_child %d'), self.failedwrap)
if self.failedwrap == self.totalwrap: if self.failedwrap == self.totalwrap:
self.running = False self.running = False
return wrap return wrap
@ -298,7 +302,7 @@ class ProcessLauncher(object):
eventlet.greenthread.sleep(.01) eventlet.greenthread.sleep(.01)
continue continue
LOG.info(_('wait wrap.failed %s'), wrap.failed) LOG.info(_LI('wait wrap.failed %s'), wrap.failed)
while (self.running and len(wrap.children) < wrap.workers while (self.running and len(wrap.children) < wrap.workers
and not wrap.failed): and not wrap.failed):
self._start_child(wrap) self._start_child(wrap)
@ -306,7 +310,7 @@ class ProcessLauncher(object):
if self.sigcaught: if self.sigcaught:
signame = {signal.SIGTERM: 'SIGTERM', signame = {signal.SIGTERM: 'SIGTERM',
signal.SIGINT: 'SIGINT'}[self.sigcaught] signal.SIGINT: 'SIGINT'}[self.sigcaught]
LOG.info(_('Caught %s, stopping children'), signame) LOG.info(_LI('Caught %s, stopping children'), signame)
for pid in self.children: for pid in self.children:
try: try:
@ -317,7 +321,7 @@ class ProcessLauncher(object):
# Wait for children to die # Wait for children to die
if self.children: if self.children:
LOG.info(_('Waiting on %d children to exit'), len(self.children)) LOG.info(_LI('Waiting on %d children to exit'), len(self.children))
while self.children: while self.children:
self._wait_child() self._wait_child()
@ -352,7 +356,7 @@ class Service(object):
def start(self): def start(self):
version_string = version.version_string() version_string = version.version_string()
LOG.info(_('Starting %(topic)s node (version %(version_string)s)'), LOG.info(_LI('Starting %(topic)s node (version %(version_string)s)'),
{'topic': self.topic, 'version_string': version_string}) {'topic': self.topic, 'version_string': version_string})
self.model_disconnected = False self.model_disconnected = False
ctxt = context.get_admin_context() ctxt = context.get_admin_context()
@ -449,7 +453,7 @@ class Service(object):
try: try:
db.service_destroy(context.get_admin_context(), self.service_id) db.service_destroy(context.get_admin_context(), self.service_id)
except exception.NotFound: except exception.NotFound:
LOG.warn(_('Service killed that has no database entry')) LOG.warn(_LW('Service killed that has no database entry'))
def stop(self): def stop(self):
# Try to shut the connection down, but if we get any sort of # Try to shut the connection down, but if we get any sort of
@ -501,13 +505,13 @@ class Service(object):
# TODO(termie): make this pattern be more elegant. # TODO(termie): make this pattern be more elegant.
if getattr(self, 'model_disconnected', False): if getattr(self, 'model_disconnected', False):
self.model_disconnected = False self.model_disconnected = False
LOG.error(_('Recovered model server connection!')) LOG.error(_LE('Recovered model server connection!'))
# TODO(vish): this should probably only catch connection errors # TODO(vish): this should probably only catch connection errors
except Exception: # pylint: disable=W0702 except Exception: # pylint: disable=W0702
if not getattr(self, 'model_disconnected', False): if not getattr(self, 'model_disconnected', False):
self.model_disconnected = True self.model_disconnected = True
LOG.exception(_('model server went away')) LOG.exception(_LE('model server went away'))
class WSGIService(object): class WSGIService(object):

View File

@ -27,6 +27,8 @@ from manila.api import extensions
from manila.db import base from manila.db import base
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import policy from manila import policy
from manila import quota from manila import quota
@ -120,20 +122,20 @@ class API(base.Base):
return (usages[name]['reserved'] + usages[name]['in_use']) return (usages[name]['reserved'] + usages[name]['in_use'])
if 'gigabytes' in overs: if 'gigabytes' in overs:
msg = _("Quota exceeded for %(s_pid)s, tried to create " LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
"%(s_size)sG share (%(d_consumed)dG of %(d_quota)dG " "%(s_size)sG share (%(d_consumed)dG of "
"already consumed)") "%(d_quota)dG already consumed)"), {
LOG.warn(msg % {'s_pid': context.project_id, 's_pid': context.project_id,
's_size': size, 's_size': size,
'd_consumed': _consumed('gigabytes'), 'd_consumed': _consumed('gigabytes'),
'd_quota': quotas['gigabytes']}) 'd_quota': quotas['gigabytes']})
raise exception.ShareSizeExceedsAvailableQuota() raise exception.ShareSizeExceedsAvailableQuota()
elif 'shares' in overs: elif 'shares' in overs:
msg = _("Quota exceeded for %(s_pid)s, tried to create " LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
"share (%(d_consumed)d shares " "share (%(d_consumed)d shares "
"already consumed)") "already consumed)"), {
LOG.warn(msg % {'s_pid': context.project_id, 's_pid': context.project_id,
'd_consumed': _consumed('shares')}) 'd_consumed': _consumed('shares')})
raise exception.ShareLimitExceeded(allowed=quotas['shares']) raise exception.ShareLimitExceeded(allowed=quotas['shares'])
if availability_zone is None: if availability_zone is None:
@ -218,7 +220,7 @@ class API(base.Base):
gigabytes=-share['size']) gigabytes=-share['size'])
except Exception: except Exception:
reservations = None reservations = None
LOG.exception(_("Failed to update quota for deleting share")) LOG.exception(_LE("Failed to update quota for deleting share"))
self.db.share_delete(context.elevated(), share_id) self.db.share_delete(context.elevated(), share_id)
if reservations: if reservations:
@ -274,20 +276,20 @@ class API(base.Base):
return (usages[name]['reserved'] + usages[name]['in_use']) return (usages[name]['reserved'] + usages[name]['in_use'])
if 'gigabytes' in overs: if 'gigabytes' in overs:
msg = _("Quota exceeded for %(s_pid)s, tried to create " msg = _LW("Quota exceeded for %(s_pid)s, tried to create "
"%(s_size)sG snapshot (%(d_consumed)dG of " "%(s_size)sG snapshot (%(d_consumed)dG of "
"%(d_quota)dG already consumed)") "%(d_quota)dG already consumed)")
LOG.warn(msg % {'s_pid': context.project_id, LOG.warn(msg, {'s_pid': context.project_id,
's_size': size, 's_size': size,
'd_consumed': _consumed('gigabytes'), 'd_consumed': _consumed('gigabytes'),
'd_quota': quotas['gigabytes']}) 'd_quota': quotas['gigabytes']})
raise exception.ShareSizeExceedsAvailableQuota() raise exception.ShareSizeExceedsAvailableQuota()
elif 'snapshots' in overs: elif 'snapshots' in overs:
msg = _("Quota exceeded for %(s_pid)s, tried to create " msg = _LW("Quota exceeded for %(s_pid)s, tried to create "
"snapshot (%(d_consumed)d snapshots " "snapshot (%(d_consumed)d snapshots "
"already consumed)") "already consumed)")
LOG.warn(msg % {'s_pid': context.project_id, LOG.warn(msg, {'s_pid': context.project_id,
'd_consumed': _consumed('snapshots')}) 'd_consumed': _consumed('snapshots')})
raise exception.SnapshotLimitExceeded( raise exception.SnapshotLimitExceeded(
allowed=quotas['snapshots']) allowed=quotas['snapshots'])
options = {'share_id': share['id'], options = {'share_id': share['id'],

View File

@ -20,7 +20,7 @@ Drivers for shares.
import time import time
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila import utils from manila import utils
@ -73,8 +73,8 @@ class ExecuteMixin(object):
tries += 1 tries += 1
if tries >= self.configuration.num_shell_tries: if tries >= self.configuration.num_shell_tries:
raise raise
LOG.exception(_("Recovering from a failed execute. " LOG.exception(_LE("Recovering from a failed execute. "
"Try number %s"), tries) "Try number %s"), tries)
time.sleep(tries ** 2) time.sleep(tries ** 2)

View File

@ -20,6 +20,8 @@ import six
from manila import db as manila_db from manila import db as manila_db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log from manila.openstack.common import log
from manila.share.drivers.emc.plugins import base as driver from manila.share.drivers.emc.plugins import base as driver
import manila.share.drivers.emc.plugins.registry import manila.share.drivers.emc.plugins.registry
@ -190,9 +192,9 @@ class VNXStorageConnection(driver.StorageConnection):
share_server=None): share_server=None):
"""Is called to remove share.""" """Is called to remove share."""
if share_server is None: if share_server is None:
LOG.warn(_("Driver does not support share deletion without share " LOG.warn(_LW("Driver does not support share deletion without "
"network specified. " "share network specified. "
"Return directly because there is nothing to clean")) "Return directly because there is nothing to clean"))
return return
if share['share_proto'].startswith('NFS'): if share['share_proto'].startswith('NFS'):
@ -212,7 +214,7 @@ class VNXStorageConnection(driver.StorageConnection):
mover_id = self._get_vdm_id(share_server) mover_id = self._get_vdm_id(share_server)
status, share_obj = self._XMLAPI_helper.get_cifs_share_by_name(name) status, share_obj = self._XMLAPI_helper.get_cifs_share_by_name(name)
if constants.STATUS_NOT_FOUND == status: if constants.STATUS_NOT_FOUND == status:
LOG.warn(_("CIFS share %s not found. Skip the deletion"), name) LOG.warn(_LW("CIFS share %s not found. Skip the deletion"), name)
else: else:
mover_id = share_obj['mover'] mover_id = share_obj['mover']
# Delete CIFS export # Delete CIFS export
@ -245,7 +247,7 @@ class VNXStorageConnection(driver.StorageConnection):
path, path,
mover_name) mover_name)
if constants.STATUS_NOT_FOUND == status: if constants.STATUS_NOT_FOUND == status:
LOG.warn(_("NFS share %s not found. Skip the deletion"), name) LOG.warn(_LW("NFS share %s not found. Skip the deletion"), name)
else: else:
# Delete NFS export if it is present # Delete NFS export if it is present
status, out = self._NASCmd_helper.delete_nfs_share( status, out = self._NASCmd_helper.delete_nfs_share(
@ -278,18 +280,17 @@ class VNXStorageConnection(driver.StorageConnection):
'true') 'true')
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
if self._XMLAPI_helper._is_mount_point_unexist_error(out): if self._XMLAPI_helper._is_mount_point_unexist_error(out):
LOG.warn(_("Mount point %(path)s on %(vdm)s not found."), LOG.warn(_LW("Mount point %(path)s on %(vdm)s not found."),
{'path': path, 'vdm': vdm_name}) {'path': path, 'vdm': vdm_name})
else: else:
msg = (_("Deleting mount point %(path)s on " LOG.warn(_LW("Deleting mount point %(path)s on "
"%(mover_name)s failed. Reason: %(err)s") "%(mover_name)s failed. Reason: %(err)s"),
% {'path': path, {'path': path,
'mover_name': vdm_name, 'mover_name': vdm_name,
'err': out}) 'err': out})
LOG.warn(msg)
else: else:
LOG.warn(_("Failed to find the VDM. Try to " LOG.warn(_LW("Failed to find the VDM. Try to "
"delete the file system")) "delete the file system"))
self._delete_filesystem(name) self._delete_filesystem(name)
@ -299,7 +300,7 @@ class VNXStorageConnection(driver.StorageConnection):
allow_absence=True) allow_absence=True)
if not filesystem: if not filesystem:
LOG.warn(_("File system %s not found. Skip the deletion"), name) LOG.warn(_LW("File system %s not found. Skip the deletion"), name)
return return
# Delete file system # Delete file system
@ -320,14 +321,12 @@ class VNXStorageConnection(driver.StorageConnection):
status, ckpt = self._XMLAPI_helper.get_check_point_by_name(ckpt_name) status, ckpt = self._XMLAPI_helper.get_check_point_by_name(ckpt_name)
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
message = _("Check point not found. Reason: %s.") % status LOG.warn(_LW("Check point not found. Reason: %s."), status)
LOG.warn(message)
return return
if ckpt['id'] == '': if ckpt['id'] == '':
message = _("Snapshot: %(name)s not found. " LOG.warn(_LW("Snapshot: %(name)s not found. "
"Skip the deletion.") % {'name': snapshot['name']} "Skip the deletion.") % {'name': snapshot['name']})
LOG.warn(message)
return return
status, out = self._XMLAPI_helper.delete_check_point(ckpt['id']) status, out = self._XMLAPI_helper.delete_check_point(ckpt['id'])
@ -566,8 +565,7 @@ class VNXStorageConnection(driver.StorageConnection):
except Exception as ex: except Exception as ex:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
message = _('Could not setup server. Reason: %s.') % ex LOG.error(_LE('Could not setup server. Reason: %s.'), ex)
LOG.error(message)
server_details = self._contruct_backend_details( server_details = self._contruct_backend_details(
vdm_name, vdmRef, interface_info) vdm_name, vdmRef, interface_info)
self.teardown_server(None, server_details, sec_services) self.teardown_server(None, server_details, sec_services)
@ -689,9 +687,8 @@ class VNXStorageConnection(driver.StorageConnection):
status, cifs_servers = self._XMLAPI_helper.get_cifs_servers( status, cifs_servers = self._XMLAPI_helper.get_cifs_servers(
vdm_id) vdm_id)
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
message = (_('Could not find CIFS server by name: %s.') LOG.error(_LE('Could not find CIFS server by name: %s.'),
% vdm_name) vdm_name)
LOG.error(message)
for server in cifs_servers: for server in cifs_servers:
# Unjoin CIFS Server from domain # Unjoin CIFS Server from domain
@ -735,8 +732,7 @@ class VNXStorageConnection(driver.StorageConnection):
status, out = self._XMLAPI_helper.list_storage_pool() status, out = self._XMLAPI_helper.list_storage_pool()
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
message = _("Could not get storage pool list.") LOG.error(_LE("Could not get storage pool list."))
LOG.error(message)
for pool in out: for pool in out:
if name == pool['name']: if name == pool['name']:
@ -863,9 +859,7 @@ class VNXStorageConnection(driver.StorageConnection):
def _get_mount_point_by_filesystem(self, filesystem, mover): def _get_mount_point_by_filesystem(self, filesystem, mover):
status, out = self._XMLAPI_helper.get_mount_point(mover['id']) status, out = self._XMLAPI_helper.get_mount_point(mover['id'])
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
message = (_("Could not get mount point. Reason: %s.") % out) LOG.error(_LE("Could not get mount point. Reason: %s."), out)
LOG.error(message)
for mount in out: for mount in out:
if mount['fs_id'] == filesystem['id']: if mount['fs_id'] == filesystem['id']:

View File

@ -23,6 +23,9 @@ from six.moves.urllib import request as url_request # pylint: disable=E0611
import manila.exception import manila.exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LI
from manila.i18n import _LW
from manila.openstack.common import lockutils from manila.openstack.common import lockutils
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.share.drivers.emc.plugins.vnx import constants from manila.share.drivers.emc.plugins.vnx import constants
@ -84,10 +87,10 @@ class XMLAPIConnector(object):
headers = six.text_type(resp.headers).replace('\n', '\\n') headers = six.text_type(resp.headers).replace('\n', '\\n')
if failed_req: if failed_req:
LOG.error( LOG.error(
_('REQ: [%(method)s] %(url)s %(req_hdrs)s\n' _LE('REQ: [%(method)s] %(url)s %(req_hdrs)s\n'
'REQ BODY: %(req_b)s\n' 'REQ BODY: %(req_b)s\n'
'RESP: [%(code)s] %(resp_hdrs)s\n' 'RESP: [%(code)s] %(resp_hdrs)s\n'
'RESP BODY: %(resp_b)s\n'), 'RESP BODY: %(resp_b)s\n'),
{ {
'method': failed_req.get_method(), 'method': failed_req.get_method(),
'url': failed_req.get_full_url(), 'url': failed_req.get_full_url(),
@ -171,8 +174,8 @@ class XMLAPIHelper(object):
else: else:
status = constants.STATUS_ERROR status = constants.STATUS_ERROR
LOG.warn(_("Translated status from %(old)s to %(new)s. " LOG.warn(_LW("Translated status from %(old)s to %(new)s. "
"Message: %(info)s."), "Message: %(info)s."),
{'old': status_before, {'old': status_before,
'new': status, 'new': status,
'info': info}) 'info': info})
@ -1154,7 +1157,7 @@ class SSHConnector(object):
greenthread.sleep(random.randint(20, 500) / 100.0) greenthread.sleep(random.randint(20, 500) / 100.0)
except Exception: except Exception:
LOG.error(_("Error running SSH command: %s"), command) LOG.error(_LE("Error running SSH command: %s"), command)
return stdout, stderr return stdout, stderr
@ -1187,8 +1190,8 @@ class NASCommandHelper(object):
lines = out.strip().split('\n') lines = out.strip().split('\n')
for line in lines: for line in lines:
if line.strip().split() == header: if line.strip().split() == header:
LOG.info(_('Found the header of the command ' LOG.info(_LI('Found the header of the command '
'/nas/bin/nas_cel -interconnect -l')) '/nas/bin/nas_cel -interconnect -l'))
else: else:
interconn = line.strip().split() interconn = line.strip().split()
if interconn[2] == src and interconn[4] == dest: if interconn[2] == src and interconn[4] == dest:

View File

@ -15,7 +15,7 @@
import types import types
import xml.dom.minidom import xml.dom.minidom
from manila.i18n import _ from manila.i18n import _LW
from manila.openstack.common import log from manila.openstack.common import log
@ -821,19 +821,18 @@ def one_child(tt, acceptable):
k = kids(tt) k = kids(tt)
if len(k) != 1: if len(k) != 1:
message = (_('Expected just one %(item)s, got %(more)s.') LOG.warn(_LW('Expected just one %(item)s, got %(more)s.'),
% {'item': acceptable, {'item': acceptable,
'more': " ".join([t[0] for t in k])}) 'more': " ".join([t[0] for t in k])})
LOG.warn(message)
child = k[0] child = k[0]
if name(child) not in acceptable: if name(child) not in acceptable:
message = (_('Expected one of %(item)s, got %(child)s ' LOG.warn(_LW('Expected one of %(item)s, got %(child)s '
'under %(parent)s.') 'under %(parent)s.'),
% {'item': acceptable, {'item': acceptable,
'child': name(child), 'child': name(child),
'parent': name(tt)}) 'parent': name(tt)})
return parse_any(child) return parse_any(child)
@ -852,8 +851,7 @@ def parse_any(tt):
fn_name = 'parse_' + node_name.lower() fn_name = 'parse_' + node_name.lower()
fn = globals().get(fn_name) fn = globals().get(fn_name)
if fn is None: if fn is None:
message = _('No parser for node type %s.') % name(tt) LOG.warn(_LW('No parser for node type %s.'), name(tt))
LOG.warn(message)
else: else:
return fn(tt) return fn(tt)
@ -880,9 +878,8 @@ def check_node(tt, nodename, required_attrs=None, optional_attrs=None,
required_attrs = [] required_attrs = []
if name(tt) != nodename: if name(tt) != nodename:
message = (_('Expected node type %(expected)s, not %(actual)s.') LOG.warn(_LW('Expected node type %(expected)s, not %(actual)s.'),
% {'expected': nodename, 'actual': name(tt)}) {'expected': nodename, 'actual': name(tt)})
LOG.warn(message)
# Check we have all the required attributes, and no unexpected ones # Check we have all the required attributes, and no unexpected ones
tt_attrs = {} tt_attrs = {}
@ -891,12 +888,11 @@ def check_node(tt, nodename, required_attrs=None, optional_attrs=None,
for attr in required_attrs: for attr in required_attrs:
if attr not in tt_attrs: if attr not in tt_attrs:
message = (_('Expected %(attr)s attribute on %(node)s node,' LOG.warn(_LW('Expected %(attr)s attribute on %(node)s node,'
' but only have %(attrs)s.') ' but only have %(attrs)s.'),
% {'attr': attr, {'attr': attr,
'node': name(tt), 'node': name(tt),
'attrs': attrs(tt).keys()}) 'attrs': attrs(tt).keys()})
LOG.warn(message)
else: else:
del tt_attrs[attr] del tt_attrs[attr]
@ -905,28 +901,25 @@ def check_node(tt, nodename, required_attrs=None, optional_attrs=None,
del tt_attrs[attr] del tt_attrs[attr]
if len(tt_attrs.keys()) > 0: if len(tt_attrs.keys()) > 0:
message = _('Invalid extra attributes %s.') % tt_attrs.keys() LOG.warn(_LW('Invalid extra attributes %s.'), tt_attrs.keys())
LOG.warn(message)
if allowed_children is not None: if allowed_children is not None:
for c in kids(tt): for c in kids(tt):
if name(c) not in allowed_children: if name(c) not in allowed_children:
message = (_('Unexpected node %(node)s under %(parent)s;' LOG.warn(_LW('Unexpected node %(node)s under %(parent)s;'
' wanted %(expected)s.') ' wanted %(expected)s.'),
% {'node': name(c), {'node': name(c),
'parent': name(tt), 'parent': name(tt),
'expected': allowed_children}) 'expected': allowed_children})
LOG.warn(message)
if not allow_pcdata: if not allow_pcdata:
for c in tt[2]: for c in tt[2]:
if isinstance(c, types.StringTypes): if isinstance(c, types.StringTypes):
if c.lstrip(' \t\n') != '': if c.lstrip(' \t\n') != '':
message = (_('Unexpected non-blank pcdata node %(node)s' LOG.warn(_LW('Unexpected non-blank pcdata node %(node)s'
' under %(parent)s.') ' under %(parent)s.'),
% {'node': repr(c), {'node': repr(c),
'parent': name(tt)}) 'parent': name(tt)})
LOG.warn(message)
def optional_child(tt, allowed): def optional_child(tt, allowed):
@ -935,10 +928,9 @@ def optional_child(tt, allowed):
k = kids(tt) k = kids(tt)
if len(k) > 1: if len(k) > 1:
message = (_('Expected either zero or one of %(node)s ' LOG.warn(_LW('Expected either zero or one of %(node)s '
'under %(parent)s.') % {'node': allowed, 'under %(parent)s.'), {'node': allowed,
'parent': tt}) 'parent': tt})
LOG.warn(message)
elif len(k) == 1: elif len(k) == 1:
return one_child(tt, allowed) return one_child(tt, allowed)
else: else:
@ -956,12 +948,11 @@ def list_of_various(tt, acceptable):
for child in kids(tt): for child in kids(tt):
if name(child) not in acceptable: if name(child) not in acceptable:
message = (_('Expected one of %(expected)s under' LOG.warn(_LW('Expected one of %(expected)s under'
' %(parent)s, got %(actual)s.') ' %(parent)s, got %(actual)s.'),
% {'expected': acceptable, {'expected': acceptable,
'parent': name(tt), 'parent': name(tt),
'actual': repr(name(child))}) 'actual': repr(name(child))})
LOG.warn(message)
result = parse_any(child) result = parse_any(child)
if result is not None: if result is not None:
r.append(result) r.append(result)

View File

@ -29,6 +29,8 @@ from manila import compute
from manila import context from manila import context
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import processutils from manila.openstack.common import processutils
from manila.share import driver from manila.share import driver
@ -221,14 +223,14 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
['sudo', 'cp', const.MOUNT_FILE_TEMP, const.MOUNT_FILE], ['sudo', 'cp', const.MOUNT_FILE_TEMP, const.MOUNT_FILE],
) )
except exception.ProcessExecutionError as e: except exception.ProcessExecutionError as e:
LOG.error(_("Failed to sync mount files on server '%s'."), LOG.error(_LE("Failed to sync mount files on server '%s'."),
server_details['instance_id']) server_details['instance_id'])
raise exception.ShareBackendException(msg=six.text_type(e)) raise exception.ShareBackendException(msg=six.text_type(e))
try: try:
# Remount it to avoid postponed point of failure # Remount it to avoid postponed point of failure
self._ssh_exec(server_details, ['sudo', 'mount', '-a']) self._ssh_exec(server_details, ['sudo', 'mount', '-a'])
except exception.ProcessExecutionError as e: except exception.ProcessExecutionError as e:
LOG.error(_("Failed to mount all shares on server '%s'."), LOG.error(_LE("Failed to mount all shares on server '%s'."),
server_details['instance_id']) server_details['instance_id'])
raise exception.ShareBackendException(msg=six.text_type(e)) raise exception.ShareBackendException(msg=six.text_type(e))
@ -261,8 +263,8 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
# Add mount permanently # Add mount permanently
self._sync_mount_temp_and_perm_files(server_details) self._sync_mount_temp_and_perm_files(server_details)
else: else:
LOG.warning(_("Mount point '%(path)s' already exists on " LOG.warning(_LW("Mount point '%(path)s' already exists on "
"server '%(server)s'."), log_data) "server '%(server)s'."), log_data)
except exception.ProcessExecutionError as e: except exception.ProcessExecutionError as e:
raise exception.ShareBackendException(msg=six.text_type(e)) raise exception.ShareBackendException(msg=six.text_type(e))
return _mount_device_with_lock() return _mount_device_with_lock()
@ -287,8 +289,8 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
# Remove mount permanently # Remove mount permanently
self._sync_mount_temp_and_perm_files(server_details) self._sync_mount_temp_and_perm_files(server_details)
else: else:
LOG.warning(_("Mount point '%(path)s' does not exist on " LOG.warning(_LW("Mount point '%(path)s' does not exist on "
"server '%(server)s'."), log_data) "server '%(server)s'."), log_data)
return _unmount_device_with_lock() return _unmount_device_with_lock()
def _get_mount_path(self, share): def _get_mount_path(self, share):
@ -600,8 +602,8 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
def teardown_server(self, server_details, security_services=None): def teardown_server(self, server_details, security_services=None):
instance_id = server_details.get("instance_id") instance_id = server_details.get("instance_id")
msg = "Removing share infrastructure for service instance '%s'." LOG.debug("Removing share infrastructure for service instance '%s'.",
LOG.debug(msg % instance_id) instance_id)
try: try:
self.service_instance_manager.delete_service_instance( self.service_instance_manager.delete_service_instance(
self.admin_context, self.admin_context,
@ -786,8 +788,8 @@ class CIFSHelper(NASHelperBase):
self._ssh_exec( self._ssh_exec(
server, ['sudo', 'net', 'conf', 'delshare', share_name]) server, ['sudo', 'net', 'conf', 'delshare', share_name])
except exception.ProcessExecutionError as e: except exception.ProcessExecutionError as e:
LOG.warning(_("Caught error trying delete share: %(error)s, try" LOG.warning(_LW("Caught error trying delete share: %(error)s, try"
"ing delete it forcibly."), {'error': e.stderr}) "ing delete it forcibly."), {'error': e.stderr})
self._ssh_exec(server, ['sudo', 'smbcontrol', 'all', 'close-share', self._ssh_exec(server, ['sudo', 'smbcontrol', 'all', 'close-share',
share_name]) share_name])

View File

@ -31,6 +31,8 @@ import xml.etree.cElementTree as etree
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LW
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.share import driver from manila.share import driver
@ -127,7 +129,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
try: try:
self._execute(*args, **kw) self._execute(*args, **kw)
except exception.ProcessExecutionError as exc: except exception.ProcessExecutionError as exc:
LOG.error(_("Error in gluster volume set: %s"), exc.stderr) LOG.error(_LE("Error in gluster volume set: %s"), exc.stderr)
raise raise
def check_for_setup_error(self): def check_for_setup_error(self):
@ -148,7 +150,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
self._execute(*cmd, run_as_root=True) self._execute(*cmd, run_as_root=True)
except exception.ProcessExecutionError as exc: except exception.ProcessExecutionError as exc:
if ensure and 'already mounted' in exc.stderr: if ensure and 'already mounted' in exc.stderr:
LOG.warn(_("%s is already mounted"), LOG.warn(_LW("%s is already mounted"),
self.gluster_address.export) self.gluster_address.export)
else: else:
raise exception.GlusterfsException( raise exception.GlusterfsException(
@ -173,7 +175,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
) )
out, err = self._execute(*args, **kw) out, err = self._execute(*args, **kw)
except exception.ProcessExecutionError as exc: except exception.ProcessExecutionError as exc:
LOG.error(_("Error retrieving volume info: %s"), exc.stderr) LOG.error(_LE("Error retrieving volume info: %s"), exc.stderr)
raise raise
if not out: if not out:
@ -212,7 +214,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
try: try:
self._mount_gluster_vol(mount_path, ensure=True) self._mount_gluster_vol(mount_path, ensure=True)
except exception.GlusterfsException: except exception.GlusterfsException:
LOG.error('Could not mount the Gluster volume %s', LOG.error(_LE('Could not mount the Gluster volume %s'),
self.gluster_address.volume) self.gluster_address.volume)
raise raise
@ -270,7 +272,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
try: try:
self._execute(*cmd, run_as_root=True) self._execute(*cmd, run_as_root=True)
except exception.ProcessExecutionError: except exception.ProcessExecutionError:
LOG.error('Unable to create share %s', share['name']) LOG.error(_LE('Unable to create share %s'), share['name'])
raise raise
export_location = os.path.join(self.gluster_address.qualified, export_location = os.path.join(self.gluster_address.qualified,
@ -284,7 +286,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
try: try:
self._execute(*cmd, run_as_root=True) self._execute(*cmd, run_as_root=True)
except exception.ProcessExecutionError: except exception.ProcessExecutionError:
LOG.error('Unable to delete share %s', share['name']) LOG.error(_LE('Unable to delete share %s'), share['name'])
raise raise
def create_snapshot(self, context, snapshot, share_server=None): def create_snapshot(self, context, snapshot, share_server=None):
@ -343,7 +345,7 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
try: try:
self._execute(*args, **kw) self._execute(*args, **kw)
except exception.ProcessExecutionError as exc: except exception.ProcessExecutionError as exc:
LOG.error(_("Error in gluster volume set: %s"), exc.stderr) LOG.error(_LE("Error in gluster volume set: %s"), exc.stderr)
raise raise
def allow_access(self, context, share, access, share_server=None): def allow_access(self, context, share, access, share_server=None):

View File

@ -35,6 +35,7 @@ import six
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.share import driver from manila.share import driver
from manila.share.drivers import glusterfs from manila.share.drivers import glusterfs
@ -99,8 +100,8 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
LOG.error(msg) LOG.error(msg)
raise exception.GlusterfsException(msg) raise exception.GlusterfsException(msg)
LOG.info(_("Number of gluster volumes read from config: " LOG.info(_LI("Number of gluster volumes read from config: "
"%(numvols)s"), "%(numvols)s"),
{'numvols': len(self.configuration.glusterfs_targets)}) {'numvols': len(self.configuration.glusterfs_targets)})
try: try:
@ -126,9 +127,9 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
"with in the glusterfs_targets configuration parameter.")) "with in the glusterfs_targets configuration parameter."))
LOG.warn(msg) LOG.warn(msg)
else: else:
LOG.info(_("Number of gluster volumes in use: %(inuse-numvols)s. " LOG.info(_LI("Number of gluster volumes in use: "
"Number of gluster volumes available for use as share: " "%(inuse-numvols)s. Number of gluster volumes "
"%(unused-numvols)s"), "available for use as share: %(unused-numvols)s"),
{'inuse-numvols': len(self.gluster_used_vols_dict), {'inuse-numvols': len(self.gluster_used_vols_dict),
'unused-numvols': len(self.gluster_unused_vols_dict)}) 'unused-numvols': len(self.gluster_unused_vols_dict)})
@ -390,8 +391,8 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
# For native protocol, the export_location should be of the form: # For native protocol, the export_location should be of the form:
# server:/volname # server:/volname
LOG.info(_("export_location sent back from create_share: %s"), LOG.info(_LI("export_location sent back from create_share: %s"),
(export_location,)) (export_location,))
return export_location return export_location
def delete_share(self, context, share, share_server=None): def delete_share(self, context, share, share_server=None):

View File

@ -31,6 +31,8 @@ import six
from manila import context from manila import context
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LI
from manila.openstack.common import log from manila.openstack.common import log
from manila.share import driver from manila.share import driver
from manila.share.drivers.netapp import api as naapi from manila.share.drivers.netapp import api as naapi
@ -163,7 +165,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
try: try:
licenses = self._client.send_request('license-v2-list-info') licenses = self._client.send_request('license-v2-list-info')
except naapi.NaApiError as e: except naapi.NaApiError as e:
LOG.error(_("Could not get licenses list. %s."), e) LOG.error(_LE("Could not get licenses list. %s."), e)
else: else:
self._licenses = sorted([ self._licenses = sorted([
l.get_child_content('package').lower() l.get_child_content('package').lower()
@ -173,8 +175,8 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
'backend': self.backend_name, 'backend': self.backend_name,
'licenses': ', '.join(self._licenses), 'licenses': ', '.join(self._licenses),
} }
LOG.info(_("Available licenses on '%(backend)s' " LOG.info(_LI("Available licenses on '%(backend)s' "
"are %(licenses)s."), log_data) "are %(licenses)s."), log_data)
return self._licenses return self._licenses
def _get_valid_share_name(self, share_id): def _get_valid_share_name(self, share_id):
@ -407,7 +409,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
ip, netmask, vserver_client) ip, netmask, vserver_client)
except naapi.NaApiError: except naapi.NaApiError:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Failed to create network interface")) LOG.error(_LE("Failed to create network interface"))
self._delete_vserver(vserver_name, vserver_client) self._delete_vserver(vserver_name, vserver_client)
self._enable_nfs(vserver_client) self._enable_nfs(vserver_client)
@ -488,7 +490,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
vserver_client.send_request('net-dns-create', args) vserver_client.send_request('net-dns-create', args)
except naapi.NaApiError as e: except naapi.NaApiError as e:
if e.code == '13130': if e.code == '13130':
LOG.error(_("DNS exists for vserver.")) LOG.error(_LE("DNS exists for vserver."))
else: else:
raise exception.NetAppException( raise exception.NetAppException(
_("Failed to configure DNS. %s") % e.message) _("Failed to configure DNS. %s") % e.message)
@ -709,7 +711,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
self._remove_export(share, vserver_client) self._remove_export(share, vserver_client)
self._deallocate_container(share, vserver_client) self._deallocate_container(share, vserver_client)
else: else:
LOG.info(_("Share %s does not exist."), share['id']) LOG.info(_LI("Share %s does not exist."), share['id'])
def _create_export(self, share, vserver, vserver_client): def _create_export(self, share, vserver, vserver_client):
"""Creates NAS storage.""" """Creates NAS storage."""
@ -819,7 +821,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
Deletes vserver. Deletes vserver.
""" """
if not self._vserver_exists(vserver_name): if not self._vserver_exists(vserver_name):
LOG.error(_("Vserver %s does not exist."), vserver_name) LOG.error(_LE("Vserver %s does not exist."), vserver_name)
return return
volumes_data = vserver_client.send_request('volume-get-iter') volumes_data = vserver_client.send_request('volume-get-iter')
volumes_count = int(volumes_data.get_child_content('num-records')) volumes_count = int(volumes_data.get_child_content('num-records'))
@ -830,7 +832,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
{'name': self.configuration.netapp_root_volume_name}) {'name': self.configuration.netapp_root_volume_name})
except naapi.NaApiError as e: except naapi.NaApiError as e:
if e.code == '13042': if e.code == '13042':
LOG.error(_("Volume %s is already offline."), LOG.error(_LE("Volume %s is already offline."),
self.configuration.netapp_root_volume_name) self.configuration.netapp_root_volume_name)
else: else:
raise e raise e
@ -854,8 +856,8 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
args) args)
except naapi.NaApiError as e: except naapi.NaApiError as e:
if e.code == "15661": if e.code == "15661":
LOG.error(_("CIFS server does not exist for" LOG.error(_LE("CIFS server does not exist for"
" vserver %s"), vserver_name) " vserver %s"), vserver_name)
else: else:
vserver_client.send_request('cifs-server-delete') vserver_client.send_request('cifs-server-delete')
self._client.send_request('vserver-destroy', self._client.send_request('vserver-destroy',
@ -1182,9 +1184,9 @@ class NetAppClusteredCIFSHelper(NetAppNASHelperBase):
self._restrict_access(user, share_name) self._restrict_access(user, share_name)
except naapi.NaApiError as e: except naapi.NaApiError as e:
if e.code == "22": if e.code == "22":
LOG.error(_("User %s does not exist."), user) LOG.error(_LE("User %s does not exist."), user)
elif e.code == "15661": elif e.code == "15661":
LOG.error(_("Rule %s does not exist."), user) LOG.error(_LE("Rule %s does not exist."), user)
else: else:
raise e raise e

View File

@ -30,6 +30,7 @@ from manila import compute
from manila import context from manila import context
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LW
from manila.network.linux import ip_lib from manila.network.linux import ip_lib
from manila.network.neutron import api as neutron from manila.network.neutron import api as neutron
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -220,8 +221,8 @@ class ServiceInstanceManager(object):
name = name or self.get_config_option( name = name or self.get_config_option(
"service_instance_security_group") "service_instance_security_group")
if not name: if not name:
LOG.warning(_("Name for service instance security group is not " LOG.warning(_LW("Name for service instance security group is not "
"provided. Skipping security group step.")) "provided. Skipping security group step."))
return None return None
s_groups = [s for s in self.compute_api.security_group_list(context) s_groups = [s for s in self.compute_api.security_group_list(context)
if s.name == name] if s.name == name]
@ -255,7 +256,7 @@ class ServiceInstanceManager(object):
inst = self.compute_api.server_get(self.admin_context, inst = self.compute_api.server_get(self.admin_context,
server['instance_id']) server['instance_id'])
except exception.InstanceNotFound: except exception.InstanceNotFound:
LOG.warning(_("Service instance %s does not exist."), LOG.warning(_LW("Service instance %s does not exist."),
server['instance_id']) server['instance_id'])
return False return False
if inst['status'] == 'ACTIVE': if inst['status'] == 'ACTIVE':
@ -378,12 +379,13 @@ class ServiceInstanceManager(object):
'private_path': self.path_to_private_key, 'private_path': self.path_to_private_key,
'public_path': self.path_to_public_key, 'public_path': self.path_to_public_key,
} }
LOG.warning(_('No key path is available. May be non-existent ' LOG.warning(_LW('No key path is available. May be '
'key path is provided. Check path_to_private_key' 'non-existent key path is provided. Check '
' (current value %(private_path)s) and ' 'path_to_private_key (current value '
'path_to_public_key (current value ' '%(private_path)s) and '
'%(public_path)s) in manila ' 'path_to_public_key (current value '
'configuration file.') % str_params) '%(public_path)s) in manila '
'configuration file.'), str_params)
security_group = self._get_or_create_security_group(context) security_group = self._get_or_create_security_group(context)
network_data = self._setup_network_for_instance(neutron_net_id, network_data = self._setup_network_for_instance(neutron_net_id,

View File

@ -28,7 +28,8 @@ import six
from manila.common import constants from manila.common import constants
from manila import context from manila import context
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _LE
from manila.i18n import _LI
from manila import manager from manila import manager
from manila import network from manila import network
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
@ -88,8 +89,8 @@ class ShareManager(manager.SchedulerDependentManager):
ctxt, share, share_server=share_server) ctxt, share, share_server=share_server)
except Exception as e: except Exception as e:
LOG.error( LOG.error(
_("Caught exception trying ensure share '%(s_id)s'. " _LE("Caught exception trying ensure share '%(s_id)s'. "
"Exception: \n%(e)s."), "Exception: \n%(e)s."),
{'s_id': share['id'], 'e': six.text_type(e)}, {'s_id': share['id'], 'e': six.text_type(e)},
) )
continue continue
@ -105,11 +106,11 @@ class ShareManager(manager.SchedulerDependentManager):
pass pass
except Exception as e: except Exception as e:
LOG.error( LOG.error(
_("Unexpected exception during share access" _LE("Unexpected exception during share access"
" allow operation. Share id is '%(s_id)s'" " allow operation. Share id is '%(s_id)s'"
", access rule type is '%(ar_type)s', " ", access rule type is '%(ar_type)s', "
"access rule id is '%(ar_id)s', exception" "access rule id is '%(ar_id)s', exception"
" is '%(e)s'."), " is '%(e)s'."),
{'s_id': share['id'], {'s_id': share['id'],
'ar_type': access_ref['access_type'], 'ar_type': access_ref['access_type'],
'ar_id': access_ref['id'], 'ar_id': access_ref['id'],
@ -117,8 +118,8 @@ class ShareManager(manager.SchedulerDependentManager):
) )
else: else:
LOG.info( LOG.info(
_("Share %(name)s: skipping export, because it has " _LI("Share %(name)s: skipping export, because it has "
"'%(status)s' status."), "'%(status)s' status."),
{'name': share['name'], 'status': share['status']}, {'name': share['name'], 'status': share['status']},
) )
@ -171,10 +172,11 @@ class ShareManager(manager.SchedulerDependentManager):
if not exist: if not exist:
# Create share server on backend with data from db # Create share server on backend with data from db
share_server = self._setup_server(context, share_server) share_server = self._setup_server(context, share_server)
LOG.info(_("Share server created successfully.")) LOG.info(_LI("Share server created successfully."))
else: else:
LOG.info(_("Used already existed share server '%(share_server" LOG.info(_LI("Used already existed share server "
"_id)s'"), {'share_server_id': share_server['id']}) "'%(share_server_id)s'"),
{'share_server_id': share_server['id']})
return share_server, share_ref return share_server, share_ref
return _provide_share_server_for_share() return _provide_share_server_for_share()
@ -213,7 +215,7 @@ class ShareManager(manager.SchedulerDependentManager):
context, share_id, {'share_server_id': share_server['id']}) context, share_id, {'share_server_id': share_server['id']})
except exception.ShareServerNotFound: except exception.ShareServerNotFound:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Share server %s does not exist."), LOG.error(_LE("Share server %s does not exist."),
parent_share_server_id) parent_share_server_id)
self.db.share_update(context, share_id, self.db.share_update(context, share_id,
{'status': 'error'}) {'status': 'error'})
@ -223,8 +225,8 @@ class ShareManager(manager.SchedulerDependentManager):
context, share_network_id, share_id) context, share_network_id, share_id)
except Exception: except Exception:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Failed to get share server" LOG.error(_LE("Failed to get share server"
" for share creation.")) " for share creation."))
self.db.share_update(context, share_id, self.db.share_update(context, share_id,
{'status': 'error'}) {'status': 'error'})
else: else:
@ -242,10 +244,10 @@ class ShareManager(manager.SchedulerDependentManager):
{'export_location': export_location}) {'export_location': export_location})
except Exception: except Exception:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Share %s failed on creation."), share_id) LOG.error(_LE("Share %s failed on creation."), share_id)
self.db.share_update(context, share_id, {'status': 'error'}) self.db.share_update(context, share_id, {'status': 'error'})
else: else:
LOG.info(_("Share created successfully.")) LOG.info(_LI("Share created successfully."))
self.db.share_update(context, share_id, self.db.share_update(context, share_id,
{'status': 'available', {'status': 'available',
'launched_at': timeutils.utcnow()}) 'launched_at': timeutils.utcnow()})
@ -277,10 +279,10 @@ class ShareManager(manager.SchedulerDependentManager):
gigabytes=-share_ref['size']) gigabytes=-share_ref['size'])
except Exception: except Exception:
reservations = None reservations = None
LOG.exception(_("Failed to update usages deleting share")) LOG.exception(_LE("Failed to update usages deleting share"))
self.db.share_delete(context, share_id) self.db.share_delete(context, share_id)
LOG.info(_("Share %s: deleted successfully."), share_ref['name']) LOG.info(_LI("Share %s: deleted successfully."), share_ref['name'])
if reservations: if reservations:
QUOTAS.commit(context, reservations, project_id=project_id) QUOTAS.commit(context, reservations, project_id=project_id)
@ -351,7 +353,7 @@ class ShareManager(manager.SchedulerDependentManager):
gigabytes=-snapshot_ref['size']) gigabytes=-snapshot_ref['size'])
except Exception: except Exception:
reservations = None reservations = None
LOG.exception(_("Failed to update usages deleting snapshot")) LOG.exception(_LE("Failed to update usages deleting snapshot"))
if reservations: if reservations:
QUOTAS.commit(context, reservations, project_id=project_id) QUOTAS.commit(context, reservations, project_id=project_id)
@ -394,7 +396,7 @@ class ShareManager(manager.SchedulerDependentManager):
@manager.periodic_task @manager.periodic_task
def _report_driver_status(self, context): def _report_driver_status(self, context):
LOG.info(_('Updating share status')) LOG.info(_LI('Updating share status'))
share_stats = self.driver.get_share_stats(refresh=True) share_stats = self.driver.get_share_stats(refresh=True)
if share_stats: if share_stats:
self.update_service_capabilities(share_stats) self.update_service_capabilities(share_stats)
@ -480,7 +482,7 @@ class ShareManager(manager.SchedulerDependentManager):
security_services=sec_services) security_services=sec_services)
except Exception: except Exception:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Share server %s failed on deletion."), LOG.error(_LE("Share server %s failed on deletion."),
share_server['id']) share_server['id'])
self.db.share_server_update( self.db.share_server_update(
context, share_server['id'], context, share_server['id'],
@ -489,5 +491,5 @@ class ShareManager(manager.SchedulerDependentManager):
self.db.share_server_delete(context, share_server['id']) self.db.share_server_delete(context, share_server['id'])
_teardown_server() _teardown_server()
LOG.info(_("Share server deleted successfully.")) LOG.info(_LI("Share server deleted successfully."))
self.network_api.deallocate_network(context, share_server) self.network_api.deallocate_network(context, share_server)

View File

@ -23,6 +23,7 @@ from manila import context
from manila import db from manila import db
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LE
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
CONF = cfg.CONF CONF = cfg.CONF
@ -36,7 +37,7 @@ def create(context, name, extra_specs={}):
dict(name=name, dict(name=name,
extra_specs=extra_specs)) extra_specs=extra_specs))
except db_exception.DBError as e: except db_exception.DBError as e:
LOG.exception(_('DB error: %s'), e) LOG.exception(_LE('DB error: %s'), e)
raise exception.VolumeTypeCreateFailed(name=name, raise exception.VolumeTypeCreateFailed(name=name,
extra_specs=extra_specs) extra_specs=extra_specs)
return type_ref return type_ref
@ -122,8 +123,9 @@ def get_default_volume_type():
# Couldn't find volume type with the name in default_volume_type # Couldn't find volume type with the name in default_volume_type
# flag, record this issue and move on # flag, record this issue and move on
# TODO(zhiteng) consider add notification to warn admin # TODO(zhiteng) consider add notification to warn admin
LOG.exception(_('Default volume type is not found, ' LOG.exception(_LE('Default volume type is not found, '
'please check default_volume_type config: %s'), e) 'please check default_volume_type config: %s'),
e)
return vol_type return vol_type

View File

@ -38,6 +38,7 @@ import webob.exc
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.i18n import _LI
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
socket_opts = [ socket_opts = [
@ -216,7 +217,7 @@ class Server(object):
backlog=backlog) backlog=backlog)
self._server = eventlet.spawn(self._start) self._server = eventlet.spawn(self._start)
(self._host, self._port) = self._socket.getsockname()[0:2] (self._host, self._port) = self._socket.getsockname()[0:2]
LOG.info(_("Started %(name)s on %(_host)s:%(_port)s"), self.__dict__) LOG.info(_LI("Started %(name)s on %(_host)s:%(_port)s"), self.__dict__)
@property @property
def host(self): def host(self):
@ -235,7 +236,7 @@ class Server(object):
:returns: None :returns: None
""" """
LOG.info(_("Stopping WSGI server.")) LOG.info(_LI("Stopping WSGI server."))
self._server.kill() self._server.kill()
def wait(self): def wait(self):
@ -249,7 +250,7 @@ class Server(object):
try: try:
self._server.wait() self._server.wait()
except greenlet.GreenletExit: except greenlet.GreenletExit:
LOG.info(_("WSGI server has stopped.")) LOG.info(_LI("WSGI server has stopped."))
class Request(webob.Request): class Request(webob.Request):