Merge "Add disable_drivers config option"
This commit is contained in:
commit
4ff9c085a4
@ -55,6 +55,10 @@ core_opts = [
|
||||
deprecated_for_removal=True,
|
||||
deprecated_reason='automatically loads all configured drivers',
|
||||
help=_('List of driver class paths to import.')),
|
||||
cfg.ListOpt('disabled_drivers',
|
||||
default=[],
|
||||
help=_('List of driver names to be disabled. For example, '
|
||||
'disabled_drivers=nova, plexxi')),
|
||||
cfg.IntOpt('datasource_sync_period', default=60,
|
||||
help='The number of seconds to wait between synchronizing '
|
||||
'datasource config from the database'),
|
||||
|
@ -514,6 +514,7 @@ class DseNode(object):
|
||||
invoke_on_load=False)
|
||||
|
||||
for driver in mgr:
|
||||
if driver.name not in cfg.CONF.disabled_drivers:
|
||||
result[driver.name] = driver
|
||||
|
||||
cls.loaded_drivers = result
|
||||
|
@ -235,7 +235,8 @@ class DatasourceNotFound(NotFound):
|
||||
|
||||
|
||||
class DriverNotFound(NotFound):
|
||||
msg_fmt = _("Driver not found %(id)s")
|
||||
msg_fmt = _("Driver not found %(id)s. Either not supported or disabled by "
|
||||
"deployer in Congress config")
|
||||
|
||||
|
||||
class DatasourceCreationError(BadConfig):
|
||||
|
@ -17,6 +17,8 @@ from __future__ import print_function
|
||||
from __future__ import division
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from congress.api import webservice
|
||||
from congress.tests.api import base as api_base
|
||||
from congress.tests import base
|
||||
@ -28,20 +30,8 @@ class TestDriverModel(base.SqlTestCase):
|
||||
super(TestDriverModel, self).setUp()
|
||||
services = api_base.setup_config()
|
||||
self.node = services['node']
|
||||
self.ds_manager = services['ds_manager']
|
||||
|
||||
self.ds_manager.add_datasource(self._get_datasource_request())
|
||||
self.driver_model = services['api']['api-system']
|
||||
|
||||
def _get_datasource_request(self):
|
||||
req = {'driver': 'fake_datasource',
|
||||
'name': 'fake_datasource'}
|
||||
req['config'] = {'auth_url': 'foo',
|
||||
'username': 'foo',
|
||||
'password': 'password',
|
||||
'tenant_name': 'foo'}
|
||||
return req
|
||||
|
||||
def tearDown(self):
|
||||
super(TestDriverModel, self).tearDown()
|
||||
|
||||
@ -53,6 +43,15 @@ class TestDriverModel(base.SqlTestCase):
|
||||
actual_ret = sorted(ret, key=lambda d: d['id'])
|
||||
self.assertEqual(expected_ret, actual_ret)
|
||||
|
||||
def test_drivers_list_with_disabled_drivers(self):
|
||||
cfg.CONF.set_override('disabled_drivers', 'plexxi')
|
||||
services = api_base.setup_config(node_id='test-node-1')
|
||||
driver_api = services['api']['api-system']
|
||||
drivers = [d['id'] for d in helper.supported_drivers()]
|
||||
drivers.remove('plexxi')
|
||||
ret = [d['id'] for d in driver_api.get_items({}, {})['results']]
|
||||
self.assertEqual(sorted(drivers), sorted(ret))
|
||||
|
||||
def test_driver_details(self):
|
||||
context = {
|
||||
"driver_id": "fake_datasource"
|
||||
|
@ -186,10 +186,7 @@ class TestDataSource(base.SqlTestCase):
|
||||
self.assertRaises(congressException.DatasourceNotFound,
|
||||
self.ds_manager.delete_datasource, req)
|
||||
|
||||
# TODO(dse2): Doesn't seem like we need this (or it will be moved to API).
|
||||
# def test_get_driver_schema(self):
|
||||
# schema = self.datasource_mgr.get_driver_schema(
|
||||
# 'fake_datasource')
|
||||
# self.assertEqual(
|
||||
# schema,
|
||||
# fake_datasource.FakeDataSource.get_schema())
|
||||
def test_get_driver_schema(self):
|
||||
schema = self.dseNode.get_driver_schema('fake_datasource')
|
||||
self.assertEqual(schema,
|
||||
fake_datasource.FakeDataSource.get_schema())
|
||||
|
@ -60,27 +60,6 @@ function configure_congress {
|
||||
iniset $CONGRESS_CONF DEFAULT datasource_sync_period 30
|
||||
iniset $CONGRESS_CONF DEFAULT replicated_policy_engine "$CONGRESS_REPLICATED"
|
||||
iniset $CONGRESS_CONF DEFAULT transport_url rabbit://$RABBIT_USERID:$RABBIT_PASSWORD@$RABBIT_HOST:5672
|
||||
|
||||
CONGRESS_DRIVERS="congress.datasources.neutronv2_driver.NeutronV2Driver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.neutronv2_qos_driver.NeutronV2QosDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.glancev2_driver.GlanceV2Driver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.nova_driver.NovaDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.keystonev3_driver.KeystoneV3Driver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.cinder_driver.CinderDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.swift_driver.SwiftDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.plexxi_driver.PlexxiDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.vCenter_driver.VCenterDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.murano_driver.MuranoDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.ironic_driver.IronicDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.heatv1_driver.HeatV1Driver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.doctor_driver.DoctorDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.aodh_driver.AodhDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.cfgvalidator_driver.ValidatorDriver,"
|
||||
CONGRESS_DRIVERS+="congress.datasources.mistral_driver.MistralDriver,"
|
||||
CONGRESS_DRIVERS+="congress.tests.fake_datasource.FakeDataSource"
|
||||
|
||||
iniset $CONGRESS_CONF DEFAULT drivers $CONGRESS_DRIVERS
|
||||
|
||||
iniset $CONGRESS_CONF database connection `database_connection_url $CONGRESS_DB_NAME`
|
||||
|
||||
_congress_setup_keystone $CONGRESS_CONF keystone_authtoken
|
||||
|
Loading…
Reference in New Issue
Block a user