api: deprecate the api v2 extension configuration

While we are removing the v2 API soon, given the v2.1 API will soon
lose the option of configuring extensions, lets also deprecate these
options in the v2 API as well. This should help advertise the move more
widely.

part of blueprint nova-api-deprecate-extensions

Change-Id: I693a6cd25ef09e3974aa8231c8b3131158c9e1bb
This commit is contained in:
John Garbutt 2015-08-19 14:06:16 +01:00 committed by EdLeafe
parent bd3b5a62b4
commit 64a9ccbea3
2 changed files with 19 additions and 6 deletions

View File

@ -27,9 +27,12 @@ from nova.api.openstack import extensions
ext_opts = [
cfg.ListOpt('osapi_compute_ext_list',
default=[],
help='Specify list of extensions to load when using osapi_'
'compute_extension option with nova.api.openstack.'
'compute.legacy_v2.contrib.select_extensions'),
help='DEPRECATED: Specify list of extensions to load when '
'using osapi_compute_extension option with nova.api.'
'openstack.compute.legacy_v2.contrib.select_extensions '
'This option will be removed in the near future. '
'After that point you have to run all of the API.',
deprecated_for_removal=True),
]
CONF = cfg.CONF
CONF.register_opts(ext_opts)

View File

@ -17,13 +17,19 @@ from oslo_config import cfg
from oslo_log import log as logging
from nova.api.openstack import extensions as base_extensions
from nova.i18n import _LW
STANDARD_EXTENSIONS = ('nova.api.openstack.compute.legacy_v2.contrib.' +
'standard_extensions')
ext_opts = [
cfg.MultiStrOpt(
'osapi_compute_extension',
default=['nova.api.openstack.compute.legacy_v2.contrib.'
'standard_extensions'],
help='osapi compute extension to load'),
default=[STANDARD_EXTENSIONS],
help='osapi compute extension to load. '
'This option will be removed in the near future. '
'After that point you have to run all of the API.',
deprecated_for_removal=True),
]
CONF = cfg.CONF
CONF.register_opts(ext_opts)
@ -34,6 +40,10 @@ LOG = logging.getLogger(__name__)
class ExtensionManager(base_extensions.ExtensionManager):
def __init__(self):
self.cls_list = CONF.osapi_compute_extension
if (len(self.cls_list) > 0 and
self.cls_list[0] != STANDARD_EXTENSIONS):
LOG.warning(_LW('The extension configure options are deprecated. '
'In the near future you must run all of the API.'))
self.extensions = {}
self.sorted_ext_list = []
self._load_extensions()