From 69d0047cfe969da02d44c036fc3c97a1bfdffc19 Mon Sep 17 00:00:00 2001 From: Armando Migliaccio Date: Thu, 9 Nov 2017 12:24:04 -0800 Subject: [PATCH] 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 --- neutron/db/db_base_plugin_v2.py | 3 +++ neutron/manager.py | 6 +++++- neutron/neutron_plugin_base_v2.py | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 1584b7e1208..2d1d885d50b 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/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, diff --git a/neutron/manager.py b/neutron/manager.py index 614ea92de3f..3b2ce67b4a2 100644 --- a/neutron/manager.py +++ b/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. diff --git a/neutron/neutron_plugin_base_v2.py b/neutron/neutron_plugin_base_v2.py index 58cd83cdffe..6afce91d031 100644 --- a/neutron/neutron_plugin_base_v2.py +++ b/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