Merge "Fix Manila API error message"
This commit is contained in:
commit
793c5c362e
@ -744,10 +744,10 @@ class Resource(wsgi.Application):
|
|||||||
request.set_api_version_request()
|
request.set_api_version_request()
|
||||||
except exception.InvalidAPIVersionString as e:
|
except exception.InvalidAPIVersionString as e:
|
||||||
return Fault(webob.exc.HTTPBadRequest(
|
return Fault(webob.exc.HTTPBadRequest(
|
||||||
explanation=e.message))
|
explanation=e.msg))
|
||||||
except exception.InvalidGlobalAPIVersion as e:
|
except exception.InvalidGlobalAPIVersion as e:
|
||||||
return Fault(webob.exc.HTTPNotAcceptable(
|
return Fault(webob.exc.HTTPNotAcceptable(
|
||||||
explanation=e.message))
|
explanation=e.msg))
|
||||||
|
|
||||||
# Identify the action, its arguments, and the requested
|
# Identify the action, its arguments, and the requested
|
||||||
# content type
|
# content type
|
||||||
|
@ -50,7 +50,7 @@ class ShareTypeExtraSpecsController(wsgi.Controller):
|
|||||||
try:
|
try:
|
||||||
share_types.get_valid_required_extra_specs(extra_specs)
|
share_types.get_valid_required_extra_specs(extra_specs)
|
||||||
except exception.InvalidExtraSpec as e:
|
except exception.InvalidExtraSpec as e:
|
||||||
raise webob.exc.HTTPBadRequest(explanation=e.message)
|
raise webob.exc.HTTPBadRequest(explanation=e.msg)
|
||||||
|
|
||||||
def is_valid_string(v):
|
def is_valid_string(v):
|
||||||
return isinstance(v, str) and len(v) in range(1, 256)
|
return isinstance(v, str) and len(v) in range(1, 256)
|
||||||
@ -96,7 +96,7 @@ class ShareTypeExtraSpecsController(wsgi.Controller):
|
|||||||
try:
|
try:
|
||||||
self._verify_extra_specs(specs, False)
|
self._verify_extra_specs(specs, False)
|
||||||
except exception.InvalidExtraSpec as e:
|
except exception.InvalidExtraSpec as e:
|
||||||
raise webob.exc.HTTPBadRequest(e.message)
|
raise webob.exc.HTTPBadRequest(e.msg)
|
||||||
|
|
||||||
self._check_key_names(specs.keys())
|
self._check_key_names(specs.keys())
|
||||||
specs = share_types.sanitize_extra_specs(specs)
|
specs = share_types.sanitize_extra_specs(specs)
|
||||||
|
@ -90,9 +90,9 @@ class ShareMixin(object):
|
|||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
raise exc.HTTPNotFound()
|
raise exc.HTTPNotFound()
|
||||||
except exception.InvalidShare as e:
|
except exception.InvalidShare as e:
|
||||||
raise exc.HTTPForbidden(explanation=e.message)
|
raise exc.HTTPForbidden(explanation=e.msg)
|
||||||
except exception.Conflict as e:
|
except exception.Conflict as e:
|
||||||
raise exc.HTTPConflict(explanation=e.message)
|
raise exc.HTTPConflict(explanation=e.msg)
|
||||||
|
|
||||||
return webob.Response(status_int=http_client.ACCEPTED)
|
return webob.Response(status_int=http_client.ACCEPTED)
|
||||||
|
|
||||||
@ -282,14 +282,14 @@ class ShareMixin(object):
|
|||||||
availability_zone_id = availability_zone_db.id
|
availability_zone_id = availability_zone_db.id
|
||||||
availability_zone = availability_zone_db.name
|
availability_zone = availability_zone_db.name
|
||||||
except exception.AvailabilityZoneNotFound as e:
|
except exception.AvailabilityZoneNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.message)
|
raise exc.HTTPNotFound(explanation=e.msg)
|
||||||
|
|
||||||
share_group_id = share.get('share_group_id')
|
share_group_id = share.get('share_group_id')
|
||||||
if share_group_id:
|
if share_group_id:
|
||||||
try:
|
try:
|
||||||
share_group = db.share_group_get(context, share_group_id)
|
share_group = db.share_group_get(context, share_group_id)
|
||||||
except exception.ShareGroupNotFound as e:
|
except exception.ShareGroupNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.message)
|
raise exc.HTTPNotFound(explanation=e.msg)
|
||||||
sg_az_id = share_group['availability_zone_id']
|
sg_az_id = share_group['availability_zone_id']
|
||||||
if availability_zone and availability_zone_id != sg_az_id:
|
if availability_zone and availability_zone_id != sg_az_id:
|
||||||
msg = _("Share cannot have AZ ('%(s_az)s') different than "
|
msg = _("Share cannot have AZ ('%(s_az)s') different than "
|
||||||
|
@ -77,7 +77,7 @@ class ShareGroupSnapshotController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
self.share_group_api.delete_share_group_snapshot(
|
self.share_group_api.delete_share_group_snapshot(
|
||||||
context, sg_snapshot)
|
context, sg_snapshot)
|
||||||
except exception.InvalidShareGroupSnapshot as e:
|
except exception.InvalidShareGroupSnapshot as e:
|
||||||
raise exc.HTTPConflict(explanation=e.message)
|
raise exc.HTTPConflict(explanation=e.msg)
|
||||||
return webob.Response(status_int=http_client.ACCEPTED)
|
return webob.Response(status_int=http_client.ACCEPTED)
|
||||||
|
|
||||||
@wsgi.Controller.api_version('2.31', '2.54', experimental=True)
|
@wsgi.Controller.api_version('2.31', '2.54', experimental=True)
|
||||||
@ -195,9 +195,9 @@ class ShareGroupSnapshotController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
new_snapshot = self.share_group_api.create_share_group_snapshot(
|
new_snapshot = self.share_group_api.create_share_group_snapshot(
|
||||||
context, **kwargs)
|
context, **kwargs)
|
||||||
except exception.ShareGroupNotFound as e:
|
except exception.ShareGroupNotFound as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
except exception.InvalidShareGroup as e:
|
except exception.InvalidShareGroup as e:
|
||||||
raise exc.HTTPConflict(explanation=e.message)
|
raise exc.HTTPConflict(explanation=e.msg)
|
||||||
|
|
||||||
return self._view_builder.detail(req, dict(new_snapshot.items()))
|
return self._view_builder.detail(req, dict(new_snapshot.items()))
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class ShareGroupController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
try:
|
try:
|
||||||
self.share_group_api.delete(context, share_group)
|
self.share_group_api.delete(context, share_group)
|
||||||
except exception.InvalidShareGroup as e:
|
except exception.InvalidShareGroup as e:
|
||||||
raise exc.HTTPConflict(explanation=e.message)
|
raise exc.HTTPConflict(explanation=e.msg)
|
||||||
return webob.Response(status_int=http_client.ACCEPTED)
|
return webob.Response(status_int=http_client.ACCEPTED)
|
||||||
|
|
||||||
@wsgi.Controller.api_version('2.31', '2.54', experimental=True)
|
@wsgi.Controller.api_version('2.31', '2.54', experimental=True)
|
||||||
@ -241,7 +241,7 @@ class ShareGroupController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
kwargs['availability_zone_id'] = az.id
|
kwargs['availability_zone_id'] = az.id
|
||||||
kwargs['availability_zone'] = az.name
|
kwargs['availability_zone'] = az.name
|
||||||
except exception.AvailabilityZoneNotFound as e:
|
except exception.AvailabilityZoneNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.message)
|
raise exc.HTTPNotFound(explanation=e.msg)
|
||||||
|
|
||||||
if 'source_share_group_snapshot_id' in share_group:
|
if 'source_share_group_snapshot_id' in share_group:
|
||||||
source_share_group_snapshot_id = share_group.get(
|
source_share_group_snapshot_id = share_group.get(
|
||||||
@ -277,7 +277,7 @@ class ShareGroupController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
try:
|
try:
|
||||||
new_share_group = self.share_group_api.create(context, **kwargs)
|
new_share_group = self.share_group_api.create(context, **kwargs)
|
||||||
except exception.InvalidShareGroupSnapshot as e:
|
except exception.InvalidShareGroupSnapshot as e:
|
||||||
raise exc.HTTPConflict(explanation=e.message)
|
raise exc.HTTPConflict(explanation=e.msg)
|
||||||
except (exception.ShareGroupSnapshotNotFound,
|
except (exception.ShareGroupSnapshotNotFound,
|
||||||
exception.InvalidInput) as e:
|
exception.InvalidInput) as e:
|
||||||
raise exc.HTTPBadRequest(explanation=str(e))
|
raise exc.HTTPBadRequest(explanation=str(e))
|
||||||
|
@ -65,7 +65,7 @@ class ShareInstanceExportLocationController(wsgi.Controller):
|
|||||||
context, export_location_uuid)
|
context, export_location_uuid)
|
||||||
return self._view_builder.detail(req, export_location)
|
return self._view_builder.detail(req, export_location)
|
||||||
except exception.ExportLocationNotFound as e:
|
except exception.ExportLocationNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.message)
|
raise exc.HTTPNotFound(explanation=e.msg)
|
||||||
|
|
||||||
|
|
||||||
def create_resource():
|
def create_resource():
|
||||||
|
@ -85,7 +85,7 @@ class ShareReplicaExportLocationController(wsgi.Controller):
|
|||||||
return self._view_builder.detail(req, export_location,
|
return self._view_builder.detail(req, export_location,
|
||||||
replica=True)
|
replica=True)
|
||||||
except exception.ExportLocationNotFound as e:
|
except exception.ExportLocationNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.message)
|
raise exc.HTTPNotFound(explanation=e.msg)
|
||||||
|
|
||||||
|
|
||||||
def create_resource():
|
def create_resource():
|
||||||
|
@ -57,7 +57,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
try:
|
try:
|
||||||
self.share_api.delete_share_replica(context, resource, force=True)
|
self.share_api.delete_share_replica(context, resource, force=True)
|
||||||
except exception.ReplicationException as e:
|
except exception.ReplicationException as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
|
|
||||||
@wsgi.Controller.api_version(
|
@wsgi.Controller.api_version(
|
||||||
MIN_SUPPORTED_API_VERSION, PRE_GRADUATION_VERSION, experimental=True)
|
MIN_SUPPORTED_API_VERSION, PRE_GRADUATION_VERSION, experimental=True)
|
||||||
@ -200,11 +200,11 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
share_network_id=share_network_id,
|
share_network_id=share_network_id,
|
||||||
scheduler_hints=scheduler_hints)
|
scheduler_hints=scheduler_hints)
|
||||||
except exception.AvailabilityZoneNotFound as e:
|
except exception.AvailabilityZoneNotFound as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
except exception.ReplicationException as e:
|
except exception.ReplicationException as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
except exception.ShareBusyException as e:
|
except exception.ShareBusyException as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
|
|
||||||
return self._view_builder.detail(req, new_replica)
|
return self._view_builder.detail(req, new_replica)
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
try:
|
try:
|
||||||
self.share_api.delete_share_replica(context, replica)
|
self.share_api.delete_share_replica(context, replica)
|
||||||
except exception.ReplicationException as e:
|
except exception.ReplicationException as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
|
|
||||||
return webob.Response(status_int=http_client.ACCEPTED)
|
return webob.Response(status_int=http_client.ACCEPTED)
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
context, replica,
|
context, replica,
|
||||||
quiesce_wait_time=quiesce_wait_time)
|
quiesce_wait_time=quiesce_wait_time)
|
||||||
except exception.ReplicationException as e:
|
except exception.ReplicationException as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
except exception.AdminRequired as e:
|
except exception.AdminRequired as e:
|
||||||
raise exc.HTTPForbidden(explanation=e.message)
|
raise exc.HTTPForbidden(explanation=e.message)
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
|
|||||||
try:
|
try:
|
||||||
self.share_api.update_share_replica(context, replica)
|
self.share_api.update_share_replica(context, replica)
|
||||||
except exception.InvalidHost as e:
|
except exception.InvalidHost as e:
|
||||||
raise exc.HTTPBadRequest(explanation=e.message)
|
raise exc.HTTPBadRequest(explanation=e.msg)
|
||||||
|
|
||||||
|
|
||||||
def create_resource():
|
def create_resource():
|
||||||
|
@ -207,7 +207,7 @@ class ShareTypesController(wsgi.Controller):
|
|||||||
context, 'share_type.create', share_type)
|
context, 'share_type.create', share_type)
|
||||||
|
|
||||||
except exception.InvalidExtraSpec as e:
|
except exception.InvalidExtraSpec as e:
|
||||||
raise webob.exc.HTTPBadRequest(explanation=e.message)
|
raise webob.exc.HTTPBadRequest(explanation=e.msg)
|
||||||
except exception.ShareTypeExists as err:
|
except exception.ShareTypeExists as err:
|
||||||
notifier_err = dict(share_types=share_type,
|
notifier_err = dict(share_types=share_type,
|
||||||
error_message=err.message)
|
error_message=err.message)
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed several Manila API error messages with their contents. For more
|
||||||
|
details, please refer to
|
||||||
|
`launchpad bug #2007060 <https://bugs.launchpad.net/manila/+bug/2007060>`_
|
Loading…
Reference in New Issue
Block a user