Remove 'v3' from extension code
This is part of the v3 cleanup effort. The 'API_V3_CORE_EXTENSIONS' attribute has been re-named to 'API_V21_CORE_EXTENSIONS'. Partial-Bug: #1462901 Change-Id: I2867b7788b06a56c594153dd9e0361788112793f
This commit is contained in:
parent
28d2b0df5a
commit
7d3f90cd9e
|
@ -69,20 +69,20 @@ CONF = cfg.CONF
|
|||
CONF.register_group(api_opts_group)
|
||||
CONF.register_opts(api_opts, api_opts_group)
|
||||
|
||||
# List of v3 API extensions which are considered to form
|
||||
# List of v21 API extensions which are considered to form
|
||||
# the core API and so must be present
|
||||
# TODO(cyeoh): Expand this list as the core APIs are ported to V3
|
||||
API_V3_CORE_EXTENSIONS = set(['os-consoles',
|
||||
'extensions',
|
||||
'os-flavor-extra-specs',
|
||||
'os-flavor-manage',
|
||||
'flavors',
|
||||
'ips',
|
||||
'os-keypairs',
|
||||
'os-flavor-access',
|
||||
'server-metadata',
|
||||
'servers',
|
||||
'versions'])
|
||||
# TODO(cyeoh): Expand this list as the core APIs are ported to v21
|
||||
API_V21_CORE_EXTENSIONS = set(['os-consoles',
|
||||
'extensions',
|
||||
'os-flavor-extra-specs',
|
||||
'os-flavor-manage',
|
||||
'flavors',
|
||||
'ips',
|
||||
'os-keypairs',
|
||||
'os-flavor-access',
|
||||
'server-metadata',
|
||||
'servers',
|
||||
'versions'])
|
||||
|
||||
|
||||
class FaultWrapper(base_wsgi.Middleware):
|
||||
|
@ -337,7 +337,7 @@ class APIRouterV21(base_wsgi.Router):
|
|||
return False
|
||||
|
||||
if not CONF.osapi_v21.enabled:
|
||||
LOG.info(_LI("V3 API has been disabled by configuration"))
|
||||
LOG.info(_LI("V2.1 API has been disabled by configuration"))
|
||||
LOG.warning(_LW("In the M release you must run the v2.1 API."))
|
||||
return
|
||||
|
||||
|
@ -349,9 +349,9 @@ class APIRouterV21(base_wsgi.Router):
|
|||
'the codebase to ensure there is a single Compute API.'))
|
||||
|
||||
self.init_only = init_only
|
||||
LOG.debug("v3 API Extension Blacklist: %s",
|
||||
LOG.debug("v21 API Extension Blacklist: %s",
|
||||
CONF.osapi_v21.extensions_blacklist)
|
||||
LOG.debug("v3 API Extension Whitelist: %s",
|
||||
LOG.debug("v21 API Extension Whitelist: %s",
|
||||
CONF.osapi_v21.extensions_whitelist)
|
||||
|
||||
in_blacklist_and_whitelist = set(
|
||||
|
@ -416,7 +416,7 @@ class APIRouterV21(base_wsgi.Router):
|
|||
@staticmethod
|
||||
def get_missing_core_extensions(extensions_loaded):
|
||||
extensions_loaded = set(extensions_loaded)
|
||||
missing_extensions = API_V3_CORE_EXTENSIONS - extensions_loaded
|
||||
missing_extensions = API_V21_CORE_EXTENSIONS - extensions_loaded
|
||||
return list(missing_extensions)
|
||||
|
||||
@property
|
||||
|
|
|
@ -18,7 +18,7 @@ from oslo_config import cfg
|
|||
import testscenarios
|
||||
|
||||
from nova.api import openstack
|
||||
from nova.api.openstack import API_V3_CORE_EXTENSIONS # noqa
|
||||
from nova.api.openstack import API_V21_CORE_EXTENSIONS # noqa
|
||||
from nova.api.openstack import compute
|
||||
from nova import test
|
||||
from nova.tests.functional import api_paste_fixture
|
||||
|
@ -47,7 +47,7 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
|
|||
# Set the whitelist to ensure only the extensions we are
|
||||
# interested in are loaded so the api samples don't include
|
||||
# data from extensions we are not interested in
|
||||
whitelist = API_V3_CORE_EXTENSIONS.copy()
|
||||
whitelist = API_V21_CORE_EXTENSIONS.copy()
|
||||
if self.extension_name:
|
||||
whitelist.add(self.extension_name)
|
||||
if self.extra_extensions_to_load:
|
||||
|
|
|
@ -60,7 +60,7 @@ class fake_loaded_extension_info(object):
|
|||
class ExtensionLoadingTestCase(test.NoDBTestCase):
|
||||
|
||||
def _set_v21_core(self, core_extensions):
|
||||
openstack.API_V3_CORE_EXTENSIONS = core_extensions
|
||||
openstack.API_V21_CORE_EXTENSIONS = core_extensions
|
||||
|
||||
def test_extensions_loaded(self):
|
||||
app = compute.APIRouterV21()
|
||||
|
@ -95,8 +95,8 @@ class ExtensionLoadingTestCase(test.NoDBTestCase):
|
|||
def test_extensions_whitelist_accept(self):
|
||||
# NOTE(maurosr): just to avoid to get an exception raised for not
|
||||
# loading all core api.
|
||||
v21_core = openstack.API_V3_CORE_EXTENSIONS
|
||||
openstack.API_V3_CORE_EXTENSIONS = set(['servers'])
|
||||
v21_core = openstack.API_V21_CORE_EXTENSIONS
|
||||
openstack.API_V21_CORE_EXTENSIONS = set(['servers'])
|
||||
self.addCleanup(self._set_v21_core, v21_core)
|
||||
|
||||
app = compute.APIRouterV21()
|
||||
|
@ -109,8 +109,8 @@ class ExtensionLoadingTestCase(test.NoDBTestCase):
|
|||
def test_extensions_whitelist_block(self):
|
||||
# NOTE(maurosr): just to avoid to get an exception raised for not
|
||||
# loading all core api.
|
||||
v21_core = openstack.API_V3_CORE_EXTENSIONS
|
||||
openstack.API_V3_CORE_EXTENSIONS = set(['servers'])
|
||||
v21_core = openstack.API_V21_CORE_EXTENSIONS
|
||||
openstack.API_V21_CORE_EXTENSIONS = set(['servers'])
|
||||
self.addCleanup(self._set_v21_core, v21_core)
|
||||
|
||||
app = compute.APIRouterV21()
|
||||
|
@ -122,8 +122,8 @@ class ExtensionLoadingTestCase(test.NoDBTestCase):
|
|||
def test_blacklist_overrides_whitelist(self):
|
||||
# NOTE(maurosr): just to avoid to get an exception raised for not
|
||||
# loading all core api.
|
||||
v21_core = openstack.API_V3_CORE_EXTENSIONS
|
||||
openstack.API_V3_CORE_EXTENSIONS = set(['servers'])
|
||||
v21_core = openstack.API_V21_CORE_EXTENSIONS
|
||||
openstack.API_V21_CORE_EXTENSIONS = set(['servers'])
|
||||
self.addCleanup(self._set_v21_core, v21_core)
|
||||
|
||||
app = compute.APIRouterV21()
|
||||
|
@ -137,8 +137,8 @@ class ExtensionLoadingTestCase(test.NoDBTestCase):
|
|||
self.assertEqual(1, len(app._loaded_extension_info.extensions))
|
||||
|
||||
def test_get_missing_core_extensions(self):
|
||||
v21_core = openstack.API_V3_CORE_EXTENSIONS
|
||||
openstack.API_V3_CORE_EXTENSIONS = set(['core1', 'core2'])
|
||||
v21_core = openstack.API_V21_CORE_EXTENSIONS
|
||||
openstack.API_V21_CORE_EXTENSIONS = set(['core1', 'core2'])
|
||||
self.addCleanup(self._set_v21_core, v21_core)
|
||||
self.assertEqual(0, len(
|
||||
compute.APIRouterV21.get_missing_core_extensions(
|
||||
|
@ -162,8 +162,8 @@ class ExtensionLoadingTestCase(test.NoDBTestCase):
|
|||
fake_stevedore_enabled_extensions)
|
||||
self.stubs.Set(extension_info, 'LoadedExtensionInfo',
|
||||
fake_loaded_extension_info)
|
||||
v21_core = openstack.API_V3_CORE_EXTENSIONS
|
||||
openstack.API_V3_CORE_EXTENSIONS = set(['core1', 'core2'])
|
||||
v21_core = openstack.API_V21_CORE_EXTENSIONS
|
||||
openstack.API_V21_CORE_EXTENSIONS = set(['core1', 'core2'])
|
||||
self.addCleanup(self._set_v21_core, v21_core)
|
||||
# if no core API extensions are missing then an exception will
|
||||
# not be raised when creating an instance of compute.APIRouterV21
|
||||
|
|
Loading…
Reference in New Issue