Remove log translations in api 1/5
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. This is the 1/5 commit. Old commit will be abandoned: https://review.openstack.org/#/c/447822/ See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I9fd264a443c634465b8548067f86ac14c1a51faa Partial-Bug: #1674542
This commit is contained in:
parent
ed19930c72
commit
d510ee8f92
|
@ -17,22 +17,21 @@
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from manila.api.middleware import auth
|
from manila.api.middleware import auth
|
||||||
from manila.i18n import _LW
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ManilaKeystoneContext(auth.ManilaKeystoneContext):
|
class ManilaKeystoneContext(auth.ManilaKeystoneContext):
|
||||||
def __init__(self, application):
|
def __init__(self, application):
|
||||||
LOG.warning(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. '
|
LOG.warning('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.warning(_LW('manila.api.auth:pipeline_factory is deprecated. '
|
LOG.warning('manila.api.auth:pipeline_factory is deprecated. '
|
||||||
'Please use manila.api.middleware.auth:pipeline_factory '
|
'Please use manila.api.middleware.auth:pipeline_factory '
|
||||||
'instead.'))
|
'instead.')
|
||||||
auth.pipeline_factory(loader, global_conf, **local_conf)
|
auth.pipeline_factory(loader, global_conf, **local_conf)
|
||||||
|
|
|
@ -25,7 +25,6 @@ import webob.exc
|
||||||
import manila.api.openstack
|
import manila.api.openstack
|
||||||
from manila.api.openstack import wsgi
|
from manila.api.openstack import wsgi
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _LE, _LI, _LW
|
|
||||||
import manila.policy
|
import manila.policy
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -122,7 +121,7 @@ class ExtensionManager(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
LOG.info(_LI('Initializing extension manager.'))
|
LOG.info('Initializing extension manager.')
|
||||||
|
|
||||||
self.cls_list = CONF.osapi_share_extension
|
self.cls_list = CONF.osapi_share_extension
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ class ExtensionManager(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
alias = ext.alias
|
alias = ext.alias
|
||||||
LOG.info(_LI('Loaded extension: %s'), alias)
|
LOG.info('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)
|
||||||
|
@ -182,7 +181,7 @@ class ExtensionManager(object):
|
||||||
' '.join(extension.__doc__.strip().split()))
|
' '.join(extension.__doc__.strip().split()))
|
||||||
LOG.debug('Ext updated: %s', extension.updated)
|
LOG.debug('Ext updated: %s', extension.updated)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
LOG.exception(_LE("Exception loading extension."))
|
LOG.exception("Exception loading extension.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -216,11 +215,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.warning(_LW('osapi_share_extension is set to deprecated path: '
|
LOG.warning('osapi_share_extension is set to deprecated path: '
|
||||||
'%s.'),
|
'%s.',
|
||||||
old_contrib_path)
|
old_contrib_path)
|
||||||
LOG.warning(_LW('Please set your flag or manila.conf settings for '
|
LOG.warning('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]
|
||||||
|
|
||||||
|
@ -228,8 +227,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.warning(_LW('Failed to load extension %(ext_factory)s: '
|
LOG.warning('Failed to load extension %(ext_factory)s: '
|
||||||
'%(exc)s.'),
|
'%(exc)s.',
|
||||||
{"ext_factory": ext_factory, "exc": exc})
|
{"ext_factory": ext_factory, "exc": exc})
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,8 +296,8 @@ 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.warning(_LW('Failed to load extension %(classpath)s: '
|
logger.warning('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...
|
||||||
|
@ -322,8 +321,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.warning(_LW('Failed to load extension '
|
logger.warning('Failed to load extension '
|
||||||
'%(ext_name)s: %(exc)s.'),
|
'%(ext_name)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...
|
||||||
|
|
|
@ -20,7 +20,6 @@ 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 _LE, _LI
|
|
||||||
from manila import utils
|
from manila import utils
|
||||||
from manila import wsgi as base_wsgi
|
from manila import wsgi as base_wsgi
|
||||||
|
|
||||||
|
@ -41,7 +40,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(_LE("Caught error: %s"), inner)
|
LOG.exception("Caught error: %s", inner)
|
||||||
|
|
||||||
safe = getattr(inner, 'safe', False)
|
safe = getattr(inner, 'safe', False)
|
||||||
headers = getattr(inner, 'headers', None)
|
headers = getattr(inner, 'headers', None)
|
||||||
|
@ -50,7 +49,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(_LI("%(url)s returned with HTTP %(status)d"), msg_dict)
|
LOG.info("%(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
|
||||||
|
|
|
@ -22,7 +22,7 @@ from oslo_log import log
|
||||||
import routes
|
import routes
|
||||||
|
|
||||||
from manila.api.openstack import wsgi
|
from manila.api.openstack import wsgi
|
||||||
from manila.i18n import _, _LW
|
from manila.i18n import _
|
||||||
from manila import wsgi as base_wsgi
|
from manila import wsgi as base_wsgi
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -102,8 +102,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(_LW('Extension %(ext_name)s: Cannot extend '
|
LOG.warning('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
|
||||||
|
|
||||||
|
@ -121,9 +121,9 @@ class APIRouter(base_wsgi.Router):
|
||||||
|
|
||||||
class FaultWrapper(base_wsgi.Middleware):
|
class FaultWrapper(base_wsgi.Middleware):
|
||||||
def __init__(self, application):
|
def __init__(self, application):
|
||||||
LOG.warning(_LW('manila.api.openstack:FaultWrapper is deprecated. '
|
LOG.warning('manila.api.openstack:FaultWrapper is deprecated. '
|
||||||
'Please use '
|
'Please use '
|
||||||
'manila.api.middleware.fault:FaultWrapper instead.'))
|
'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))
|
||||||
|
|
|
@ -17,13 +17,12 @@
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from manila.api import urlmap
|
from manila.api import urlmap
|
||||||
from manila.i18n import _LW
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def urlmap_factory(loader, global_conf, **local_conf):
|
def urlmap_factory(loader, global_conf, **local_conf):
|
||||||
LOG.warning(_LW('manila.api.openstack.urlmap:urlmap_factory '
|
LOG.warning('manila.api.openstack.urlmap:urlmap_factory '
|
||||||
'is deprecated. '
|
'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)
|
||||||
|
|
|
@ -29,7 +29,7 @@ from manila.api.openstack import api_version_request as api_version
|
||||||
from manila.api.openstack import versioned_method
|
from manila.api.openstack import versioned_method
|
||||||
from manila.common import constants
|
from manila.common import constants
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LE, _LI
|
from manila.i18n import _
|
||||||
from manila import policy
|
from manila import policy
|
||||||
from manila import wsgi
|
from manila import wsgi
|
||||||
|
|
||||||
|
@ -524,14 +524,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(_LE('Exception handling resource: %s'),
|
LOG.error('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(_LI("Fault thrown: %s"), ex_value)
|
LOG.info("Fault thrown: %s", ex_value)
|
||||||
raise ex_value
|
raise ex_value
|
||||||
elif isinstance(ex_value, webob.exc.HTTPException):
|
elif isinstance(ex_value, webob.exc.HTTPException):
|
||||||
LOG.info(_LI("HTTP exception thrown: %s"), ex_value)
|
LOG.info("HTTP exception thrown: %s", ex_value)
|
||||||
raise Fault(ex_value)
|
raise Fault(ex_value)
|
||||||
|
|
||||||
# We didn't handle the exception
|
# We didn't handle the exception
|
||||||
|
@ -732,8 +732,8 @@ class Resource(wsgi.Application):
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
"""WSGI method that controls (de)serialization and method dispatch."""
|
"""WSGI method that controls (de)serialization and method dispatch."""
|
||||||
|
|
||||||
LOG.info(_LI("%(method)s %(url)s") % {"method": request.method,
|
LOG.info("%(method)s %(url)s" % {"method": request.method,
|
||||||
"url": request.url})
|
"url": request.url})
|
||||||
if self.support_api_request_version:
|
if self.support_api_request_version:
|
||||||
# Set the version of the API requested based on the header
|
# Set the version of the API requested based on the header
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -25,7 +25,7 @@ from manila.api.views import security_service as security_service_views
|
||||||
from manila.common import constants
|
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 _, _LI
|
from manila.i18n import _
|
||||||
from manila import policy
|
from manila import policy
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,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(_LI("Delete security service with id: %s"),
|
LOG.info("Delete security service with id: %s",
|
||||||
id, context=context)
|
id, context=context)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -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 import db
|
from manila import db
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LI
|
from manila.i18n import _
|
||||||
from manila import share
|
from manila import share
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -61,7 +61,7 @@ class ShareSnapshotMixin(object):
|
||||||
"""Delete a snapshot."""
|
"""Delete a snapshot."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
|
|
||||||
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
|
LOG.info("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)
|
||||||
|
@ -169,7 +169,7 @@ class ShareSnapshotMixin(object):
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exc.HTTPUnprocessableEntity(explanation=msg)
|
raise exc.HTTPUnprocessableEntity(explanation=msg)
|
||||||
|
|
||||||
LOG.info(_LI("Create snapshot from share %s"),
|
LOG.info("Create snapshot from share %s",
|
||||||
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
|
||||||
|
|
|
@ -20,7 +20,7 @@ from webob import exc
|
||||||
from manila.api.openstack import wsgi
|
from manila.api.openstack import wsgi
|
||||||
from manila.common import constants
|
from manila.common import constants
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LI
|
from manila.i18n import _
|
||||||
from manila import share
|
from manila import share
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -33,7 +33,7 @@ class ShareUnmanageMixin(object):
|
||||||
"""Unmanage a share."""
|
"""Unmanage a share."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
|
|
||||||
LOG.info(_LI("Unmanage share with id: %s"), id, context=context)
|
LOG.info("Unmanage share with id: %s", id, context=context)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
share = self.share_api.get(context, id)
|
share = self.share_api.get(context, id)
|
||||||
|
|
|
@ -31,7 +31,7 @@ from manila.api.views import shares as share_views
|
||||||
from manila.common import constants
|
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 _, _LI
|
from manila.i18n import _
|
||||||
from manila import share
|
from manila import share
|
||||||
from manila.share import share_types
|
from manila.share import share_types
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class ShareMixin(object):
|
||||||
"""Delete a share."""
|
"""Delete a share."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
|
|
||||||
LOG.info(_LI("Delete share with id: %s"), id, context=context)
|
LOG.info("Delete share with id: %s", id, context=context)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
share = self.share_api.get(context, id)
|
share = self.share_api.get(context, id)
|
||||||
|
@ -219,7 +219,7 @@ class ShareMixin(object):
|
||||||
size = share['size']
|
size = share['size']
|
||||||
share_proto = share['share_proto'].upper()
|
share_proto = share['share_proto'].upper()
|
||||||
|
|
||||||
msg = (_LI("Create %(share_proto)s share of %(size)s GB") %
|
msg = ("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)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ from manila.api.openstack import wsgi
|
||||||
import manila.api.views.share_group_snapshots as share_group_snapshots_views
|
import manila.api.views.share_group_snapshots as share_group_snapshots_views
|
||||||
from manila import db
|
from manila import db
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LI
|
from manila.i18n import _
|
||||||
import manila.share_group.api as share_group_api
|
import manila.share_group.api as share_group_api
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -62,7 +62,7 @@ class ShareGroupSnapshotController(wsgi.Controller, wsgi.AdminActionsMixin):
|
||||||
def delete(self, req, id):
|
def delete(self, req, id):
|
||||||
"""Delete a share group snapshot."""
|
"""Delete a share group snapshot."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
LOG.info(_LI("Delete share group snapshot with id: %s"),
|
LOG.info("Delete share group snapshot with id: %s",
|
||||||
id, context=context)
|
id, context=context)
|
||||||
sg_snapshot = self._get_share_group_snapshot(context, id)
|
sg_snapshot = self._get_share_group_snapshot(context, id)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -24,7 +24,7 @@ from manila.api.openstack import wsgi
|
||||||
from manila.api.views import share_groups as share_group_views
|
from manila.api.views import share_groups as share_group_views
|
||||||
from manila import db
|
from manila import db
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LI
|
from manila.i18n import _
|
||||||
from manila.share import share_types
|
from manila.share import share_types
|
||||||
from manila.share_group import api as share_group_api
|
from manila.share_group import api as share_group_api
|
||||||
from manila.share_group import share_group_types
|
from manila.share_group import share_group_types
|
||||||
|
@ -64,7 +64,7 @@ class ShareGroupController(wsgi.Controller, wsgi.AdminActionsMixin):
|
||||||
"""Delete a share group."""
|
"""Delete a share group."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
|
|
||||||
LOG.info(_LI("Delete share group with id: %s"), id, context=context)
|
LOG.info("Delete share group with id: %s", id, context=context)
|
||||||
share_group = self._get_share_group(context, id)
|
share_group = self._get_share_group(context, id)
|
||||||
try:
|
try:
|
||||||
self.share_group_api.delete(context, share_group)
|
self.share_group_api.delete(context, share_group)
|
||||||
|
|
|
@ -27,7 +27,7 @@ from manila.api.openstack import wsgi
|
||||||
from manila.api.views import share_networks as share_networks_views
|
from manila.api.views import share_networks as share_networks_views
|
||||||
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 _, _LE, _LW
|
from manila.i18n import _
|
||||||
from manila import policy
|
from manila import policy
|
||||||
from manila import quota
|
from manila import quota
|
||||||
from manila.share import rpcapi as share_rpcapi
|
from manila.share import rpcapi as share_rpcapi
|
||||||
|
@ -97,8 +97,8 @@ class ShareNetworkController(wsgi.Controller):
|
||||||
context, project_id=share_network['project_id'],
|
context, project_id=share_network['project_id'],
|
||||||
share_networks=-1, user_id=share_network['user_id'])
|
share_networks=-1, user_id=share_network['user_id'])
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE("Failed to update usages deleting "
|
LOG.exception("Failed to update usages deleting "
|
||||||
"share-network."))
|
"share-network.")
|
||||||
else:
|
else:
|
||||||
QUOTAS.commit(context, reservations,
|
QUOTAS.commit(context, reservations,
|
||||||
project_id=share_network['project_id'],
|
project_id=share_network['project_id'],
|
||||||
|
@ -250,13 +250,13 @@ 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:
|
||||||
LOG.warning(_LW("Quota exceeded for %(s_pid)s, "
|
LOG.warning("Quota exceeded for %(s_pid)s, "
|
||||||
"tried to create "
|
"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).", {
|
||||||
'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:
|
||||||
|
|
|
@ -27,7 +27,7 @@ from manila.api.v1 import share_snapshots
|
||||||
from manila.api.views import share_snapshots as snapshot_views
|
from manila.api.views import share_snapshots as snapshot_views
|
||||||
from manila.common import constants
|
from manila.common import constants
|
||||||
from manila import exception
|
from manila import exception
|
||||||
from manila.i18n import _, _LI
|
from manila.i18n import _
|
||||||
from manila import share
|
from manila import share
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -49,7 +49,7 @@ class ShareSnapshotsController(share_snapshots.ShareSnapshotMixin,
|
||||||
"""Unmanage a share snapshot."""
|
"""Unmanage a share snapshot."""
|
||||||
context = req.environ['manila.context']
|
context = req.environ['manila.context']
|
||||||
|
|
||||||
LOG.info(_LI("Unmanage share snapshot with id: %s."), id)
|
LOG.info("Unmanage share snapshot with id: %s.", id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
snapshot = self.share_api.get_snapshot(context, id)
|
snapshot = self.share_api.get_snapshot(context, id)
|
||||||
|
|
|
@ -29,7 +29,7 @@ from manila.api.views import shares as share_views
|
||||||
from manila.common import constants
|
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 _, _LI
|
from manila.i18n import _
|
||||||
from manila import share
|
from manila import share
|
||||||
from manila import utils
|
from manila import utils
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class ShareController(shares.ShareMixin,
|
||||||
raise exc.HTTPConflict(explanation=msg % msg_args)
|
raise exc.HTTPConflict(explanation=msg % msg_args)
|
||||||
|
|
||||||
msg_args = {'share_id': share_id, 'snap_id': snapshot_id}
|
msg_args = {'share_id': share_id, 'snap_id': snapshot_id}
|
||||||
msg = _LI('Reverting share %(share_id)s to snapshot %(snap_id)s.')
|
msg = 'Reverting share %(share_id)s to snapshot %(snap_id)s.'
|
||||||
LOG.info(msg, msg_args)
|
LOG.info(msg, msg_args)
|
||||||
|
|
||||||
self.share_api.revert_to_snapshot(context, share, snapshot)
|
self.share_api.revert_to_snapshot(context, share, snapshot)
|
||||||
|
|
Loading…
Reference in New Issue