diff --git a/nova/conf/network.py b/nova/conf/network.py index 9f4ebd93d397..dc12cfcd4656 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -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) diff --git a/nova/network/security_group/openstack_driver.py b/nova/network/security_group/openstack_driver.py index 02a74c74e3a7..096ffa74e57c 100644 --- a/nova/network/security_group/openstack_driver.py +++ b/nova/network/security_group/openstack_driver.py @@ -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() diff --git a/nova/tests/functional/api_sample_tests/test_security_groups.py b/nova/tests/functional/api_sample_tests/test_security_groups.py index 57f2d4e94954..8988bc426505 100644 --- a/nova/tests/functional/api_sample_tests/test_security_groups.py +++ b/nova/tests/functional/api_sample_tests/test_security_groups.py @@ -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) diff --git a/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py b/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py index 8ed6aa3a04ac..1484435992e9 100644 --- a/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py +++ b/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_security_group_default_rules.py b/nova/tests/unit/api/openstack/compute/test_security_group_default_rules.py index 7ad079910249..c790fffa05ae 100644 --- a/nova/tests/unit/api/openstack/compute/test_security_group_default_rules.py +++ b/nova/tests/unit/api/openstack/compute/test_security_group_default_rules.py @@ -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() diff --git a/nova/tests/unit/network/test_config.py b/nova/tests/unit/network/test_config.py index 041bf29022eb..67c7220b46f7 100644 --- a/nova/tests/unit/network/test_config.py +++ b/nova/tests/unit/network/test_config.py @@ -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) diff --git a/nova/tests/unit/test_metadata.py b/nova/tests/unit/test_metadata.py index 8070e4f55e34..1dd154287ac4 100644 --- a/nova/tests/unit/test_metadata.py +++ b/nova/tests/unit/test_metadata.py @@ -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): diff --git a/releasenotes/notes/remove_security_group_api-6fefb1a355876e83.yaml b/releasenotes/notes/remove_security_group_api-6fefb1a355876e83.yaml new file mode 100644 index 000000000000..b8eb4f48feed --- /dev/null +++ b/releasenotes/notes/remove_security_group_api-6fefb1a355876e83.yaml @@ -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.