diff --git a/manila/api/openstack/wsgi.py b/manila/api/openstack/wsgi.py index 24d2a2f77d..c5b9f1837e 100644 --- a/manila/api/openstack/wsgi.py +++ b/manila/api/openstack/wsgi.py @@ -22,6 +22,7 @@ from oslo_log import log from oslo_serialization import jsonutils from oslo_utils import strutils import six +from six.moves import http_client import webob import webob.exc @@ -1241,7 +1242,7 @@ class AdminActionsMixin(object): self._update(context, id, update) except exception.NotFound as e: raise webob.exc.HTTPNotFound(six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @Controller.authorize('force_delete') def _force_delete(self, req, id, body): @@ -1252,7 +1253,7 @@ class AdminActionsMixin(object): except exception.NotFound as e: raise webob.exc.HTTPNotFound(six.text_type(e)) self._delete(context, resource, force=True) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) class Fault(webob.exc.HTTPException): diff --git a/manila/api/v1/security_service.py b/manila/api/v1/security_service.py index 03b4d94e28..2ad26cc581 100644 --- a/manila/api/v1/security_service.py +++ b/manila/api/v1/security_service.py @@ -16,6 +16,7 @@ """The security service api.""" from oslo_log import log +from six.moves import http_client import webob from webob import exc @@ -72,7 +73,7 @@ class SecurityServiceController(wsgi.Controller): 'delete', security_service) db.security_service_delete(context, id) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of security services.""" diff --git a/manila/api/v1/share_metadata.py b/manila/api/v1/share_metadata.py index 971c1b2be2..c50b92989f 100644 --- a/manila/api/v1/share_metadata.py +++ b/manila/api/v1/share_metadata.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves import http_client import webob from webob import exc @@ -144,7 +145,7 @@ class ShareMetadataController(object): except exception.NotFound: msg = _('share does not exist') raise exc.HTTPNotFound(explanation=msg) - return webob.Response(status_int=200) + return webob.Response(status_int=http_client.OK) def create_resource(): diff --git a/manila/api/v1/share_servers.py b/manila/api/v1/share_servers.py index dcec8aeac4..eb0c841038 100644 --- a/manila/api/v1/share_servers.py +++ b/manila/api/v1/share_servers.py @@ -15,6 +15,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -112,7 +113,7 @@ class ShareServerController(wsgi.Controller): self.share_api.delete_share_server(context, share_server) except exception.ShareServerInUse as e: raise exc.HTTPConflict(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def create_resource(): diff --git a/manila/api/v1/share_snapshots.py b/manila/api/v1/share_snapshots.py index 5df234ed7f..ccf45d4bc7 100644 --- a/manila/api/v1/share_snapshots.py +++ b/manila/api/v1/share_snapshots.py @@ -16,6 +16,7 @@ """The share snapshots api.""" from oslo_log import log +from six.moves import http_client import webob from webob import exc @@ -68,7 +69,7 @@ class ShareSnapshotMixin(object): self.share_api.delete_snapshot(context, snapshot) except exception.NotFound: raise exc.HTTPNotFound() - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of snapshots.""" diff --git a/manila/api/v1/share_types_extra_specs.py b/manila/api/v1/share_types_extra_specs.py index 9024759323..ea66d1a30b 100644 --- a/manila/api/v1/share_types_extra_specs.py +++ b/manila/api/v1/share_types_extra_specs.py @@ -14,6 +14,7 @@ # under the License. import six +from six.moves import http_client import webob from manila.api import common @@ -173,7 +174,7 @@ class ShareTypeExtraSpecsController(wsgi.Controller): notifier_info = dict(type_id=type_id, id=id) notifier = rpc.get_notifier('shareTypeExtraSpecs') notifier.info(context, 'share_type_extra_specs.delete', notifier_info) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _check_key_names(self, keys): if not common.validate_key_names(keys): diff --git a/manila/api/v1/share_unmanage.py b/manila/api/v1/share_unmanage.py index 1b0622b3f3..e082e56a2c 100644 --- a/manila/api/v1/share_unmanage.py +++ b/manila/api/v1/share_unmanage.py @@ -14,6 +14,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -64,7 +65,7 @@ class ShareUnmanageMixin(object): except (exception.InvalidShare, exception.PolicyNotAuthorized) as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) class ShareUnmanageController(ShareUnmanageMixin, wsgi.Controller): diff --git a/manila/api/v1/shares.py b/manila/api/v1/shares.py index 362bc43a3e..b8ef2d2731 100644 --- a/manila/api/v1/shares.py +++ b/manila/api/v1/shares.py @@ -21,6 +21,7 @@ from oslo_log import log from oslo_utils import strutils from oslo_utils import uuidutils import six +from six.moves import http_client import webob from webob import exc @@ -97,7 +98,7 @@ class ShareMixin(object): except exception.Conflict as e: raise exc.HTTPConflict(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of shares.""" @@ -440,7 +441,7 @@ class ShareMixin(object): except exception.NotFound as error: raise webob.exc.HTTPNotFound(explanation=six.text_type(error)) self.share_api.deny_access(context, share, access) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _access_list(self, req, id, body): """List share access rules.""" @@ -464,7 +465,7 @@ class ShareMixin(object): except exception.ShareSizeExceedsAvailableQuota as e: raise webob.exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _shrink(self, req, id, body): """Shrink size of a share.""" @@ -477,7 +478,7 @@ class ShareMixin(object): except (exception.InvalidInput, exception.InvalidShare) as e: raise webob.exc.HTTPBadRequest(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _get_valid_resize_parameters(self, context, id, body, action): try: diff --git a/manila/api/v2/messages.py b/manila/api/v2/messages.py index e9e0cae2e1..0158c7656a 100644 --- a/manila/api/v2/messages.py +++ b/manila/api/v2/messages.py @@ -18,6 +18,7 @@ GET /messages/ DELETE /messages/ """ +from six.moves import http_client import webob from webob import exc @@ -66,7 +67,7 @@ class MessagesController(wsgi.Controller): except exception.MessageNotFound as error: raise exc.HTTPNotFound(explanation=error.msg) - return webob.Response(status_int=204) + return webob.Response(status_int=http_client.NO_CONTENT) @wsgi.Controller.api_version(MESSAGES_BASE_MICRO_VERSION) @wsgi.Controller.authorize('get_all') diff --git a/manila/api/v2/quota_sets.py b/manila/api/v2/quota_sets.py index 61c1e5a468..dcb2e8e265 100644 --- a/manila/api/v2/quota_sets.py +++ b/manila/api/v2/quota_sets.py @@ -16,6 +16,7 @@ from oslo_log import log from oslo_utils import strutils +from six.moves import http_client from six.moves.urllib import parse import webob @@ -257,7 +258,7 @@ class QuotaSetsMixin(object): context, id, share_type_id) else: QUOTAS.destroy_all_by_project(context, id) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) except exception.NotAuthorized: raise webob.exc.HTTPForbidden() diff --git a/manila/api/v2/share_group_snapshots.py b/manila/api/v2/share_group_snapshots.py index 7eeb323322..1c64fd2b80 100644 --- a/manila/api/v2/share_group_snapshots.py +++ b/manila/api/v2/share_group_snapshots.py @@ -16,6 +16,7 @@ from oslo_log import log from oslo_utils import uuidutils import six +from six.moves import http_client import webob from webob import exc @@ -70,7 +71,7 @@ class ShareGroupSnapshotController(wsgi.Controller, wsgi.AdminActionsMixin): context, sg_snapshot) except exception.InvalidShareGroupSnapshot as e: raise exc.HTTPConflict(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version('2.31', experimental=True) @wsgi.Controller.authorize('get_all') diff --git a/manila/api/v2/share_group_type_specs.py b/manila/api/v2/share_group_type_specs.py index 3fec6a02f9..42e31dba45 100644 --- a/manila/api/v2/share_group_type_specs.py +++ b/manila/api/v2/share_group_type_specs.py @@ -12,6 +12,7 @@ import copy import six +from six.moves import http_client import webob from manila.api import common @@ -119,7 +120,7 @@ class ShareGroupTypeSpecsController(wsgi.Controller): db.share_group_type_specs_delete(context, id, key) except exception.ShareGroupTypeSpecsNotFound as error: raise webob.exc.HTTPNotFound(explanation=error.msg) - return webob.Response(status_int=204) + return webob.Response(status_int=http_client.NO_CONTENT) def _check_key_names(self, keys): if not common.validate_key_names(keys): diff --git a/manila/api/v2/share_group_types.py b/manila/api/v2/share_group_types.py index 6171265d39..4376625d7d 100644 --- a/manila/api/v2/share_group_types.py +++ b/manila/api/v2/share_group_types.py @@ -15,6 +15,7 @@ from oslo_utils import strutils from oslo_utils import uuidutils import six +from six.moves import http_client import webob from webob import exc @@ -166,7 +167,7 @@ class ShareGroupTypesController(wsgi.Controller): raise webob.exc.HTTPBadRequest(explanation=msg % id) except exception.NotFound: raise webob.exc.HTTPNotFound() - return webob.Response(status_int=204) + return webob.Response(status_int=http_client.NO_CONTENT) @wsgi.Controller.api_version('2.31', experimental=True) @wsgi.Controller.authorize('list_project_access') @@ -204,7 +205,7 @@ class ShareGroupTypesController(wsgi.Controller): context, id, project) except exception.ShareGroupTypeAccessExists as err: raise webob.exc.HTTPConflict(explanation=six.text_type(err)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version('2.31', experimental=True) @wsgi.action('removeProjectAccess') @@ -219,7 +220,7 @@ class ShareGroupTypesController(wsgi.Controller): context, id, project) except exception.ShareGroupTypeAccessNotFound as err: raise webob.exc.HTTPNotFound(explanation=six.text_type(err)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _assert_non_public_share_group_type(self, context, type_id): try: diff --git a/manila/api/v2/share_groups.py b/manila/api/v2/share_groups.py index 396ed9c07d..8aefa59709 100644 --- a/manila/api/v2/share_groups.py +++ b/manila/api/v2/share_groups.py @@ -16,6 +16,7 @@ from oslo_log import log from oslo_utils import uuidutils import six +from six.moves import http_client import webob from webob import exc @@ -71,7 +72,7 @@ class ShareGroupController(wsgi.Controller, wsgi.AdminActionsMixin): self.share_group_api.delete(context, share_group) except exception.InvalidShareGroup as e: raise exc.HTTPConflict(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version('2.31', experimental=True) @wsgi.Controller.authorize('get_all') diff --git a/manila/api/v2/share_networks.py b/manila/api/v2/share_networks.py index 57b30b76e7..be97ccd8bc 100644 --- a/manila/api/v2/share_networks.py +++ b/manila/api/v2/share_networks.py @@ -19,6 +19,7 @@ from oslo_db import exception as db_exception from oslo_log import log from oslo_utils import timeutils import six +from six.moves import http_client import webob from webob import exc @@ -104,7 +105,7 @@ class ShareNetworkController(wsgi.Controller): QUOTAS.commit(context, reservations, project_id=share_network['project_id'], user_id=share_network['user_id']) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _get_share_networks(self, req, is_detail=True): """Returns a list of share networks.""" diff --git a/manila/api/v2/share_replicas.py b/manila/api/v2/share_replicas.py index 3cca6cda01..a005be3988 100644 --- a/manila/api/v2/share_replicas.py +++ b/manila/api/v2/share_replicas.py @@ -16,6 +16,7 @@ """The Share Replication API.""" import six +from six.moves import http_client import webob from webob import exc @@ -157,7 +158,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.ReplicationException as e: raise exc.HTTPBadRequest(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version(MIN_SUPPORTED_API_VERSION, experimental=True) @wsgi.action('promote') @@ -176,7 +177,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin): replica_state = replica.get('replica_state') if replica_state == constants.REPLICA_STATE_ACTIVE: - return webob.Response(status_int=200) + return webob.Response(status_int=http_client.OK) try: replica = self.share_api.promote_share_replica(context, replica) @@ -222,7 +223,7 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin): replica_state = replica.get('replica_state') if replica_state == constants.REPLICA_STATE_ACTIVE: - return webob.Response(status_int=200) + return webob.Response(status_int=http_client.OK) try: self.share_api.update_share_replica(context, replica) diff --git a/manila/api/v2/share_snapshots.py b/manila/api/v2/share_snapshots.py index ed18b3eb86..5257707f17 100644 --- a/manila/api/v2/share_snapshots.py +++ b/manila/api/v2/share_snapshots.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -77,7 +78,7 @@ class ShareSnapshotsController(share_snapshots.ShareSnapshotMixin, except (exception.ShareSnapshotNotFound, exception.ShareNotFound) as e: raise exc.HTTPNotFound(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.authorize('manage_snapshot') def _manage(self, req, body): @@ -220,7 +221,7 @@ class ShareSnapshotsController(share_snapshots.ShareSnapshotMixin, raise webob.exc.HTTPBadRequest(explanation=msg) self.share_api.snapshot_deny_access(context, snapshot, access) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _check_mount_snapshot_support(self, context, snapshot): share = self.share_api.get(context, snapshot['share_id']) diff --git a/manila/api/v2/share_types.py b/manila/api/v2/share_types.py index 9431ca9e54..9f4ac84895 100644 --- a/manila/api/v2/share_types.py +++ b/manila/api/v2/share_types.py @@ -19,6 +19,7 @@ from oslo_log import log from oslo_utils import strutils from oslo_utils import uuidutils import six +from six.moves import http_client import webob from webob import exc @@ -250,7 +251,7 @@ class ShareTypesController(wsgi.Controller): raise webob.exc.HTTPNotFound() - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.authorize('list_project_access') def share_type_access(self, req, id): @@ -289,7 +290,7 @@ class ShareTypesController(wsgi.Controller): except exception.ShareTypeAccessExists as err: raise webob.exc.HTTPConflict(explanation=six.text_type(err)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.action('removeProjectAccess') @wsgi.Controller.authorize('remove_project_access') @@ -304,7 +305,7 @@ class ShareTypesController(wsgi.Controller): share_types.remove_share_type_access(context, id, project) except exception.ShareTypeAccessNotFound as err: raise webob.exc.HTTPNotFound(explanation=six.text_type(err)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _verify_if_non_public_share_type(self, context, share_type_id): try: diff --git a/manila/api/v2/shares.py b/manila/api/v2/shares.py index e333360de3..5e54a4e6c6 100644 --- a/manila/api/v2/shares.py +++ b/manila/api/v2/shares.py @@ -15,6 +15,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -157,7 +158,7 @@ class ShareController(shares.ShareMixin, except exception.ReplicationException as e: raise exc.HTTPBadRequest(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def _validate_revert_parameters(self, context, body): if not (body and self.is_valid_body(body, 'revert')): @@ -287,7 +288,7 @@ class ShareController(shares.ShareMixin, msg = _("Share %s not found.") % id raise exc.HTTPNotFound(explanation=msg) self.share_api.migration_complete(context, share) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version('2.22', experimental=True) @wsgi.action("migration_cancel") @@ -301,7 +302,7 @@ class ShareController(shares.ShareMixin, msg = _("Share %s not found.") % id raise exc.HTTPNotFound(explanation=msg) self.share_api.migration_cancel(context, share) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @wsgi.Controller.api_version('2.22', experimental=True) @wsgi.action("migration_get_progress")