Remove deprecated query_volume_filters config option

query_volume_filters was deprecated in Pike with
Icee6c22621489f93614f4adf071329d8d2115637 and it should be safe to
remove it now.

Change-Id: Icd311db7f88c3c274d9a362eb96519e46c7e4d17
This commit is contained in:
Ivan Kolodyazhny 2018-11-28 17:34:02 +02:00
parent f423626fee
commit ee1ac54125
6 changed files with 18 additions and 23 deletions

View File

@ -39,19 +39,7 @@ api_common_opts = [
cfg.StrOpt('resource_query_filters_file',
default='/etc/cinder/resource_filters.json',
help="Json file indicating user visible filter "
"parameters for list queries.",
deprecated_name='query_volume_filters'),
cfg.ListOpt('query_volume_filters',
default=['name', 'status', 'metadata',
'availability_zone',
'bootable', 'group_id'],
deprecated_for_removal=True,
help="Volume filter options which "
"non-admin user could use to "
"query volumes. Default values "
"are: ['name', 'status', "
"'metadata', 'availability_zone' ,"
"'bootable', 'group_id']")
"parameters for list queries."),
]
CONF = cfg.CONF

View File

@ -274,7 +274,7 @@ class VolumeController(wsgi.Controller):
def _get_volume_filter_options(self):
"""Return volume search options allowed by non-admin."""
return CONF.query_volume_filters
return common.get_enabled_resource_filters('volume')['volume']
@validation.schema(volumes.update, mv.V2_BASE_VERSION,
mv.get_prior_version(mv.SUPPORT_VOLUME_SCHEMA_CHANGES))

View File

@ -1675,8 +1675,9 @@ class VolumeApiTest(test.TestCase):
sort_keys=['display_name'], filters={}, offset=0)
def test_get_volume_filter_options_using_config(self):
filter_list = ['name', 'status', 'metadata', 'bootable',
'availability_zone']
self.override_config('query_volume_filters', filter_list)
filter_list = ["name", "status", "metadata", "bootable",
"migration_status", "availability_zone", "group_id"]
self.override_config('resource_query_filters_file',
{'volume': filter_list})
self.assertEqual(filter_list,
self.controller._get_volume_filter_options())

View File

@ -68,7 +68,8 @@ class VolumeApiTest(test.TestCase):
req.headers = mv.get_mv_header(mv.BASE_VERSION)
req.environ['cinder.context'].is_admin = True
self.override_config('query_volume_filters', 'bootable')
self.override_config('resource_query_filters_file',
{'volume': ['bootable']})
self.controller.index(req)
filters = req.params.copy()
@ -86,7 +87,8 @@ class VolumeApiTest(test.TestCase):
req.api_version_request = mv.get_api_version(
mv.VOLUME_LIST_BOOTABLE)
self.override_config('query_volume_filters', 'bootable')
self.override_config('resource_query_filters_file',
{'volume': ['bootable']})
self.controller.index(req)
filters = req.params.copy()

View File

@ -5,10 +5,8 @@ Generalized filters
Background
----------
Cinder introduced generalized resource filters since Pike, it has the
same purpose as ``query_volume_filters`` option, but it's more convenient
and can be applied to more cinder resources, administrator can control the
allowed filter keys for **non-admin** user by editing the filter
Cinder introduced generalized resource filters since Pike. Administrator can
control the allowed filter keys for **non-admin** user by editing the filter
configuration file. Also since this feature, cinder will raise
``400 BadRequest`` if any invalid query filter is specified.

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
Deprecated config option `query_volume_filters` is removed now. Please,
use config file described in resource_query_filters_file to configure
allowed volume filters.