Import HTTPStatus instead of http_client
We don't need an HTTP client for this, we only need status codes. Just load that instead. https://docs.python.org/3/library/http.html Change-Id: Ia0a00a820fff55e25d352d2bf472054ef7074f34
This commit is contained in:
parent
a85ce6c817
commit
6b067f2b47
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
@ -81,7 +81,7 @@ class AdminController(wsgi.Controller):
|
|||
LOG.debug('Worker entry for %s with id %s has been deleted.',
|
||||
self.collection, id)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-reset_status')
|
||||
def _reset_status(self, req, id, body):
|
||||
"""Reset status on the resource."""
|
||||
|
@ -110,7 +110,7 @@ class AdminController(wsgi.Controller):
|
|||
|
||||
self._notify_reset_status(context, id, 'reset_status.end')
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-force_delete')
|
||||
def _force_delete(self, req, id, body):
|
||||
"""Delete a resource, bypassing the check that it must be available."""
|
||||
|
@ -165,7 +165,7 @@ class VolumeAdminController(AdminController):
|
|||
|
||||
return update
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-force_detach')
|
||||
@validation.schema(admin_actions.force_detach)
|
||||
def _force_detach(self, req, id, body):
|
||||
|
@ -200,7 +200,7 @@ class VolumeAdminController(AdminController):
|
|||
# 500 error.
|
||||
raise
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-migrate_volume')
|
||||
@validation.schema(admin_actions.migrate_volume, mv.V2_BASE_VERSION,
|
||||
mv.get_prior_version(mv.VOLUME_MIGRATE_CLUSTER))
|
||||
|
@ -289,7 +289,7 @@ class BackupAdminController(AdminController):
|
|||
def _delete(self, *args, **kwargs):
|
||||
return self.backup_api.delete(*args, **kwargs)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-reset_status')
|
||||
@validation.schema(admin_actions.reset_status_backup)
|
||||
def _reset_status(self, req, id, body):
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The backups api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
@ -59,7 +59,7 @@ class BackupsController(wsgi.Controller):
|
|||
|
||||
return self._view_builder.detail(req, backup)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def delete(self, req, id):
|
||||
"""Delete a backup."""
|
||||
context = req.environ['cinder.context']
|
||||
|
@ -144,7 +144,7 @@ class BackupsController(wsgi.Controller):
|
|||
# - whether requested volume_id exists so we can return some errors
|
||||
# immediately
|
||||
# - maybe also do validation of swift container name
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(backup.create, mv.V2_BASE_VERSION,
|
||||
mv.get_prior_version(mv.BACKUP_METADATA))
|
||||
@validation.schema(backup.create_backup_v343, mv.BACKUP_METADATA,
|
||||
|
@ -201,7 +201,7 @@ class BackupsController(wsgi.Controller):
|
|||
retval = self._view_builder.summary(req, dict(new_backup))
|
||||
return retval
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(backup.restore)
|
||||
def restore(self, req, id, body):
|
||||
"""Restore an existing backup to a volume."""
|
||||
|
@ -252,7 +252,7 @@ class BackupsController(wsgi.Controller):
|
|||
LOG.debug('Exported record output: %s.', retval)
|
||||
return retval
|
||||
|
||||
@wsgi.response(http_client.CREATED)
|
||||
@wsgi.response(HTTPStatus.CREATED)
|
||||
@validation.schema(backup.import_record)
|
||||
def import_record(self, req, body):
|
||||
"""Import a backup."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The cgsnapshots api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import versionutils
|
||||
|
@ -74,7 +74,7 @@ class CgsnapshotsController(wsgi.Controller):
|
|||
msg = _('Failed to delete the cgsnapshot')
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def index(self, req):
|
||||
"""Returns a summary list of cgsnapshots."""
|
||||
|
@ -115,7 +115,7 @@ class CgsnapshotsController(wsgi.Controller):
|
|||
|
||||
return grp_snapshots
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def create(self, req, body):
|
||||
"""Create a new cgsnapshot."""
|
||||
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The consistencygroups api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import versionutils
|
||||
|
@ -85,7 +85,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
|||
except exception.InvalidConsistencyGroup as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def index(self, req):
|
||||
"""Returns a summary list of consistency groups."""
|
||||
|
@ -133,7 +133,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
|||
|
||||
return groups
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def create(self, req, body):
|
||||
"""Create a new consistency group."""
|
||||
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
|
||||
|
@ -179,7 +179,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
|||
retval = self._view_builder.summary(req, new_consistencygroup)
|
||||
return retval
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def create_from_src(self, req, body):
|
||||
"""Create a new consistency group from a source.
|
||||
|
||||
|
@ -297,7 +297,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
|||
remove_volumes)
|
||||
self._update(context, group, name, description, add_volumes,
|
||||
remove_volumes)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Consistencygroups(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The QoS specs extension"""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
|
@ -195,7 +195,7 @@ class QoSSpecsController(wsgi.Controller):
|
|||
msg = _('Qos specs still in use.')
|
||||
raise webob.exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@validation.schema(qos_specs_schema.unset)
|
||||
def delete_keys(self, req, id, body):
|
||||
|
@ -223,7 +223,7 @@ class QoSSpecsController(wsgi.Controller):
|
|||
# Not found exception will be handled at the wsgi level
|
||||
raise
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def associations(self, req, id):
|
||||
"""List all associations of given qos specs."""
|
||||
|
@ -308,7 +308,7 @@ class QoSSpecsController(wsgi.Controller):
|
|||
raise webob.exc.HTTPInternalServerError(
|
||||
explanation=str(err))
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def disassociate(self, req, id):
|
||||
"""Disassociate a qos specs from a volume type."""
|
||||
|
@ -351,7 +351,7 @@ class QoSSpecsController(wsgi.Controller):
|
|||
raise webob.exc.HTTPInternalServerError(
|
||||
explanation=str(err))
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def disassociate_all(self, req, id):
|
||||
"""Disassociate a qos specs from all volume types."""
|
||||
|
@ -384,7 +384,7 @@ class QoSSpecsController(wsgi.Controller):
|
|||
raise webob.exc.HTTPInternalServerError(
|
||||
explanation=str(err))
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Qos_specs_manage(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -151,7 +151,7 @@ class ServiceController(wsgi.Controller):
|
|||
cluster_name, host = common.get_cluster_host(req, body, version)
|
||||
self._volume_api_proxy(self.volume_api.failover, context, host,
|
||||
cluster_name, body.get('backend_id'))
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def _log_params_binaries_services(self, context, body):
|
||||
"""Get binaries and services referred by given log set/get request."""
|
||||
|
@ -189,7 +189,7 @@ class ServiceController(wsgi.Controller):
|
|||
self.rpc_apis[service.binary].set_log_levels(context,
|
||||
service, log_req)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@validation.schema(os_services.get_log)
|
||||
def _get_log(self, req, context, body):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -85,7 +85,7 @@ class SnapshotActionsController(wsgi.Controller):
|
|||
|
||||
current_snapshot.update(update_dict)
|
||||
current_snapshot.save()
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Snapshot_actions(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
@ -38,7 +38,7 @@ class SnapshotManageController(wsgi.Controller):
|
|||
self.volume_api = cinder_volume.API()
|
||||
self._list_manageable_view = list_manageable_view.ViewBuilder()
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(snapshot_manage.create)
|
||||
def create(self, req, body):
|
||||
"""Instruct Cinder to manage a storage snapshot object.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -31,7 +31,7 @@ class SnapshotUnmanageController(wsgi.Controller):
|
|||
super(SnapshotUnmanageController, self).__init__(*args, **kwargs)
|
||||
self.volume_api = volume.API()
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-unmanage')
|
||||
def unmanage(self, req, id, body):
|
||||
"""Stop managing a snapshot.
|
||||
|
@ -57,7 +57,7 @@ class SnapshotUnmanageController(wsgi.Controller):
|
|||
# Not found exception will be handled at the wsgi level
|
||||
except exception.InvalidSnapshot as ex:
|
||||
raise exc.HTTPBadRequest(explanation=ex.msg)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Snapshot_unmanage(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
"""The volume types extra specs extension"""
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -153,7 +153,7 @@ class VolumeTypeExtraSpecsController(wsgi.Controller):
|
|||
raise exception.VolumeTypeExtraSpecsNotFound(
|
||||
volume_type_id=type_id, extra_specs_key=id)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def delete(self, req, type_id, id):
|
||||
"""Deletes an existing extra spec."""
|
||||
context = req.environ['cinder.context']
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volume types manage extension."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_utils import strutils
|
||||
import webob
|
||||
|
@ -167,7 +167,7 @@ class VolumeTypesManageController(wsgi.Controller):
|
|||
context, 'volume_type.delete', err, volume_type=vol_type)
|
||||
raise webob.exc.HTTPInternalServerError(explanation=err.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Types_manage(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from castellan import key_manager
|
||||
from oslo_config import cfg
|
||||
|
@ -48,7 +48,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
return self._key_mgr
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-attach')
|
||||
@validation.schema(volume_action.attach)
|
||||
def _attach(self, req, id, body):
|
||||
|
@ -84,7 +84,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
# to the user and in such cases it should raise 500 error.
|
||||
raise
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-detach')
|
||||
@validation.schema(volume_action.detach)
|
||||
def _detach(self, req, id, body):
|
||||
|
@ -110,7 +110,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
# to the user and in such cases it should raise 500 error.
|
||||
raise
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-reserve')
|
||||
def _reserve(self, req, id, body):
|
||||
"""Mark volume as reserved."""
|
||||
|
@ -120,7 +120,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
self.volume_api.reserve_volume(context, volume)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-unreserve')
|
||||
def _unreserve(self, req, id, body):
|
||||
"""Unmark volume as reserved."""
|
||||
|
@ -130,7 +130,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
self.volume_api.unreserve_volume(context, volume)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-begin_detaching')
|
||||
def _begin_detaching(self, req, id, body):
|
||||
"""Update volume status to 'detaching'."""
|
||||
|
@ -140,7 +140,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
self.volume_api.begin_detaching(context, volume)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-roll_detaching')
|
||||
def _roll_detaching(self, req, id, body):
|
||||
"""Roll back volume status to 'in-use'."""
|
||||
|
@ -175,7 +175,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
return {'connection_info': info}
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-terminate_connection')
|
||||
@validation.schema(volume_action.terminate_connection)
|
||||
def _terminate_connection(self, req, id, body):
|
||||
|
@ -190,7 +190,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
msg = _("Unable to terminate volume connection from backend.")
|
||||
raise webob.exc.HTTPInternalServerError(explanation=msg)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-volume_upload_image')
|
||||
@validation.schema(volume_action.volume_upload_image, mv.V2_BASE_VERSION,
|
||||
mv.get_prior_version(mv.UPLOAD_IMAGE_PARAMS))
|
||||
|
@ -254,7 +254,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
raise webob.exc.HTTPBadRequest(explanation=str(error))
|
||||
return {'os-volume_upload_image': response}
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-extend')
|
||||
@validation.schema(volume_action.extend)
|
||||
def _extend(self, req, id, body):
|
||||
|
@ -274,7 +274,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
except exception.InvalidVolume as error:
|
||||
raise webob.exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-update_readonly_flag')
|
||||
@validation.schema(volume_action.volume_readonly_update)
|
||||
def _volume_readonly_update(self, req, id, body):
|
||||
|
@ -290,7 +290,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
self.volume_api.update_readonly_flag(context, volume, readonly_flag)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-retype')
|
||||
@validation.schema(volume_action.retype)
|
||||
def _retype(self, req, id, body):
|
||||
|
@ -302,7 +302,7 @@ class VolumeActionsController(wsgi.Controller):
|
|||
|
||||
self.volume_api.retype(context, volume, new_type, policy)
|
||||
|
||||
@wsgi.response(http_client.OK)
|
||||
@wsgi.response(HTTPStatus.OK)
|
||||
@wsgi.action('os-set_bootable')
|
||||
@validation.schema(volume_action.set_bootable)
|
||||
def _set_bootable(self, req, id, body):
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The Volume Image Metadata API extension."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -142,7 +142,7 @@ class VolumeImageMetadataController(wsgi.Controller):
|
|||
context, vol, key,
|
||||
meta_type=common.METADATA_TYPES.image)
|
||||
|
||||
return webob.Response(status_int=http_client.OK)
|
||||
return webob.Response(status_int=HTTPStatus.OK)
|
||||
|
||||
|
||||
class Volume_image_metadata(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
@ -45,7 +45,7 @@ class VolumeManageController(wsgi.Controller):
|
|||
self.volume_api = cinder_volume.API()
|
||||
self._list_manageable_view = list_manageable_view.ViewBuilder()
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volume_manage.volume_manage_create, mv.V2_BASE_VERSION,
|
||||
mv.get_prior_version(mv.VOLUME_MIGRATE_CLUSTER))
|
||||
@validation.schema(volume_manage.volume_manage_create_v316,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -78,7 +78,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||
|
||||
return transfers
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volume_transfer.create)
|
||||
def create(self, req, body):
|
||||
"""Create a new volume transfer."""
|
||||
|
@ -107,7 +107,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||
dict(new_transfer))
|
||||
return transfer
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volume_transfer.accept)
|
||||
def accept(self, req, id, body):
|
||||
"""Accept a new volume transfer."""
|
||||
|
@ -142,7 +142,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
self.transfer_api.delete(context, transfer_id=id)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Volume_transfer(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volume type access extension."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -106,7 +106,7 @@ class VolumeTypeActionController(wsgi.Controller):
|
|||
# Not found exception will be handled at the wsgi level
|
||||
except exception.VolumeTypeAccessExists as err:
|
||||
raise webob.exc.HTTPConflict(explanation=str(err))
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.action('removeProjectAccess')
|
||||
@validation.schema(volume_type_access.remove_project_access)
|
||||
|
@ -117,7 +117,7 @@ class VolumeTypeActionController(wsgi.Controller):
|
|||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
volume_types.remove_volume_type_access(context, id, project)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Volume_type_access(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volume types encryption extension."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -143,7 +143,7 @@ class VolumeTypeEncryptionController(wsgi.Controller):
|
|||
# Not found exception will be handled at the wsgi level
|
||||
db.volume_type_encryption_delete(context, type_id)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Volume_type_encryption(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -29,7 +29,7 @@ class VolumeUnmanageController(wsgi.Controller):
|
|||
super(VolumeUnmanageController, self).__init__(*args, **kwargs)
|
||||
self.volume_api = volume.API()
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.action('os-unmanage')
|
||||
def unmanage(self, req, id, body):
|
||||
"""Stop managing a volume.
|
||||
|
@ -54,7 +54,7 @@ class VolumeUnmanageController(wsgi.Controller):
|
|||
vol = self.volume_api.get(context, id)
|
||||
context.authorize(policy.UNMANAGE_POLICY, target_obj=vol)
|
||||
self.volume_api.delete(context, vol, unmanage_only=True)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
class Volume_unmanage(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -17,7 +17,7 @@ Common Auth Middleware.
|
|||
|
||||
"""
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -141,7 +141,7 @@ class NoAuthMiddleware(base_wsgi.Middleware):
|
|||
res.headers['X-Auth-Token'] = '%s:%s' % (user_id, project_id)
|
||||
res.headers['X-Server-Management-Url'] = os_url
|
||||
res.content_type = 'text/plain'
|
||||
res.status_int = http_client.NO_CONTENT
|
||||
res.status_int = HTTPStatus.NO_CONTENT
|
||||
return res
|
||||
|
||||
token = req.headers['X-Auth-Token']
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob.dec
|
||||
|
@ -54,9 +54,9 @@ class FaultWrapper(base_wsgi.Middleware):
|
|||
'error': inner})
|
||||
safe = getattr(inner, 'safe', False)
|
||||
headers = getattr(inner, 'headers', None)
|
||||
status = getattr(inner, 'code', http_client.INTERNAL_SERVER_ERROR)
|
||||
status = getattr(inner, 'code', HTTPStatus.INTERNAL_SERVER_ERROR)
|
||||
if status is None:
|
||||
status = http_client.INTERNAL_SERVER_ERROR
|
||||
status = HTTPStatus.INTERNAL_SERVER_ERROR
|
||||
|
||||
msg_dict = dict(url=req.url, status=status)
|
||||
LOG.info("%(url)s returned with HTTP %(status)s", msg_dict)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
from collections import abc
|
||||
import functools
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
import inspect
|
||||
import math
|
||||
import time
|
||||
|
@ -439,7 +439,7 @@ class ResponseObject(object):
|
|||
|
||||
self.obj = obj
|
||||
self.serializers = serializers
|
||||
self._default_code = http_client.OK
|
||||
self._default_code = HTTPStatus.OK
|
||||
self._code = code
|
||||
self._headers = headers or {}
|
||||
self.serializer = None
|
||||
|
@ -1284,16 +1284,16 @@ class Controller(object, metaclass=ControllerMetaclass):
|
|||
class Fault(webob.exc.HTTPException):
|
||||
"""Wrap webob.exc.HTTPException to provide API friendly response."""
|
||||
|
||||
_fault_names = {http_client.BAD_REQUEST: "badRequest",
|
||||
http_client.UNAUTHORIZED: "unauthorized",
|
||||
http_client.FORBIDDEN: "forbidden",
|
||||
http_client.NOT_FOUND: "itemNotFound",
|
||||
http_client.METHOD_NOT_ALLOWED: "badMethod",
|
||||
http_client.CONFLICT: "conflictingRequest",
|
||||
http_client.REQUEST_ENTITY_TOO_LARGE: "overLimit",
|
||||
http_client.UNSUPPORTED_MEDIA_TYPE: "badMediaType",
|
||||
http_client.NOT_IMPLEMENTED: "notImplemented",
|
||||
http_client.SERVICE_UNAVAILABLE: "serviceUnavailable"}
|
||||
_fault_names = {HTTPStatus.BAD_REQUEST: "badRequest",
|
||||
HTTPStatus.UNAUTHORIZED: "unauthorized",
|
||||
HTTPStatus.FORBIDDEN: "forbidden",
|
||||
HTTPStatus.NOT_FOUND: "itemNotFound",
|
||||
HTTPStatus.METHOD_NOT_ALLOWED: "badMethod",
|
||||
HTTPStatus.CONFLICT: "conflictingRequest",
|
||||
HTTPStatus.REQUEST_ENTITY_TOO_LARGE: "overLimit",
|
||||
HTTPStatus.UNSUPPORTED_MEDIA_TYPE: "badMediaType",
|
||||
HTTPStatus.NOT_IMPLEMENTED: "notImplemented",
|
||||
HTTPStatus.SERVICE_UNAVAILABLE: "serviceUnavailable"}
|
||||
|
||||
def __init__(self, exception):
|
||||
"""Create a Fault for the given webob.exc.exception."""
|
||||
|
@ -1312,7 +1312,7 @@ class Fault(webob.exc.HTTPException):
|
|||
fault_name: {
|
||||
'code': code,
|
||||
'message': i18n.translate(explanation, locale)}}
|
||||
if code == http_client.REQUEST_ENTITY_TOO_LARGE:
|
||||
if code == HTTPStatus.REQUEST_ENTITY_TOO_LARGE:
|
||||
retry = self.wrapped_exc.headers.get('Retry-After', None)
|
||||
if retry:
|
||||
fault_data[fault_name]['retryAfter'] = retry
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
from webob import exc
|
||||
|
@ -131,7 +131,7 @@ class Controller(wsgi.Controller):
|
|||
metadata_key=id)
|
||||
|
||||
self.volume_api.delete_snapshot_metadata(context, snapshot, id)
|
||||
return webob.Response(status_int=http_client.OK)
|
||||
return webob.Response(status_int=HTTPStatus.OK)
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volumes snapshots api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
@ -63,7 +63,7 @@ class SnapshotsController(wsgi.Controller):
|
|||
snapshot = self.volume_api.get_snapshot(context, id)
|
||||
self.volume_api.delete_snapshot(context, snapshot)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def index(self, req):
|
||||
"""Returns a summary list of snapshots."""
|
||||
|
@ -107,7 +107,7 @@ class SnapshotsController(wsgi.Controller):
|
|||
snapshots = self._view_builder.summary_list(req, snapshots.objects)
|
||||
return snapshots
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(snapshot.create)
|
||||
def create(self, req, body):
|
||||
"""Creates a new snapshot."""
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -139,7 +139,7 @@ class Controller(wsgi.Controller):
|
|||
volume,
|
||||
id,
|
||||
meta_type=common.METADATA_TYPES.user)
|
||||
return webob.Response(status_int=http_client.OK)
|
||||
return webob.Response(status_int=HTTPStatus.OK)
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
"""The volumes api."""
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -80,7 +80,7 @@ class VolumeController(wsgi.Controller):
|
|||
# Not found exception will be handled at the wsgi level
|
||||
volume = self.volume_api.get(context, id)
|
||||
self.volume_api.delete(context, volume, cascade=cascade)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
def index(self, req):
|
||||
"""Returns a summary list of volumes."""
|
||||
|
@ -177,7 +177,7 @@ class VolumeController(wsgi.Controller):
|
|||
"access requested image.")
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volumes.create, mv.V2_BASE_VERSION)
|
||||
def create(self, req, body):
|
||||
"""Creates a new volume."""
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volumes attachments API."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -100,7 +100,7 @@ class AttachmentsController(wsgi.Controller):
|
|||
sort_direction=sort_dirs)
|
||||
|
||||
@wsgi.Controller.api_version(mv.NEW_ATTACH)
|
||||
@wsgi.response(http_client.OK)
|
||||
@wsgi.response(HTTPStatus.OK)
|
||||
@validation.schema(attachment.create)
|
||||
def create(self, req, body):
|
||||
"""Create an attachment.
|
||||
|
@ -270,7 +270,7 @@ class AttachmentsController(wsgi.Controller):
|
|||
attachments = self.volume_api.attachment_delete(context, attachment)
|
||||
return attachment_views.ViewBuilder.list(attachments)
|
||||
|
||||
@wsgi.response(http_client.NO_CONTENT)
|
||||
@wsgi.response(HTTPStatus.NO_CONTENT)
|
||||
@wsgi.Controller.api_version(mv.NEW_ATTACH_COMPLETION)
|
||||
@wsgi.action('os-complete')
|
||||
def complete(self, req, id, body):
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The consistencygroups V3 API."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -88,7 +88,7 @@ class ConsistencyGroupsController(cg_v2.ConsistencyGroupsController):
|
|||
remove_volumes)
|
||||
self._update(context, group, name, description, add_volumes,
|
||||
remove_volumes, allow_empty)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The resource filters api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from keystoneauth1 import exceptions as ks_exc
|
||||
from webob import exc
|
||||
|
@ -53,7 +53,7 @@ class DefaultTypesController(wsgi.Controller):
|
|||
"operation.")
|
||||
raise exc.HTTPForbidden(explanation=explanation)
|
||||
|
||||
@wsgi.response(http_client.OK)
|
||||
@wsgi.response(HTTPStatus.OK)
|
||||
@wsgi.Controller.api_version(mv.DEFAULT_TYPE_OVERRIDES)
|
||||
@validation.schema(default_types.create_or_update)
|
||||
def create_update(self, req, id, body):
|
||||
|
@ -77,7 +77,7 @@ class DefaultTypesController(wsgi.Controller):
|
|||
|
||||
return self._view_builder.create(default_type)
|
||||
|
||||
@wsgi.response(http_client.OK)
|
||||
@wsgi.response(HTTPStatus.OK)
|
||||
@wsgi.Controller.api_version(mv.DEFAULT_TYPE_OVERRIDES)
|
||||
def detail(self, req, id):
|
||||
"""Return detail of a default type."""
|
||||
|
@ -93,7 +93,7 @@ class DefaultTypesController(wsgi.Controller):
|
|||
project_id=project_id)
|
||||
return self._view_builder.detail(default_type)
|
||||
|
||||
@wsgi.response(http_client.OK)
|
||||
@wsgi.response(HTTPStatus.OK)
|
||||
@wsgi.Controller.api_version(mv.DEFAULT_TYPE_OVERRIDES)
|
||||
def index(self, req):
|
||||
"""Return a list of default types."""
|
||||
|
@ -109,7 +109,7 @@ class DefaultTypesController(wsgi.Controller):
|
|||
default_types = db.project_default_volume_type_get(context)
|
||||
return self._view_builder.index(default_types)
|
||||
|
||||
@wsgi.response(http_client.NO_CONTENT)
|
||||
@wsgi.response(HTTPStatus.NO_CONTENT)
|
||||
@wsgi.Controller.api_version(mv.DEFAULT_TYPE_OVERRIDES)
|
||||
def delete(self, req, id):
|
||||
"""Unset a default volume type for a project."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The group_snapshots API."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
@ -92,7 +92,7 @@ class GroupSnapshotsController(wsgi.Controller):
|
|||
LOG.exception(msg)
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_SNAPSHOTS)
|
||||
def index(self, req):
|
||||
|
@ -147,7 +147,7 @@ class GroupSnapshotsController(wsgi.Controller):
|
|||
return group_snapshots
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_SNAPSHOTS)
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(snapshot.create)
|
||||
def create(self, req, body):
|
||||
"""Create a new group_snapshot."""
|
||||
|
@ -218,7 +218,7 @@ class GroupSnapshotsController(wsgi.Controller):
|
|||
{'error_message': error.msg,
|
||||
'id': id})
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The group types specs controller"""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -54,7 +54,7 @@ class GroupTypeSpecsController(wsgi.Controller):
|
|||
return self._get_group_specs(context, group_type_id)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_TYPE)
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(group_specs.create)
|
||||
def create(self, req, group_type_id, body):
|
||||
context = req.environ['cinder.context']
|
||||
|
@ -125,7 +125,7 @@ class GroupTypeSpecsController(wsgi.Controller):
|
|||
notifier.info(context,
|
||||
'group_type_specs.delete',
|
||||
notifier_info)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The group type & group type specs controller."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_utils import strutils
|
||||
import webob
|
||||
|
@ -52,7 +52,7 @@ class GroupTypesController(wsgi.Controller):
|
|||
rpc.get_notifier('groupType').info(context, method, payload)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_TYPE)
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(group_type.create)
|
||||
def create(self, req, body):
|
||||
"""Creates a new group type."""
|
||||
|
@ -159,7 +159,7 @@ class GroupTypesController(wsgi.Controller):
|
|||
context, 'group_type.delete', err, id=id)
|
||||
raise webob.exc.HTTPNotFound(explanation=err.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_TYPE)
|
||||
def index(self, req):
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The groups controller."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
@ -104,7 +104,7 @@ class GroupsController(wsgi.Controller):
|
|||
{'error_message': error.msg,
|
||||
'id': id})
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_VOLUME)
|
||||
@wsgi.action("delete")
|
||||
|
@ -133,7 +133,7 @@ class GroupsController(wsgi.Controller):
|
|||
except exception.InvalidGroup as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_VOLUME)
|
||||
def index(self, req):
|
||||
|
@ -183,7 +183,7 @@ class GroupsController(wsgi.Controller):
|
|||
return groups
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_VOLUME)
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(group.create)
|
||||
def create(self, req, body):
|
||||
"""Create a new group."""
|
||||
|
@ -224,7 +224,7 @@ class GroupsController(wsgi.Controller):
|
|||
|
||||
@wsgi.Controller.api_version(mv.GROUP_SNAPSHOTS)
|
||||
@wsgi.action("create-from-src")
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(group.create_from_source)
|
||||
def create_from_src(self, req, body):
|
||||
"""Create a new group from a source.
|
||||
|
@ -334,7 +334,7 @@ class GroupsController(wsgi.Controller):
|
|||
except exception.InvalidGroup as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_REPLICATION)
|
||||
@wsgi.action("enable_replication")
|
||||
|
@ -354,7 +354,7 @@ class GroupsController(wsgi.Controller):
|
|||
exception.InvalidVolume, exception.InvalidVolumeType) as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_REPLICATION)
|
||||
@wsgi.action("disable_replication")
|
||||
|
@ -374,7 +374,7 @@ class GroupsController(wsgi.Controller):
|
|||
exception.InvalidVolume, exception.InvalidVolumeType) as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_REPLICATION)
|
||||
@wsgi.action("failover_replication")
|
||||
|
@ -401,7 +401,7 @@ class GroupsController(wsgi.Controller):
|
|||
exception.InvalidVolume, exception.InvalidVolumeType) as error:
|
||||
raise exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@wsgi.Controller.api_version(mv.GROUP_REPLICATION)
|
||||
@wsgi.action("list_replication_targets")
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
"""The messages API."""
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
import webob
|
||||
|
||||
|
@ -72,7 +72,7 @@ class MessagesController(wsgi.Controller):
|
|||
context.authorize(policy.DELETE_POLICY, target_obj=message)
|
||||
self.message_api.delete(context, message)
|
||||
|
||||
return webob.Response(status_int=http_client.NO_CONTENT)
|
||||
return webob.Response(status_int=HTTPStatus.NO_CONTENT)
|
||||
|
||||
@wsgi.Controller.api_version(mv.MESSAGES)
|
||||
def index(self, req):
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from cinder.api.contrib import snapshot_manage as snapshot_manage_v2
|
||||
from cinder.api import microversions as mv
|
||||
|
@ -26,7 +26,7 @@ class SnapshotManageController(common.ManageResource,
|
|||
super(SnapshotManageController, self).__init__(*args, **kwargs)
|
||||
self._set_resource_type('snapshot')
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def create(self, req, body):
|
||||
self._ensure_min_version(req, mv.MANAGE_EXISTING_LIST)
|
||||
return super(SnapshotManageController, self).create(req, body=body)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from cinder.api.contrib import volume_manage as volume_manage_v2
|
||||
from cinder.api import microversions as mv
|
||||
|
@ -26,7 +26,7 @@ class VolumeManageController(common.ManageResource,
|
|||
super(VolumeManageController, self).__init__(*args, **kwargs)
|
||||
self._set_resource_type('volume')
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
def create(self, req, body):
|
||||
self._ensure_min_version(req, mv.MANAGE_EXISTING_LIST)
|
||||
return super(VolumeManageController, self).create(req, body=body)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"""The volume metadata V3 api."""
|
||||
|
||||
import hashlib
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import webob
|
||||
|
@ -60,7 +60,7 @@ class Controller(volume_meta_v2.Controller):
|
|||
if req_version.matches(mv.ETAGS):
|
||||
if not self._validate_etag(req, volume_id):
|
||||
return webob.Response(
|
||||
status_int=http_client.PRECONDITION_FAILED)
|
||||
status_int=HTTPStatus.PRECONDITION_FAILED)
|
||||
return super(Controller, self).update(req, volume_id,
|
||||
id, body=body)
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Controller(volume_meta_v2.Controller):
|
|||
if req_version.matches(mv.ETAGS):
|
||||
if not self._validate_etag(req, volume_id):
|
||||
return webob.Response(
|
||||
status_int=http_client.PRECONDITION_FAILED)
|
||||
status_int=HTTPStatus.PRECONDITION_FAILED)
|
||||
return super(Controller, self).update_all(req, volume_id,
|
||||
body=body)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
@ -76,7 +76,7 @@ class VolumeTransferController(volume_transfer_v2.VolumeTransferController):
|
|||
"""Returns a detailed list of transfers."""
|
||||
return self._get_transfers(req, is_detail=True)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volume_transfer.create, mv.BASE_VERSION,
|
||||
mv.get_prior_version(mv.TRANSFER_WITH_SNAPSHOTS))
|
||||
@validation.schema(volume_transfer.create_v355, mv.TRANSFER_WITH_SNAPSHOTS)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
"""The volumes V3 api."""
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import versionutils
|
||||
|
@ -78,7 +78,7 @@ class VolumeController(volumes_v2.VolumeController):
|
|||
cascade=cascade,
|
||||
force=force)
|
||||
|
||||
return webob.Response(status_int=http_client.ACCEPTED)
|
||||
return webob.Response(status_int=HTTPStatus.ACCEPTED)
|
||||
|
||||
@common.process_general_filtering('volume')
|
||||
def _process_volume_filtering(self, context=None, filters=None,
|
||||
|
@ -208,7 +208,7 @@ class VolumeController(volumes_v2.VolumeController):
|
|||
return view_builder_v3.quick_summary(num_vols, int(sum_size),
|
||||
all_distinct_metadata)
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@wsgi.Controller.api_version(mv.VOLUME_REVERT)
|
||||
@wsgi.action('revert')
|
||||
def revert(self, req, id, body):
|
||||
|
@ -268,7 +268,7 @@ class VolumeController(volumes_v2.VolumeController):
|
|||
raise exc.HTTPNotFound(explanation=explanation)
|
||||
return image_snapshot
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(volumes.create, mv.BASE_VERSION,
|
||||
mv.get_prior_version(mv.GROUP_VOLUME))
|
||||
@validation.schema(volumes.create_volume_v313, mv.GROUP_VOLUME,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
|
@ -38,7 +38,7 @@ class WorkerController(wsgi.Controller):
|
|||
self.sch_api = sch_rpc.SchedulerAPI()
|
||||
|
||||
@wsgi.Controller.api_version(mv.WORKERS_CLEANUP)
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.response(HTTPStatus.ACCEPTED)
|
||||
@validation.schema(workers.cleanup)
|
||||
def cleanup(self, req, body=None):
|
||||
"""Do the cleanup on resources from a specific service/host/node."""
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
|
||||
import copy
|
||||
from http import client as http_client
|
||||
from http import HTTPStatus
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
@ -113,7 +113,7 @@ class VersionsController(wsgi.Controller):
|
|||
# /v2 or /v3 in the URL will lead to this unversioned
|
||||
# method, which should always return info about all
|
||||
# available versions.
|
||||
@wsgi.response(http_client.MULTIPLE_CHOICES)
|
||||
@wsgi.response(HTTPStatus.MULTIPLE_CHOICES)
|
||||
def all(self, req):
|
||||
"""Return all known and enabled versions."""
|
||||
builder = views_versions.get_view_builder(req)
|
||||
|
|
Loading…
Reference in New Issue