from quantum.plugins.cisco import l2network_plugin_configuration as conf
from quantum.plugins.openvswitch import ovs_db_v2 as odb
from quantum import quantum_plugin_base_v2
+from quantum.db import api as db_api
LOG = logging.getLogger(__name__)
configured, and load the inventories those device plugins for which the
inventory is configured
"""
- cdb.initialize()
- cred.Store.initialize()
for key in conf.PLUGINS[const.PLUGINS].keys():
plugin_obj = conf.PLUGINS[const.PLUGINS][key]
self._plugins[key] = importutils.import_object(plugin_obj)
LOG.debug(_("Loaded device inventory %s\n"),
conf.PLUGINS[const.INVENTORY][key])
- if hasattr(self._plugins[const.VSWITCH_PLUGIN],
- "supported_extension_aliases"):
+ if ((const.VSWITCH_PLUGIN in self._plugins) and
+ hasattr(self._plugins[const.VSWITCH_PLUGIN],
+ "supported_extension_aliases")):
self.supported_extension_aliases.extend(
self._plugins[const.VSWITCH_PLUGIN].
supported_extension_aliases)
+ # At this point, all the database models should have been loaded. It's
+ # possible that configure_db() may have been called by one of the
+ # plugins loaded in above. Otherwise, this call is to make sure that
+ # the database is initialized
+ db_api.configure_db()
+
+ # Initialize credential store after database initialization
+ cred.Store.initialize()
LOG.debug(_("%(module)s.%(name)s init done"),
{'module': __name__,
'name': self.__class__.__name__})
_plugin_name = 'quantum.plugins.cisco.network_plugin.PluginV2'
def setUp(self):
- def new_init():
- db.configure_db()
-
- with mock.patch.object(network_db_v2,
- 'initialize', new=new_init):
- super(CiscoNetworkPluginV2TestCase, self).setUp(self._plugin_name)
+ super(CiscoNetworkPluginV2TestCase, self).setUp(self._plugin_name)
self.port_create_status = 'DOWN'
def _get_plugin_ref(self):