Remove deprecated DEFAULT options

Cinder, nova, neutron has deprecated some default options
since last release, so it is time to remove those options
in this version. refer to the following deprecation patch.

Ref: https://review.openstack.org/#/c/290511/

Closes-bug: #1766384

Change-Id: I595ff2c82ef40566145fedb202e549be69c45e0c
This commit is contained in:
lijunbo 2018-04-23 20:58:53 +08:00
parent dd78fc3e10
commit 7969d94078
8 changed files with 9 additions and 177 deletions

View File

@ -18,18 +18,6 @@
- Description - Description
* - **[DEFAULT]** * - **[DEFAULT]**
- -
* - ``cinder_admin_auth_url`` = ``http://localhost:5000/v2.0``
- (String) DEPRECATED: Identity service URL. This option isn't used any longer. Please use [cinder] auth_url instead.
* - ``cinder_admin_password`` = ``None``
- (String) DEPRECATED: Cinder admin password. This option isn't used any longer. Please use [cinder] password instead.
* - ``cinder_admin_tenant_name`` = ``service``
- (String) DEPRECATED: Cinder admin tenant name. This option isn't used any longer. Please use [cinder] tenant_name instead.
* - ``cinder_admin_username`` = ``cinder``
- (String) DEPRECATED: Cinder admin username. This option isn't used any longer. Please use [cinder] username instead.
* - ``cinder_catalog_info`` = ``volume:cinder:publicURL``
- (String) DEPRECATED: Info to match when looking for cinder in the service catalog. Format is separated values of the form: <service_type>:<service_name>:<endpoint_type> This option isn't used any longer.
* - ``cinder_volume_type`` = ``None``
- (String) Name or id of cinder volume type which will be used for all volumes created by driver.
* - ``connect_share_server_to_tenant_network`` = ``False`` * - ``connect_share_server_to_tenant_network`` = ``False``
- (Boolean) Attach share server directly to share network. Used only with Neutron and if driver_handles_share_servers=True. - (Boolean) Attach share server directly to share network. Used only with Neutron and if driver_handles_share_servers=True.
* - ``container_volume_group`` = ``manila_docker_volumes`` * - ``container_volume_group`` = ``manila_docker_volumes``

View File

@ -16,15 +16,12 @@
import copy import copy
from keystoneauth1 import loading as ks_loading from keystoneauth1 import loading as ks_loading
from keystoneauth1.loading._plugins.identity import v2
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__)
"""Helper class to support keystone v2 and v3 for clients """Helper class to support keystone v2 and v3 for clients
@ -37,8 +34,7 @@ needed to load all needed parameters dynamically.
class AuthClientLoader(object): class AuthClientLoader(object):
def __init__(self, client_class, exception_module, cfg_group, def __init__(self, client_class, exception_module, cfg_group):
deprecated_opts_for_v2=None):
self.client_class = client_class self.client_class = client_class
self.exception_module = exception_module self.exception_module = exception_module
self.group = cfg_group self.group = cfg_group
@ -46,7 +42,6 @@ class AuthClientLoader(object):
self.conf = CONF self.conf = CONF
self.session = None self.session = None
self.auth_plugin = None self.auth_plugin = None
self.deprecated_opts_for_v2 = deprecated_opts_for_v2
@staticmethod @staticmethod
def list_opts(group): def list_opts(group):
@ -77,11 +72,6 @@ class AuthClientLoader(object):
self.auth_plugin = ks_loading.load_auth_from_conf_options( self.auth_plugin = ks_loading.load_auth_from_conf_options(
CONF, self.group) CONF, self.group)
if self.deprecated_opts_for_v2 and not self.auth_plugin:
LOG.warning("Not specifying auth options is deprecated")
self.auth_plugin = v2.Password().load_from_options(
**self.deprecated_opts_for_v2)
if self.auth_plugin: if self.auth_plugin:
return self.auth_plugin return self.auth_plugin

View File

@ -32,49 +32,6 @@ from manila.i18n import _
NOVA_GROUP = 'nova' NOVA_GROUP = 'nova'
AUTH_OBJ = None AUTH_OBJ = None
nova_deprecated_opts = [
cfg.StrOpt('nova_admin_username',
default='nova',
help='Nova admin username.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please "
"use [nova] username instead."),
cfg.StrOpt('nova_admin_password',
help='Nova admin password.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please "
"use [nova] password instead."),
cfg.StrOpt('nova_admin_tenant_name',
default='service',
help='Nova admin tenant name.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please "
"use [nova] tenant instead."),
cfg.StrOpt('nova_admin_auth_url',
default='http://localhost:5000/v2.0',
help='Identity service URL.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please "
"use [nova] url instead."),
cfg.StrOpt('nova_catalog_info',
default='compute:nova:publicURL',
help='Info to match when looking for nova in the service '
'catalog. Format is separated values of the form: '
'<service_type>:<service_name>:<endpoint_type>',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer."),
cfg.StrOpt('nova_catalog_admin_info',
default='compute:nova:adminURL',
help='Same as nova_catalog_info, but for admin endpoint.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer."),
]
nova_opts = [ nova_opts = [
cfg.StrOpt('api_microversion', cfg.StrOpt('api_microversion',
@ -100,7 +57,6 @@ nova_opts = [
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(nova_deprecated_opts)
CONF.register_opts(core_opts) CONF.register_opts(core_opts)
CONF.register_opts(nova_opts, NOVA_GROUP) CONF.register_opts(nova_opts, NOVA_GROUP)
ks_loading.register_session_conf_options(CONF, NOVA_GROUP) ks_loading.register_session_conf_options(CONF, NOVA_GROUP)
@ -114,17 +70,10 @@ def list_opts():
def novaclient(context): def novaclient(context):
global AUTH_OBJ global AUTH_OBJ
if not AUTH_OBJ: if not AUTH_OBJ:
deprecated_opts_for_v2 = {
'username': CONF.nova_admin_username,
'password': CONF.nova_admin_password,
'tenant_name': CONF.nova_admin_tenant_name,
'auth_url': CONF.nova_admin_auth_url,
}
AUTH_OBJ = client_auth.AuthClientLoader( AUTH_OBJ = client_auth.AuthClientLoader(
client_class=nova_client.Client, client_class=nova_client.Client,
exception_module=nova_exception, exception_module=nova_exception,
cfg_group=NOVA_GROUP, cfg_group=NOVA_GROUP)
deprecated_opts_for_v2=deprecated_opts_for_v2)
return AUTH_OBJ.get_client(context, return AUTH_OBJ.get_client(context,
version=CONF[NOVA_GROUP].api_microversion, version=CONF[NOVA_GROUP].api_microversion,
insecure=CONF[NOVA_GROUP].api_insecure, insecure=CONF[NOVA_GROUP].api_insecure,

View File

@ -27,41 +27,6 @@ from manila.network.neutron import constants as neutron_constants
NEUTRON_GROUP = 'neutron' NEUTRON_GROUP = 'neutron'
neutron_deprecated_opts = [
cfg.StrOpt(
'neutron_admin_username',
default='neutron',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please use "
"[neutron] username instead.",
help='Username for connecting to neutron in admin context.'),
cfg.StrOpt(
'neutron_admin_password',
help='Password for connecting to neutron in admin context.',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please use "
"[neutron] password instead.",
secret=True),
cfg.StrOpt(
'neutron_admin_project_name',
default='service',
deprecated_group='DEFAULT',
deprecated_name='neutron_admin_tenant_name',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please use "
"[neutron] project instead.",
help='Project name for connecting to Neutron in admin context.'),
cfg.StrOpt(
'neutron_admin_auth_url',
default='http://localhost:5000/v2.0',
deprecated_group='DEFAULT',
deprecated_for_removal=True,
deprecated_reason="This option isn't used any longer. Please use "
"[neutron] auth_url instead.",
help='Auth URL for connecting to neutron in admin context.'),
]
neutron_opts = [ neutron_opts = [
cfg.StrOpt( cfg.StrOpt(
@ -121,8 +86,6 @@ class API(object):
ks_loading.register_session_conf_options(CONF, NEUTRON_GROUP) ks_loading.register_session_conf_options(CONF, NEUTRON_GROUP)
ks_loading.register_auth_conf_options(CONF, NEUTRON_GROUP) ks_loading.register_auth_conf_options(CONF, NEUTRON_GROUP)
CONF.register_opts(neutron_opts, NEUTRON_GROUP) CONF.register_opts(neutron_opts, NEUTRON_GROUP)
CONF.register_opts(neutron_deprecated_opts,
group=self.config_group_name)
self.configuration = getattr(CONF, self.config_group_name, CONF) self.configuration = getattr(CONF, self.config_group_name, CONF)
self.last_neutron_extension_sync = None self.last_neutron_extension_sync = None
@ -135,18 +98,10 @@ class API(object):
def get_client(self, context): def get_client(self, context):
if not self.auth_obj: if not self.auth_obj:
config = CONF[self.config_group_name]
v2_deprecated_opts = {
'username': config.neutron_admin_username,
'password': config.neutron_admin_password,
'tenant_name': config.neutron_admin_project_name,
'auth_url': config.neutron_admin_auth_url,
}
self.auth_obj = client_auth.AuthClientLoader( self.auth_obj = client_auth.AuthClientLoader(
client_class=clientv20.Client, client_class=clientv20.Client,
exception_module=neutron_client_exc, exception_module=neutron_client_exc,
cfg_group=NEUTRON_GROUP, cfg_group=NEUTRON_GROUP)
deprecated_opts_for_v2=v2_deprecated_opts)
return self.auth_obj.get_client( return self.auth_obj.get_client(
self, self,

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
from keystoneauth1 import loading as auth from keystoneauth1 import loading as auth
from keystoneauth1.loading._plugins.identity import v2
from oslo_config import cfg from oslo_config import cfg
import mock import mock
@ -64,20 +63,6 @@ class ClientAuthTestCase(test.TestCase):
self.assertRaises(fake_client_exception_class.Unauthorized, self.assertRaises(fake_client_exception_class.Unauthorized,
self.auth._load_auth_plugin) self.auth._load_auth_plugin)
def test_load_auth_plugin_no_auth_deprecated_opts(self):
auth.load_auth_from_conf_options.return_value = None
self.auth.deprecated_opts_for_v2 = {"username": "foo"}
pwd_mock = self.mock_object(v2, 'Password')
auth_result = mock.Mock()
auth_result.load_from_options = mock.Mock(return_value='foo_auth')
pwd_mock.return_value = auth_result
result = self.auth._load_auth_plugin()
pwd_mock.assert_called_once_with()
auth_result.load_from_options.assert_called_once_with(username='foo')
self.assertEqual(result, 'foo_auth')
@mock.patch.object(auth, 'register_session_conf_options') @mock.patch.object(auth, 'register_session_conf_options')
@mock.patch.object(auth, 'get_auth_common_conf_options') @mock.patch.object(auth, 'get_auth_common_conf_options')
@mock.patch.object(auth, 'get_auth_plugin_conf_options') @mock.patch.object(auth, 'get_auth_plugin_conf_options')

View File

@ -133,12 +133,6 @@ class NovaclientTestCase(test.TestCase):
nova.client_auth, 'AuthClientLoader') nova.client_auth, 'AuthClientLoader')
fake_context = 'fake_context' fake_context = 'fake_context'
data = { data = {
'DEFAULT': {
'nova_admin_username': 'foo_username',
'nova_admin_password': 'foo_password',
'nova_admin_tenant_name': 'foo_tenant_name',
'nova_admin_auth_url': 'foo_auth_url',
},
'nova': { 'nova': {
'api_microversion': 'foo_api_microversion', 'api_microversion': 'foo_api_microversion',
'api_insecure': True, 'api_insecure': True,
@ -154,13 +148,7 @@ class NovaclientTestCase(test.TestCase):
mock_client_loader.assert_called_once_with( mock_client_loader.assert_called_once_with(
client_class=nova.nova_client.Client, client_class=nova.nova_client.Client,
exception_module=nova.nova_exception, exception_module=nova.nova_exception,
cfg_group=nova.NOVA_GROUP, cfg_group=nova.NOVA_GROUP
deprecated_opts_for_v2={
'username': data['DEFAULT']['nova_admin_username'],
'password': data['DEFAULT']['nova_admin_password'],
'tenant_name': data['DEFAULT']['nova_admin_tenant_name'],
'auth_url': data['DEFAULT']['nova_admin_auth_url'],
},
) )
mock_client_loader.return_value.get_client.assert_called_once_with( mock_client_loader.return_value.get_client.assert_called_once_with(
fake_context, fake_context,

View File

@ -88,12 +88,6 @@ class NeutronclientTestCase(test.TestCase):
neutron_api.client_auth, 'AuthClientLoader') neutron_api.client_auth, 'AuthClientLoader')
fake_context = 'fake_context' fake_context = 'fake_context'
data = { data = {
'DEFAULT': {
'neutron_admin_username': 'foo_username',
'neutron_admin_password': 'foo_password',
'neutron_admin_tenant_name': 'foo_tenant_name',
'neutron_admin_auth_url': 'foo_auth_url',
},
'neutron': { 'neutron': {
'endpoint_type': 'foo_endpoint_type', 'endpoint_type': 'foo_endpoint_type',
'region_name': 'foo_region_name', 'region_name': 'foo_region_name',
@ -108,13 +102,7 @@ class NeutronclientTestCase(test.TestCase):
mock_client_loader.assert_called_once_with( mock_client_loader.assert_called_once_with(
client_class=neutron_api.clientv20.Client, client_class=neutron_api.clientv20.Client,
exception_module=neutron_api.neutron_client_exc, exception_module=neutron_api.neutron_client_exc,
cfg_group=neutron_api.NEUTRON_GROUP, cfg_group=neutron_api.NEUTRON_GROUP
deprecated_opts_for_v2={
'username': data['DEFAULT']['neutron_admin_username'],
'password': data['DEFAULT']['neutron_admin_password'],
'tenant_name': data['DEFAULT']['neutron_admin_tenant_name'],
'auth_url': data['DEFAULT']['neutron_admin_auth_url'],
},
) )
mock_client_loader.return_value.get_client.assert_called_once_with( mock_client_loader.return_value.get_client.assert_called_once_with(
self.client, self.client,
@ -165,21 +153,6 @@ class NeutronApiTest(test.TestCase):
self.assertTrue(hasattr(neutron_api_instance, 'configuration')) self.assertTrue(hasattr(neutron_api_instance, 'configuration'))
self.assertEqual('DEFAULT', neutron_api_instance.config_group_name) self.assertEqual('DEFAULT', neutron_api_instance.config_group_name)
def test_create_api_object_custom_config_group(self):
# Set up test data
fake_config_group_name = 'fake_config_group_name'
# instantiate Neutron API object
obj = neutron_api.API(fake_config_group_name)
obj.get_client(mock.Mock())
# Verify results
self.assertTrue(clientv20.Client.called)
self.assertTrue(hasattr(obj, 'client'))
self.assertTrue(hasattr(obj, 'configuration'))
self.assertEqual(
fake_config_group_name, obj.configuration._group.name)
def test_create_port_with_all_args(self): def test_create_port_with_all_args(self):
# Set up test data # Set up test data
self.mock_object(self.neutron_api, '_has_port_binding_extension', self.mock_object(self.neutron_api, '_has_port_binding_extension',

View File

@ -0,0 +1,4 @@
---
deprecations:
- |
Remove deprecated cinder, neutron, nova options in DEFAULT group.