diff options
author | whoami-rajat <rajatdhasmana@gmail.com> | 2019-02-26 00:33:34 +0530 |
---|---|---|
committer | Rajat Dhasmana <rajatdhasmana@gmail.com> | 2019-09-20 05:37:54 +0000 |
commit | a550ade303c839abc285d6926dc02a15b5c73ff0 (patch) | |
tree | 9bab02ca298b86bcca37f9d26361b55b75e69a9d /cinder/api/contrib | |
parent | b1de0652ca312503c18099f41ddf8482ca436058 (diff) | |
download | cinder-a550ade303c839abc285d6926dc02a15b5c73ff0.tar.gz |
Untyped to Default Volume Type
The patch adds the following functionality:
* A default volume type (``__DEFAULT__``) will be
created during cinder DB migration.
* Admins can override the default type in cinder.conf
* Creating a new volume without any type (and
`default_volume_type` option is unset in cinder.conf)
will be assigned the ``__DEFAULT__`` type.
* The default volume type cannot be deleted
* All untyped volumes and snapshots will be migrated to the
``__DEFAULT__`` type.
Change-Id: I4da0c13b5b3f8174a30b8557f968d6b9e641b091
Implements: blueprint untyped-volumes-default-volume-type
Diffstat (limited to 'cinder/api/contrib')
-rw-r--r-- | cinder/api/contrib/types_manage.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cinder/api/contrib/types_manage.py b/cinder/api/contrib/types_manage.py index d302ff921..341040958 100644 --- a/cinder/api/contrib/types_manage.py +++ b/cinder/api/contrib/types_manage.py @@ -158,6 +158,11 @@ class VolumeTypesManageController(wsgi.Controller): context, 'volume_type.delete', err, id=id) # Not found exception will be handled at the wsgi level raise + except exception.VolumeTypeDefault as err: + self._notify_volume_type_error( + context, 'volume_type.delete', err, volume_type=vol_type) + msg = _('Target volume type is default and cannot be deleted.') + raise webob.exc.HTTPBadRequest(explanation=msg) return webob.Response(status_int=http_client.ACCEPTED) |