From d1c5379369b24effdccfe5dde3e93bd21884eda5 Mon Sep 17 00:00:00 2001 From: junboli Date: Sun, 3 Jun 2018 18:54:19 +0800 Subject: [PATCH] Remove the deprecated config option The option 'allow_inuse_volume_type_modification' is introduced as a bridge to not break upgrades without notice. It is introduced in Ocata release [1], so it is time to remove this option. [1] https://review.openstack.org/#/c/440680/ Change-Id: I8c61b11994c1f8f571e65cefe4965f7d69b13100 --- cinder/api/contrib/types_extra_specs.py | 38 ++++--------------- cinder/opts.py | 3 -- .../api/contrib/test_types_extra_specs.py | 6 --- ...ve-deprecated-option-9ad954726ed4d8c2.yaml | 5 +++ 4 files changed, 12 insertions(+), 40 deletions(-) create mode 100644 releasenotes/notes/remove-deprecated-option-9ad954726ed4d8c2.yaml diff --git a/cinder/api/contrib/types_extra_specs.py b/cinder/api/contrib/types_extra_specs.py index 0b172f91fc0..204d8f4e4cd 100644 --- a/cinder/api/contrib/types_extra_specs.py +++ b/cinder/api/contrib/types_extra_specs.py @@ -15,9 +15,6 @@ """The volume types extra specs extension""" -from oslo_config import cfg -from oslo_log import log as logging -from oslo_log import versionutils from six.moves import http_client import webob @@ -33,20 +30,6 @@ from cinder.policies import type_extra_specs as policy from cinder import rpc from cinder.volume import volume_types -LOG = logging.getLogger(__name__) - -extraspec_opts = [ - cfg.BoolOpt('allow_inuse_volume_type_modification', - default=False, - deprecated_for_removal=True, - help="DEPRECATED: Allow the ability to modify the " - "extra-spec settings of an in-use volume-type."), - -] - -CONF = cfg.CONF -CONF.register_opts(extraspec_opts) - class VolumeTypeExtraSpecsController(wsgi.Controller): """The volume type extra specs API controller for the OpenStack API.""" @@ -70,20 +53,13 @@ class VolumeTypeExtraSpecsController(wsgi.Controller): return self._get_extra_specs(context, type_id) def _allow_update(self, context, type_id): - if (not CONF.allow_inuse_volume_type_modification): - vols = db.volume_get_all( - ctxt.get_admin_context(), - limit=1, - filters={'volume_type_id': type_id}) - if len(vols): - expl = _('Volume Type is currently in use.') - raise webob.exc.HTTPBadRequest(explanation=expl) - else: - msg = ("The option 'allow_inuse_volume_type_modification' " - "is deprecated and will be removed in a future " - "release. The default behavior going forward will " - "be to disallow modificaton of in-use types.") - versionutils.report_deprecated_feature(LOG, msg) + vols = db.volume_get_all( + ctxt.get_admin_context(), + limit=1, + filters={'volume_type_id': type_id}) + if len(vols): + expl = _('Volume Type is currently in use.') + raise webob.exc.HTTPBadRequest(explanation=expl) return @validation.schema(types_extra_specs.create) diff --git a/cinder/opts.py b/cinder/opts.py index 59eae69d648..48505d3f47d 100644 --- a/cinder/opts.py +++ b/cinder/opts.py @@ -27,8 +27,6 @@ from cinder import objects objects.register_all() from cinder.api import common as cinder_api_common -from cinder.api.contrib import types_extra_specs as \ - cinder_api_contrib_typesextraspecs from cinder.api.middleware import auth as cinder_api_middleware_auth from cinder.api.views import versions as cinder_api_views_versions from cinder.backup import api as cinder_backup_api @@ -210,7 +208,6 @@ def list_opts(): ('DEFAULT', itertools.chain( cinder_api_common.api_common_opts, - cinder_api_contrib_typesextraspecs.extraspec_opts, [cinder_api_middleware_auth.use_forwarded_for_opt], cinder_api_views_versions.versions_opts, cinder_backup_api.backup_api_opts, diff --git a/cinder/tests/unit/api/contrib/test_types_extra_specs.py b/cinder/tests/unit/api/contrib/test_types_extra_specs.py index 89f4dfb34cb..a636dd4a4f8 100644 --- a/cinder/tests/unit/api/contrib/test_types_extra_specs.py +++ b/cinder/tests/unit/api/contrib/test_types_extra_specs.py @@ -294,12 +294,6 @@ class VolumeTypesExtraSpecsTest(test.TestCase): req, fake.VOLUME_ID, body=body) - # Again but with conf set to allow modification - CONF.set_default('allow_inuse_volume_type_modification', True) - res_dict = self.controller.create(req, fake.VOLUME_ID, body=body) - self.assertEqual({'extra_specs': {'key1': 'value1'}}, - res_dict) - @ddt.data({'extra_specs': {'a' * 256: 'a'}}, {'extra_specs': {'a': 'a' * 256}}, {'extra_specs': {'': 'a'}}, diff --git a/releasenotes/notes/remove-deprecated-option-9ad954726ed4d8c2.yaml b/releasenotes/notes/remove-deprecated-option-9ad954726ed4d8c2.yaml new file mode 100644 index 00000000000..6d2fc0ffd01 --- /dev/null +++ b/releasenotes/notes/remove-deprecated-option-9ad954726ed4d8c2.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Removed the option ``allow_inuse_volume_type_modification`` which had + been deprecated in Ocata release.