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
This commit is contained in:
junboli 2018-06-03 18:54:19 +08:00 committed by junbo.li
parent b4bf49c88e
commit d1c5379369
4 changed files with 12 additions and 40 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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'}},

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Removed the option ``allow_inuse_volume_type_modification`` which had
been deprecated in Ocata release.