Remove deprecated security_group_api config option
The security_group_api config option was deprecated in version 13.0.0 and functionality was replaced by a 'use_neutron' configuration option. Uses of the deprecated security_group_api option have been updated to 'use_neutron' for a more coherent user experience. Co-Authored-By: Sarah Ulmer <Sarah.Ulmer@ibm.com> Change-Id: I921650d8730201c2f14deb7e679647a892dbe48a
This commit is contained in:
parent
a0ad1258a5
commit
34eed4a4d4
@ -756,13 +756,6 @@ ldap_dns_opts = [
|
||||
'Statement of Authority'),
|
||||
]
|
||||
|
||||
security_group_opts = [
|
||||
cfg.StrOpt('security_group_api',
|
||||
default='nova',
|
||||
help='DEPRECATED: Full class name of the security API class',
|
||||
deprecated_for_removal=True),
|
||||
]
|
||||
|
||||
driver_opts = [
|
||||
cfg.StrOpt('network_driver',
|
||||
default='nova.network.linux_net',
|
||||
@ -780,14 +773,13 @@ rpcapi_opts = [
|
||||
]
|
||||
|
||||
ALL_DEFAULT_OPTS = (linux_net_opts + network_opts + ldap_dns_opts
|
||||
+ security_group_opts + rpcapi_opts + driver_opts)
|
||||
+ rpcapi_opts + driver_opts)
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(linux_net_opts)
|
||||
conf.register_opts(network_opts)
|
||||
conf.register_opts(ldap_dns_opts)
|
||||
conf.register_opts(security_group_opts)
|
||||
conf.register_opts(driver_opts)
|
||||
conf.register_opts(rpcapi_opts)
|
||||
|
||||
|
@ -15,12 +15,9 @@
|
||||
|
||||
from oslo_utils import importutils
|
||||
|
||||
import nova.conf
|
||||
import nova.network
|
||||
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
NOVA_DRIVER = ('nova.compute.api.SecurityGroupAPI')
|
||||
NEUTRON_DRIVER = ('nova.network.security_group.neutron_driver.'
|
||||
'SecurityGroupAPI')
|
||||
@ -29,12 +26,9 @@ NEUTRON_DRIVER = ('nova.network.security_group.neutron_driver.'
|
||||
def get_openstack_security_group_driver():
|
||||
if is_neutron_security_groups():
|
||||
return importutils.import_object(NEUTRON_DRIVER)
|
||||
elif CONF.security_group_api.lower() == 'nova':
|
||||
return importutils.import_object(NOVA_DRIVER)
|
||||
else:
|
||||
return importutils.import_object(CONF.security_group_api)
|
||||
return importutils.import_object(NOVA_DRIVER)
|
||||
|
||||
|
||||
def is_neutron_security_groups():
|
||||
return (CONF.security_group_api.lower() == 'neutron'
|
||||
or nova.network.is_neutron())
|
||||
return nova.network.is_neutron()
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.tests import fixtures
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
import nova.tests.functional.api_samples_test_base as astb
|
||||
|
||||
@ -61,7 +62,9 @@ class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
||||
sample_dir = 'os-security-groups'
|
||||
|
||||
def setUp(self):
|
||||
self.flags(security_group_api=('neutron'))
|
||||
self.flags(use_neutron=True)
|
||||
self.neutron = fixtures.NeutronFixture(self)
|
||||
self.useFixture(self.neutron)
|
||||
super(SecurityGroupsJsonTest, self).setUp()
|
||||
path = 'nova.network.security_group.neutron_driver.SecurityGroupAPI.'
|
||||
self.stub_out(path + 'get', fake_get)
|
||||
|
@ -42,7 +42,7 @@ UUID_SERVER = uuids.server
|
||||
class TestNeutronSecurityGroupsTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(TestNeutronSecurityGroupsTestCase, self).setUp()
|
||||
cfg.CONF.set_override('security_group_api', 'neutron')
|
||||
cfg.CONF.set_override('use_neutron', True)
|
||||
self.original_client = neutron_api.get_client
|
||||
neutron_api.get_client = get_client
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TestSecurityGroupDefaultRulesNeutronV21(test.TestCase):
|
||||
SecurityGroupDefaultRulesController)
|
||||
|
||||
def setUp(self):
|
||||
self.flags(security_group_api='neutron')
|
||||
self.flags(use_neutron=True)
|
||||
super(TestSecurityGroupDefaultRulesNeutronV21, self).setUp()
|
||||
self.controller = self.controller_cls()
|
||||
|
||||
|
@ -18,11 +18,6 @@ import nova.network.security_group.openstack_driver as sgapi
|
||||
import nova.test
|
||||
|
||||
|
||||
class FileATicket(object):
|
||||
def __init__(self, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class NetworkAPIConfigTest(nova.test.NoDBTestCase):
|
||||
"""Test the transition from legacy to use_neutron config options."""
|
||||
|
||||
@ -51,21 +46,8 @@ class SecurityGroupAPIConfigTest(nova.test.NoDBTestCase):
|
||||
nova.network.security_group.neutron_driver.SecurityGroupAPI)
|
||||
|
||||
def test_sg_nova(self):
|
||||
self.flags(security_group_api='nova')
|
||||
self.flags(use_neutron=False)
|
||||
driver = sgapi.get_openstack_security_group_driver()
|
||||
self.assertIsInstance(
|
||||
driver,
|
||||
nova.compute.api.SecurityGroupAPI)
|
||||
|
||||
def test_sg_neutron(self):
|
||||
self.flags(security_group_api='neutron')
|
||||
driver = sgapi.get_openstack_security_group_driver()
|
||||
self.assertIsInstance(
|
||||
driver,
|
||||
nova.network.security_group.neutron_driver.SecurityGroupAPI)
|
||||
|
||||
def test_sg_custom(self):
|
||||
self.flags(security_group_api=
|
||||
'nova.tests.unit.network.test_config.FileATicket')
|
||||
driver = sgapi.get_openstack_security_group_driver()
|
||||
self.assertIsInstance(driver, FileATicket)
|
||||
|
@ -291,7 +291,7 @@ class MetadataTestCase(test.TestCase):
|
||||
self._test_security_groups()
|
||||
|
||||
def test_neutron_security_groups(self):
|
||||
self.flags(security_group_api='neutron')
|
||||
self.flags(use_neutron=True)
|
||||
self._test_security_groups()
|
||||
|
||||
def test_local_hostname_fqdn(self):
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- Removed the ``security_group_api`` configuration option that was deprecated
|
||||
in Mitaka. The correct security_group_api option will be chosen based on
|
||||
the value of ``use_neutron`` which provides a more coherent user experience.
|
Loading…
x
Reference in New Issue
Block a user