Removal of 'enable_v2_api'

Removal of config option 'enable_v2_api' and its related
operations and tests.

Change-Id: Ic83e7e8077b3fc939990c1f8e9c99b13b7fcd7ad
This commit is contained in:
Erno Kuvaja 2020-06-30 16:44:10 +01:00
parent 673666cbf4
commit bbb3ede895
8 changed files with 35 additions and 78 deletions

View File

@ -20,6 +20,4 @@ CONF = cfg.CONF
def root_app_factory(loader, global_conf, **local_conf): def root_app_factory(loader, global_conf, **local_conf):
if not CONF.enable_v2_api and '/v2' in local_conf:
del local_conf['/v2']
return paste.urlmap.urlmap_factory(loader, global_conf, **local_conf) return paste.urlmap.urlmap_factory(loader, global_conf, **local_conf)

View File

@ -72,7 +72,6 @@ class VersionNegotiationFilter(wsgi.Middleware):
def _get_allowed_versions(self): def _get_allowed_versions(self):
allowed_versions = {} allowed_versions = {}
if CONF.enable_v2_api:
allowed_versions['v2'] = 2 allowed_versions['v2'] = 2
allowed_versions['v2.0'] = 2 allowed_versions['v2.0'] = 2
allowed_versions['v2.1'] = 2 allowed_versions['v2.1'] = 2

View File

@ -76,7 +76,6 @@ class Controller(object):
} }
version_objs = [] version_objs = []
if CONF.enable_v2_api:
if CONF.enabled_backends: if CONF.enabled_backends:
version_objs.extend([ version_objs.extend([
build_version_object(2.10, 'v2', 'CURRENT'), build_version_object(2.10, 'v2', 'CURRENT'),

View File

@ -457,30 +457,6 @@ Possible values:
Related options: Related options:
* None * None
""")),
cfg.BoolOpt('enable_v2_api',
default=True,
deprecated_reason=_('The Images (Glance) version 1 API has '
'been DEPRECATED in the Newton release. '
'It will be removed on or after Pike '
'release, following the standard '
'OpenStack deprecation policy. Once we '
'remove the Images (Glance) v1 API, only '
'the Images (Glance) v2 API can be '
'deployed and will be enabled by default '
'making this option redundant.'),
deprecated_since='Newton',
help=_("""
Deploy the v2 OpenStack Images API.
When this option is set to ``True``, Glance service will respond
to requests on registered endpoints conforming to the v2 OpenStack
Images API.
Possible values:
* True
* False
""")), """)),
cfg.HostAddressOpt('pydev_worker_debug_host', cfg.HostAddressOpt('pydev_worker_debug_host',
sample_default='localhost', sample_default='localhost',

View File

@ -88,7 +88,6 @@ class BaseServer(object):
self.show_image_direct_url = False self.show_image_direct_url = False
self.show_multiple_locations = False self.show_multiple_locations = False
self.property_protection_file = '' self.property_protection_file = ''
self.enable_v2_api = True
self.needs_database = False self.needs_database = False
self.log_file = None self.log_file = None
self.sock = sock self.sock = sock
@ -428,7 +427,6 @@ sql_connection = %(sql_connection)s
show_image_direct_url = %(show_image_direct_url)s show_image_direct_url = %(show_image_direct_url)s
show_multiple_locations = %(show_multiple_locations)s show_multiple_locations = %(show_multiple_locations)s
user_storage_quota = %(user_storage_quota)s user_storage_quota = %(user_storage_quota)s
enable_v2_api = %(enable_v2_api)s
lock_path = %(lock_path)s lock_path = %(lock_path)s
property_protection_file = %(property_protection_file)s property_protection_file = %(property_protection_file)s
property_protection_rule_format = %(property_protection_rule_format)s property_protection_rule_format = %(property_protection_rule_format)s
@ -602,7 +600,6 @@ sql_connection = %(sql_connection)s
show_image_direct_url = %(show_image_direct_url)s show_image_direct_url = %(show_image_direct_url)s
show_multiple_locations = %(show_multiple_locations)s show_multiple_locations = %(show_multiple_locations)s
user_storage_quota = %(user_storage_quota)s user_storage_quota = %(user_storage_quota)s
enable_v2_api = %(enable_v2_api)s
lock_path = %(lock_path)s lock_path = %(lock_path)s
property_protection_file = %(property_protection_file)s property_protection_file = %(property_protection_file)s
property_protection_rule_format = %(property_protection_rule_format)s property_protection_rule_format = %(property_protection_rule_format)s

View File

@ -100,7 +100,6 @@ class TestApiVersions(functional.FunctionalTest):
self.assertEqual(versions, content) self.assertEqual(versions, content)
def test_v2_api_configuration(self): def test_v2_api_configuration(self):
self.api_server.enable_v2_api = True
self.start_servers(**self.__dict__.copy()) self.start_servers(**self.__dict__.copy())
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port url = 'http://127.0.0.1:%d/v%%s/' % self.api_port

View File

@ -3640,22 +3640,6 @@ class TestImageDirectURLVisibility(functional.FunctionalTest):
base_headers.update(custom_headers or {}) base_headers.update(custom_headers or {})
return base_headers return base_headers
def test_v2_not_enabled(self):
self.api_server.enable_v2_api = False
self.start_servers(**self.__dict__.copy())
path = self._url('/v2/images')
response = requests.get(path, headers=self._headers())
self.assertEqual(http.MULTIPLE_CHOICES, response.status_code)
self.stop_servers()
def test_v2_enabled(self):
self.api_server.enable_v2_api = True
self.start_servers(**self.__dict__.copy())
path = self._url('/v2/images')
response = requests.get(path, headers=self._headers())
self.assertEqual(http.OK, response.status_code)
self.stop_servers()
def test_image_direct_url_visible(self): def test_image_direct_url_visible(self):
self.api_server.show_image_direct_url = True self.api_server.show_image_direct_url = True

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The deprecated 'enable_v2_api' config option has been
removed.