Merge "Remove deprecated security_group_api config option"
This commit is contained in:
commit
24c75362dd
@ -756,13 +756,6 @@ ldap_dns_opts = [
|
|||||||
'Statement of Authority'),
|
'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 = [
|
driver_opts = [
|
||||||
cfg.StrOpt('network_driver',
|
cfg.StrOpt('network_driver',
|
||||||
default='nova.network.linux_net',
|
default='nova.network.linux_net',
|
||||||
@ -780,14 +773,13 @@ rpcapi_opts = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
ALL_DEFAULT_OPTS = (linux_net_opts + network_opts + ldap_dns_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):
|
def register_opts(conf):
|
||||||
conf.register_opts(linux_net_opts)
|
conf.register_opts(linux_net_opts)
|
||||||
conf.register_opts(network_opts)
|
conf.register_opts(network_opts)
|
||||||
conf.register_opts(ldap_dns_opts)
|
conf.register_opts(ldap_dns_opts)
|
||||||
conf.register_opts(security_group_opts)
|
|
||||||
conf.register_opts(driver_opts)
|
conf.register_opts(driver_opts)
|
||||||
conf.register_opts(rpcapi_opts)
|
conf.register_opts(rpcapi_opts)
|
||||||
|
|
||||||
|
@ -15,12 +15,9 @@
|
|||||||
|
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
import nova.conf
|
|
||||||
import nova.network
|
import nova.network
|
||||||
|
|
||||||
|
|
||||||
CONF = nova.conf.CONF
|
|
||||||
|
|
||||||
NOVA_DRIVER = ('nova.compute.api.SecurityGroupAPI')
|
NOVA_DRIVER = ('nova.compute.api.SecurityGroupAPI')
|
||||||
NEUTRON_DRIVER = ('nova.network.security_group.neutron_driver.'
|
NEUTRON_DRIVER = ('nova.network.security_group.neutron_driver.'
|
||||||
'SecurityGroupAPI')
|
'SecurityGroupAPI')
|
||||||
@ -29,12 +26,9 @@ NEUTRON_DRIVER = ('nova.network.security_group.neutron_driver.'
|
|||||||
def get_openstack_security_group_driver():
|
def get_openstack_security_group_driver():
|
||||||
if is_neutron_security_groups():
|
if is_neutron_security_groups():
|
||||||
return importutils.import_object(NEUTRON_DRIVER)
|
return importutils.import_object(NEUTRON_DRIVER)
|
||||||
elif CONF.security_group_api.lower() == 'nova':
|
|
||||||
return importutils.import_object(NOVA_DRIVER)
|
|
||||||
else:
|
else:
|
||||||
return importutils.import_object(CONF.security_group_api)
|
return importutils.import_object(NOVA_DRIVER)
|
||||||
|
|
||||||
|
|
||||||
def is_neutron_security_groups():
|
def is_neutron_security_groups():
|
||||||
return (CONF.security_group_api.lower() == 'neutron'
|
return nova.network.is_neutron()
|
||||||
or nova.network.is_neutron())
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from nova.tests import fixtures
|
||||||
from nova.tests.functional.api_sample_tests import test_servers
|
from nova.tests.functional.api_sample_tests import test_servers
|
||||||
import nova.tests.functional.api_samples_test_base as astb
|
import nova.tests.functional.api_samples_test_base as astb
|
||||||
|
|
||||||
@ -61,7 +62,9 @@ class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
|||||||
sample_dir = 'os-security-groups'
|
sample_dir = 'os-security-groups'
|
||||||
|
|
||||||
def setUp(self):
|
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()
|
super(SecurityGroupsJsonTest, self).setUp()
|
||||||
path = 'nova.network.security_group.neutron_driver.SecurityGroupAPI.'
|
path = 'nova.network.security_group.neutron_driver.SecurityGroupAPI.'
|
||||||
self.stub_out(path + 'get', fake_get)
|
self.stub_out(path + 'get', fake_get)
|
||||||
|
@ -42,7 +42,7 @@ UUID_SERVER = uuids.server
|
|||||||
class TestNeutronSecurityGroupsTestCase(test.TestCase):
|
class TestNeutronSecurityGroupsTestCase(test.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNeutronSecurityGroupsTestCase, self).setUp()
|
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
|
self.original_client = neutron_api.get_client
|
||||||
neutron_api.get_client = get_client
|
neutron_api.get_client = get_client
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class TestSecurityGroupDefaultRulesNeutronV21(test.TestCase):
|
|||||||
SecurityGroupDefaultRulesController)
|
SecurityGroupDefaultRulesController)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.flags(security_group_api='neutron')
|
self.flags(use_neutron=True)
|
||||||
super(TestSecurityGroupDefaultRulesNeutronV21, self).setUp()
|
super(TestSecurityGroupDefaultRulesNeutronV21, self).setUp()
|
||||||
self.controller = self.controller_cls()
|
self.controller = self.controller_cls()
|
||||||
|
|
||||||
|
@ -18,11 +18,6 @@ import nova.network.security_group.openstack_driver as sgapi
|
|||||||
import nova.test
|
import nova.test
|
||||||
|
|
||||||
|
|
||||||
class FileATicket(object):
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class NetworkAPIConfigTest(nova.test.NoDBTestCase):
|
class NetworkAPIConfigTest(nova.test.NoDBTestCase):
|
||||||
"""Test the transition from legacy to use_neutron config options."""
|
"""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)
|
nova.network.security_group.neutron_driver.SecurityGroupAPI)
|
||||||
|
|
||||||
def test_sg_nova(self):
|
def test_sg_nova(self):
|
||||||
self.flags(security_group_api='nova')
|
self.flags(use_neutron=False)
|
||||||
driver = sgapi.get_openstack_security_group_driver()
|
driver = sgapi.get_openstack_security_group_driver()
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
driver,
|
driver,
|
||||||
nova.compute.api.SecurityGroupAPI)
|
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()
|
self._test_security_groups()
|
||||||
|
|
||||||
def test_neutron_security_groups(self):
|
def test_neutron_security_groups(self):
|
||||||
self.flags(security_group_api='neutron')
|
self.flags(use_neutron=True)
|
||||||
self._test_security_groups()
|
self._test_security_groups()
|
||||||
|
|
||||||
def test_local_hostname_fqdn(self):
|
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…
Reference in New Issue
Block a user