Remove deprecated network_api_class option

This was deprecated in Mitaka and is removed in Newton.

Change-Id: Ia8e3faba59b30fad284041f5b1ba543824d1ccac
This commit is contained in:
Dan Smith 2016-07-07 11:47:52 -07:00 committed by Matt Riedemann
parent 78c6c3b586
commit d82db52a09
7 changed files with 10 additions and 70 deletions

View File

@ -257,12 +257,6 @@ with the name 'mtu'.
None
"""),
cfg.StrOpt('network_api_class',
default=NOVA_NET_API,
help='DEPRECATED: The full class name of the '
'network API class to use. ``use_neutron`` '
'should be used instead.',
deprecated_for_removal=True),
cfg.BoolOpt('use_neutron',
default=False,
help="Whether to use Neutron or Nova Network as the back end "

View File

@ -18,7 +18,6 @@ from oslo_log import log as logging
from oslo_utils import importutils
import nova.conf
from nova.i18n import _LW
LOG = logging.getLogger(__name__)
@ -34,31 +33,11 @@ def is_neutron():
This logic exists as a separate config option
"""
legacy_class = CONF.network_api_class
use_neutron = CONF.use_neutron
if legacy_class not in (NEUTRON_NET_API, NOVA_NET_API):
# Someone actually used this option, this gets a pass for now,
# but will just go away once deleted.
return None
elif legacy_class == NEUTRON_NET_API and not use_neutron:
# If they specified neutron via class, we should respect that
LOG.warn(_LW("Config mismatch. The network_api_class specifies %s, "
"however use_neutron is not set to True. Using Neutron "
"networking for now, however please set use_neutron to "
"True in your configuration as network_api_class is "
"deprecated and will be removed."), legacy_class)
return True
elif use_neutron:
return True
else:
return False
return CONF.use_neutron
def API():
if is_neutron() is None:
network_api_class = CONF.network_api_class
elif is_neutron():
if is_neutron():
network_api_class = NEUTRON_NET_API
else:
network_api_class = NOVA_NET_API

View File

@ -40,20 +40,6 @@ class NetworkAPIConfigTest(nova.test.NoDBTestCase):
netapi = nova.network.API()
self.assertIsInstance(netapi, nova.network.api.API)
def test_legacy_use_neutron(self):
"""use neutron even if config is false because of legacy option."""
self.flags(use_neutron=False)
self.flags(network_api_class='nova.network.neutronv2.api.API')
netapi = nova.network.API()
self.assertIsInstance(netapi, nova.network.neutronv2.api.API)
def test_legacy_custom_class(self):
"""use neutron even if config is false because of legacy option."""
self.flags(network_api_class=
'nova.tests.unit.network.test_config.FileATicket')
netapi = nova.network.API()
self.assertIsInstance(netapi, FileATicket)
class SecurityGroupAPIConfigTest(nova.test.NoDBTestCase):

View File

@ -85,18 +85,6 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
mock_import_object.assert_called_once_with(
vmops.NOVA_VIF_DRIVER)
@mock.patch('nova.network.is_neutron')
def test_load_vif_driver_unknown(self, is_neutron):
# TODO(sdague): delete once network_api_class is removed from
# config.
is_neutron.return_value = None
self.assertRaises(TypeError, self._vmops._load_vif_driver_class)
@mock.patch('nova.virt.hyperv.vmops.importutils.import_object')
def test_load_vif_driver_class_error(self, mock_import_object):
mock_import_object.side_effect = KeyError
self.assertRaises(TypeError, self._vmops._load_vif_driver_class)
def test_list_instances(self):
mock_instance = mock.MagicMock()
self._vmops._vmutils.list_instances.return_value = [mock_instance]

View File

@ -1093,10 +1093,7 @@ def is_neutron():
if _IS_NEUTRON is not None:
return _IS_NEUTRON
# TODO(sdague): As long as network_api_class is importable
# is_neutron can return None to mean we have no idea what their
# class is.
_IS_NEUTRON = (nova.network.is_neutron() is True)
_IS_NEUTRON = nova.network.is_neutron()
return _IS_NEUTRON

View File

@ -85,10 +85,7 @@ NOVA_VIF_DRIVER = 'nova.virt.hyperv.vif.HyperVNovaNetworkVIFDriver'
def get_network_driver():
""""Return the correct network module"""
if nova.network.is_neutron() is None:
# this is an unknown network type, not neutron or nova
raise KeyError()
elif nova.network.is_neutron():
if nova.network.is_neutron():
return NEUTRON_VIF_DRIVER
else:
return NOVA_VIF_DRIVER
@ -115,13 +112,8 @@ class VMOps(object):
self._load_vif_driver_class()
def _load_vif_driver_class(self):
try:
class_name = get_network_driver()
self._vif_driver = importutils.import_object(class_name)
except KeyError:
raise TypeError(_("VIF driver not found for "
"network_api_class: %s") %
CONF.network_api_class)
class_name = get_network_driver()
self._vif_driver = importutils.import_object(class_name)
def list_instance_uuids(self):
instance_uuids = []

View File

@ -0,0 +1,4 @@
---
upgrade:
- The network_api_class option was deprecated in Mitaka and is removed
in Newton. The use_neutron option replaces this functionality.