Browse Source

Do not load default service plugins if core plugin is not DB based

Some service plugins make the assumption that Neutron is running
with a datastore (e.g. revision and timestamps). As the datastore
setup is a responsibility of the Neutron core plugin, checking
that this is indeed true avoids errors for those plugins that do
not implement any DB backend (e.g. monolithic OpenContrail plugin).

Change-Id: I872fa6e3c3925e521150d79bba864101d9a5f648
Closes-bug: #1700651
changes/88/518788/2
Armando Migliaccio 4 years ago
parent
commit
69d0047cfe
  1. 3
      neutron/db/db_base_plugin_v2.py
  2. 6
      neutron/manager.py
  3. 7
      neutron/neutron_plugin_base_v2.py

3
neutron/db/db_base_plugin_v2.py

@ -140,6 +140,9 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
__native_pagination_support = True
__native_sorting_support = True
def has_native_datastore(self):
return True
def __new__(cls, *args, **kwargs):
model_query.register_hook(
models_v2.Port,

6
neutron/manager.py

@ -179,7 +179,11 @@ class NeutronManager(object):
def _get_default_service_plugins(self):
"""Get default service plugins to be loaded."""
return constants.DEFAULT_SERVICE_PLUGINS.keys()
core_plugin = directory.get_plugin()
if core_plugin.has_native_datastore():
return constants.DEFAULT_SERVICE_PLUGINS.keys()
else:
return []
def _load_service_plugins(self):
"""Loads service plugins.

7
neutron/neutron_plugin_base_v2.py

@ -410,3 +410,10 @@ class NeutronPluginBaseV2(base_services.WorkerBase):
"""
return (self.__class__.start_rpc_state_reports_listener !=
NeutronPluginBaseV2.start_rpc_state_reports_listener)
def has_native_datastore(self):
"""Return True if the plugin uses Neutron's native datastore.
.. note:: plugins like ML2 should override this method and return True.
"""
return False
Loading…
Cancel
Save