Add support to dynamically upload drivers in PLUMgrid plugin

PLUMgrid plugin will be able to dynamycally upload any of its available drivers.
It will simplify any CI testing by changing the configuration file for the plugin
instead of changing the code directly.

Change-Id: I56da881688cfdf8f9a1b655c1080c39ffc0133a5
Closes-bug: #1315137
This commit is contained in:
Edgar Magana 2014-05-01 13:25:45 -07:00
parent ea61aaa843
commit 5cecf9571f
2 changed files with 7 additions and 3 deletions

View File

@ -11,3 +11,4 @@
# username=<director-admin-username>
# password=<director-admin-password>
# servertimeout=5
# driver=<plugin-driver>

View File

@ -39,7 +39,6 @@ from neutron.plugins.plumgrid.common import exceptions as plum_excep
from neutron.plugins.plumgrid.plumgrid_plugin.plugin_ver import VERSION
LOG = logging.getLogger(__name__)
PLUM_DRIVER = 'neutron.plugins.plumgrid.drivers.plumlib.Plumlib'
director_server_opts = [
cfg.StrOpt('director_server', default='localhost',
@ -51,7 +50,10 @@ director_server_opts = [
cfg.StrOpt('password', default='password', secret=True,
help=_("PLUMgrid Director admin password")),
cfg.IntOpt('servertimeout', default=5,
help=_("PLUMgrid Director server timeout")), ]
help=_("PLUMgrid Director server timeout")),
cfg.StrOpt('driver',
default="neutron.plugins.plumgrid.drivers.plumlib.Plumlib",
help=_("PLUMgrid Driver")), ]
cfg.CONF.register_opts(director_server_opts, "plumgriddirector")
@ -83,10 +85,11 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2,
director_admin = cfg.CONF.plumgriddirector.username
director_password = cfg.CONF.plumgriddirector.password
timeout = cfg.CONF.plumgriddirector.servertimeout
plum_driver = cfg.CONF.plumgriddirector.driver
# PLUMgrid Director info validation
LOG.info(_('Neutron PLUMgrid Director: %s'), director_plumgrid)
self._plumlib = importutils.import_object(PLUM_DRIVER)
self._plumlib = importutils.import_object(plum_driver)
self._plumlib.director_conn(director_plumgrid, director_port, timeout,
director_admin, director_password)