From: Edgar Magana Date: Thu, 1 May 2014 20:25:45 +0000 (-0700) Subject: Add support to dynamically upload drivers in PLUMgrid plugin X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5cecf9571f93f89ceaa024cae0a7368767643931;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/etc/neutron/plugins/plumgrid/plumgrid.ini b/etc/neutron/plugins/plumgrid/plumgrid.ini index e9ea3111b..bfe8062ae 100644 --- a/etc/neutron/plugins/plumgrid/plumgrid.ini +++ b/etc/neutron/plugins/plumgrid/plumgrid.ini @@ -11,3 +11,4 @@ # username= # password= # servertimeout=5 +# driver= diff --git a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py index 5a1c31084..c017e44e6 100644 --- a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py +++ b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py @@ -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)