Browse Source

Remove passing DB reference to drivers in Share Manager

- Remove passing DB reference to drivers in __init__() method
- Remove db reference from Generic driver and service_instance
- Remove db reference from Netapp share driver
- Remove db reference from Glusterfs share driver
- Remove db reference from Glusterfs_Native share driver
- Remove db reference from Quobyte share driver
- Remove db reference from IBM GPFS driver
- Remove db reference from HDS_SOP driver
- Remove db reference from HDFSNative driver
- Remove db reference from fake driver
- Remove db reference from unit tests.

Change-Id: I74a636a8897caa6fc4af833c1568471fe1cb0987
changes/86/174786/5
Igor Malinovskiy 7 years ago
parent
commit
94e8c921db
  1. 5
      manila/share/drivers/generic.py
  2. 3
      manila/share/drivers/glusterfs.py
  3. 3
      manila/share/drivers/glusterfs_native.py
  4. 3
      manila/share/drivers/hdfs/hdfs_native.py
  5. 3
      manila/share/drivers/hds/sop.py
  6. 3
      manila/share/drivers/ibm/gpfs.py
  7. 4
      manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py
  8. 4
      manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py
  9. 3
      manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py
  10. 4
      manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py
  11. 3
      manila/share/drivers/quobyte/quobyte.py
  12. 3
      manila/share/drivers/service_instance.py
  13. 2
      manila/share/manager.py
  14. 8
      manila/tests/fake_driver.py
  15. 2
      manila/tests/share/drivers/hdfs/test_hdfs_native.py
  16. 4
      manila/tests/share/drivers/hds/test_sop.py
  17. 4
      manila/tests/share/drivers/ibm/test_gpfs.py
  18. 5
      manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py
  19. 3
      manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py
  20. 3
      manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py
  21. 11
      manila/tests/share/drivers/netapp/test_common.py
  22. 4
      manila/tests/share/drivers/quobyte/test_quobyte.py
  23. 3
      manila/tests/share/drivers/test_generic.py
  24. 3
      manila/tests/share/drivers/test_glusterfs.py
  25. 3
      manila/tests/share/drivers/test_glusterfs_native.py
  26. 33
      manila/tests/share/drivers/test_service_instance.py

5
manila/share/drivers/generic.py

@ -121,12 +121,11 @@ def ensure_server(f):
class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
"""Executes commands relating to Shares."""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
"""Do initialization."""
super(GenericShareDriver, self).__init__(
[False, True], *args, **kwargs)
self.admin_context = context.get_admin_context()
self.db = db
self.configuration.append_config_values(share_opts)
self._helpers = {}
self.backend_name = self.configuration.safe_get(
@ -134,7 +133,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
self.ssh_connections = {}
self.service_instance_manager = (
service_instance.ServiceInstanceManager(
self.db, driver_config=self.configuration))
driver_config=self.configuration))
def _ssh_exec(self, server, command):
connection = self.ssh_connections.get(server['instance_id'])

3
manila/share/drivers/glusterfs.py

@ -226,9 +226,8 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
driver.ShareDriver,):
"""Execute commands relating to Shares."""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(GlusterfsShareDriver, self).__init__(False, *args, **kwargs)
self.db = db
self._helpers = {}
self.gluster_manager = None
self.configuration.append_config_values(GlusterfsManilaShare_opts)

3
manila/share/drivers/glusterfs_native.py

@ -117,10 +117,9 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
1.1 - Support for working with multiple gluster volumes.
"""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(GlusterfsNativeShareDriver, self).__init__(
False, *args, **kwargs)
self.db = db
self._helpers = None
self.gluster_used_vols_dict = {}
self.configuration.append_config_values(

3
manila/share/drivers/hdfs/hdfs_native.py

@ -80,9 +80,8 @@ class HDFSNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
1.0 - Initial Version
"""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(HDFSNativeShareDriver, self).__init__(False, *args, **kwargs)
self.db = db
self.configuration.append_config_values(hdfs_native_share_opts)
self.backend_name = self.configuration.safe_get(
'share_backend_name') or 'HDFS-Native'

3
manila/share/drivers/hds/sop.py

@ -52,9 +52,8 @@ CONF.register_opts(hdssop_share_opts)
class SopShareDriver(driver.ShareDriver):
"""Execute commands relating to Shares."""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(SopShareDriver, self).__init__(False, *args, **kwargs)
self.db = db
self.configuration.append_config_values(hdssop_share_opts)
self.backend_name = self.configuration.safe_get(
'share_backend_name') or 'HDS_SOP'

3
manila/share/drivers/ibm/gpfs.py

@ -122,10 +122,9 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
1.0 - Initial version.
"""
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
"""Do initialization."""
super(GPFSShareDriver, self).__init__(False, *args, **kwargs)
self.db = db
self._helpers = {}
self.configuration.append_config_values(gpfs_share_opts)
self.backend_name = self.configuration.safe_get(

4
manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py

@ -30,11 +30,11 @@ class NetAppCmodeMultiSvmShareDriver(driver.ShareDriver):
DRIVER_NAME = 'NetApp_Cluster_MultiSVM'
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(NetAppCmodeMultiSvmShareDriver, self).__init__(
True, *args, **kwargs)
self.library = lib_multi_svm.NetAppCmodeMultiSVMFileStorageLibrary(
db, self.DRIVER_NAME, **kwargs)
self.DRIVER_NAME, **kwargs)
def do_setup(self, context):
self.library.do_setup(context)

4
manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py

@ -30,11 +30,11 @@ class NetAppCmodeSingleSvmShareDriver(driver.ShareDriver):
DRIVER_NAME = 'NetApp_Cluster_SingleSVM'
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(NetAppCmodeSingleSvmShareDriver, self).__init__(
False, *args, **kwargs)
self.library = lib_single_svm.NetAppCmodeSingleSVMFileStorageLibrary(
db, self.DRIVER_NAME, **kwargs)
self.DRIVER_NAME, **kwargs)
def do_setup(self, context):
self.library.do_setup(context)

3
manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py

@ -59,10 +59,9 @@ class NetAppCmodeFileStorageLibrary(object):
'netapp:max_files': 'max_files',
}
def __init__(self, db, driver_name, **kwargs):
def __init__(self, driver_name, **kwargs):
na_utils.validate_driver_instantiation(**kwargs)
self.db = db
self.driver_name = driver_name
self.configuration = kwargs['configuration']

4
manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py

@ -36,9 +36,9 @@ LOG = log.getLogger(__name__)
class NetAppCmodeSingleSVMFileStorageLibrary(
lib_base.NetAppCmodeFileStorageLibrary):
def __init__(self, db, driver_name, **kwargs):
def __init__(self, driver_name, **kwargs):
super(NetAppCmodeSingleSVMFileStorageLibrary, self).__init__(
db, driver_name, **kwargs)
driver_name, **kwargs)
self._vserver = self.configuration.netapp_vserver

3
manila/share/drivers/quobyte/quobyte.py

@ -69,9 +69,8 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,):
DRIVER_VERSION = '1.0'
def __init__(self, db, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(QuobyteShareDriver, self).__init__(False, *args, **kwargs)
self.db = db
self.configuration.append_config_values(quobyte_manila_share_opts)
self.backend_name = (self.configuration.safe_get('share_backend_name')
or CONF.share_backend_name or 'Quobyte')

3
manila/share/drivers/service_instance.py

@ -181,9 +181,8 @@ class ServiceInstanceManager(object):
provided=network_helper_type,
allowed=[NOVA_NAME, NEUTRON_NAME]))
def __init__(self, db, driver_config=None):
def __init__(self, driver_config=None):
super(ServiceInstanceManager, self).__init__()
self.db = db
self.driver_config = driver_config
if self.driver_config:

2
manila/share/manager.py

@ -113,7 +113,7 @@ class ShareManager(manager.SchedulerDependentManager):
share_driver = MAPPING[share_driver]
self.driver = importutils.import_object(
share_driver, self.db, configuration=self.configuration)
share_driver, configuration=self.configuration)
def _ensure_share_has_pool(self, ctxt, share):
pool = share_utils.extract_host(share['host'], 'pool')

8
manila/tests/fake_driver.py

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from oslo_log import log
import six
@ -27,13 +26,6 @@ class FakeShareDriver(driver.ShareDriver):
def __init__(self, *args, **kwargs):
super(FakeShareDriver, self).__init__([True, False], *args, **kwargs)
self.db = mock.Mock()
def share_network_update(*args, **kwargs):
pass
self.db.share_network_update = mock.Mock(
side_effect=share_network_update)
def manage_existing(self, share, driver_options):
LOG.debug("Fake share driver: manage")

2
manila/tests/share/drivers/hdfs/test_hdfs_native.py

@ -49,9 +49,7 @@ class HDFSNativeShareDriverTestCase(test.TestCase):
CONF.set_default('hdfs_ssh_private_key', 'fake_sshkey')
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self._driver = hdfs_native.HDFSNativeShareDriver(
self._db,
execute=self._hdfs_execute,
configuration=self.fake_conf)
self._driver._hdfs_bin = 'fake_hdfs_bin'

4
manila/tests/share/drivers/hds/test_sop.py

@ -59,9 +59,7 @@ class SopShareDriverTestCase(test.TestCase):
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self._driver = sop.SopShareDriver(
self._db, configuration=self.fake_conf)
self._driver = sop.SopShareDriver(configuration=self.fake_conf)
self.share = fake_share.fake_share(share_proto='NFS')
self._driver.share_backend_name = 'HDS_SOP'

4
manila/tests/share/drivers/ibm/test_gpfs.py

@ -46,9 +46,7 @@ class GPFSShareDriverTestCase(test.TestCase):
self._helper_fake = mock.Mock()
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self._driver = gpfs.GPFSShareDriver(self._db,
execute=self._gpfs_execute,
self._driver = gpfs.GPFSShareDriver(execute=self._gpfs_execute,
configuration=self.fake_conf)
self._knfs_helper = gpfs.KNFSHelper(self._gpfs_execute,
self.fake_conf)

5
manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py

@ -61,13 +61,11 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'debug',
mock.Mock(side_effect=mock_logger.debug))
self.mock_db = mock.Mock()
kwargs = {
'configuration': fake.get_config_cmode(),
'app_version': fake.APP_VERSION
}
self.library = lib_base.NetAppCmodeFileStorageLibrary(self.mock_db,
fake.DRIVER_NAME,
self.library = lib_base.NetAppCmodeFileStorageLibrary(fake.DRIVER_NAME,
**kwargs)
self.library._client = mock.Mock()
self.client = self.library._client
@ -75,7 +73,6 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
def test_init(self):
self.assertEqual(fake.DRIVER_NAME, self.library.driver_name)
self.assertEqual(self.mock_db, self.library.db)
self.assertEqual(1, na_utils.validate_driver_instantiation.call_count)
self.assertEqual(1, na_utils.setup_tracing.call_count)
self.assertIsNone(self.library._helpers)

3
manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py

@ -48,14 +48,13 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'error',
mock.Mock(side_effect=mock_logger.error))
self.mock_db = mock.Mock()
kwargs = {
'configuration': fake.get_config_cmode(),
'app_version': fake.APP_VERSION
}
self.library = lib_multi_svm.NetAppCmodeMultiSVMFileStorageLibrary(
self.mock_db, fake.DRIVER_NAME, **kwargs)
fake.DRIVER_NAME, **kwargs)
self.library._client = mock.Mock()
self.library._client.get_ontapi_version.return_value = (1, 21)
self.client = self.library._client

3
manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py

@ -39,7 +39,6 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'info',
mock.Mock(side_effect=mock_logger.info))
self.mock_db = mock.Mock()
config = fake.get_config_cmode()
config.netapp_vserver = fake.VSERVER1
@ -49,7 +48,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
}
self.library = lib_single_svm.NetAppCmodeSingleSVMFileStorageLibrary(
self.mock_db, fake.DRIVER_NAME, **kwargs)
fake.DRIVER_NAME, **kwargs)
self.library._client = mock.Mock()
self.client = self.library._client

11
manila/tests/share/drivers/netapp/test_common.py

@ -114,7 +114,6 @@ class NetAppDriverFactoryTestCase(test.TestCase):
return obj.__module__ + '.' + obj.__class__.__name__
registry = na_common.NETAPP_UNIFIED_DRIVER_REGISTRY
mock_db = mock.Mock()
for family in six.iterkeys(registry):
for mode, full_class_name in six.iteritems(registry[family]):
@ -125,7 +124,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
kwargs = {'configuration': config, 'app_version': 'fake_info'}
driver = na_common.NetAppDriver._create_driver(
family, mode, mock_db, **kwargs)
family, mode, **kwargs)
self.assertEqual(full_class_name, get_full_class_name(driver))
@ -135,11 +134,9 @@ class NetAppDriverFactoryTestCase(test.TestCase):
config.local_conf.set_override('driver_handles_share_servers', True)
kwargs = {'configuration': config, 'app_version': 'fake_info'}
mock_db = mock.Mock()
driver = na_common.NetAppDriver._create_driver('ONTAP_CLUSTER',
na_common.MULTI_SVM,
mock_db,
**kwargs)
self.assertIsInstance(driver,
@ -151,12 +148,11 @@ class NetAppDriverFactoryTestCase(test.TestCase):
'configuration': na_fakes.create_configuration(),
'app_version': 'fake_info',
}
mock_db = mock.Mock()
self.assertRaises(exception.InvalidInput,
na_common.NetAppDriver._create_driver,
'fake_family', na_common.MULTI_SVM,
mock_db, **kwargs)
**kwargs)
def test_create_driver_invalid_mode(self):
@ -164,8 +160,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
'configuration': na_fakes.create_configuration(),
'app_version': 'fake_info',
}
mock_db = mock.Mock()
self.assertRaises(exception.InvalidInput,
na_common.NetAppDriver._create_driver,
'ontap_cluster', 'fake_mode', mock_db, **kwargs)
'ontap_cluster', 'fake_mode', **kwargs)

4
manila/tests/share/drivers/quobyte/test_quobyte.py

@ -49,9 +49,7 @@ class QuobyteShareDriverTestCase(test.TestCase):
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self._driver = quobyte.QuobyteShareDriver(self._db,
configuration=self.fake_conf)
self._driver = quobyte.QuobyteShareDriver(configuration=self.fake_conf)
self._driver.rpc = mock.Mock()
self.share = fake_share.fake_share(share_proto='NFS')
self.access = fake_share.fake_access()

3
manila/tests/share/drivers/test_generic.py

@ -67,13 +67,12 @@ class GenericShareDriverTestCase(test.TestCase):
self._helper_nfs = mock.Mock()
CONF.set_default('driver_handles_share_servers', True)
self.fake_conf = manila.share.configuration.Configuration(None)
self._db = mock.Mock()
with mock.patch.object(
generic.service_instance,
'ServiceInstanceManager',
fake_service_instance.FakeServiceInstanceManager):
self._driver = generic.GenericShareDriver(
self._db, execute=self._execute, configuration=self.fake_conf)
execute=self._execute, configuration=self.fake_conf)
self._driver.service_tenant_id = 'service tenant id'
self._driver.service_network_id = 'service network id'
self._driver.compute_api = fake_compute.API()

3
manila/tests/share/drivers/test_glusterfs.py

@ -311,9 +311,8 @@ class GlusterfsShareDriverTestCase(test.TestCase):
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self._driver = glusterfs.GlusterfsShareDriver(
self._db, execute=self._execute,
execute=self._execute,
configuration=self.fake_conf)
self._driver.gluster_manager = mock.Mock(**fake_gluster_manager_attrs)
self._helper_nfs = mock.Mock()

3
manila/tests/share/drivers/test_glusterfs_native.py

@ -107,7 +107,6 @@ class GlusterfsNativeShareDriverTestCase(test.TestCase):
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
self._db = mock.Mock()
self.mock_object(tempfile, 'mkdtemp',
mock.Mock(return_value='/tmp/tmpKGHKJ'))
self.mock_object(glusterfs.GlusterManager, 'make_gluster_call')
@ -116,7 +115,7 @@ class GlusterfsNativeShareDriverTestCase(test.TestCase):
'_glustermanager',
side_effect=[self.gmgr1, self.gmgr2]):
self._driver = glusterfs_native.GlusterfsNativeShareDriver(
self._db, execute=self._execute,
execute=self._execute,
configuration=self.fake_conf)
self.addCleanup(fake_utils.fake_execute_set_repliers, [])

33
manila/tests/share/drivers/test_service_instance.py

@ -78,9 +78,8 @@ def fake_get_config_option(key):
class FakeServiceInstance(object):
def __init__(self, db=None, driver_config=None):
def __init__(self, driver_config=None):
super(FakeServiceInstance, self).__init__()
self.db = db or mock.Mock()
self.compute_api = service_instance.compute.API()
self.admin_context = service_instance.context.get_admin_context()
@ -121,7 +120,6 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self.instance_id = 'fake_instance_id'
self.config = configuration.Configuration(None)
self.config.safe_get = mock.Mock(side_effect=fake_get_config_option)
self._db = mock.Mock()
self.mock_object(service_instance.compute, 'API', fake_compute.API)
self.mock_object(
service_instance.os.path, 'exists', mock.Mock(return_value=True))
@ -129,8 +127,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
mock.Mock(side_effect=FakeNetworkHelper))
self.mock_object(service_instance, 'NovaNetworkHelper',
mock.Mock(side_effect=FakeNetworkHelper))
self._manager = service_instance.ServiceInstanceManager(
self._db, self.config)
self._manager = service_instance.ServiceInstanceManager(self.config)
self._manager._execute = mock.Mock(return_value=('', ''))
def test_get_config_option_from_driver_config(self):
@ -143,7 +140,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self.config = configuration.Configuration(
service_instance.common_opts, config_group='CUSTOM')
self._manager = service_instance.ServiceInstanceManager(
self._db, self.config)
self.config)
result = self._manager.get_config_option('service_instance_user')
self.assertEqual(username2, result)
@ -151,7 +148,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
username = 'fake_username_%s' % self.id()
config_data = dict(DEFAULT=dict(service_instance_user=username))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
result = self._manager.get_config_option('service_instance_user')
self.assertEqual(username, result)
@ -164,7 +161,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
driver_handles_share_servers=True,
service_instance_network_helper_type=service_instance.NOVA_NAME))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
service_instance.NovaNetworkHelper.assert_called_once_with(
self._manager)
self.assertFalse(service_instance.NeutronNetworkHelper.called)
@ -179,7 +176,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
service_instance_network_helper_type=service_instance.NEUTRON_NAME)
)
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
service_instance.NeutronNetworkHelper.assert_called_once_with(
self._manager)
self.assertFalse(service_instance.NovaNetworkHelper.called)
@ -200,7 +197,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
with test_utils.create_temp_config_with_opts(config_data):
self.assertRaises(
exception.ManilaException,
service_instance.ServiceInstanceManager, self._db)
service_instance.ServiceInstanceManager)
self.assertFalse(service_instance.NeutronNetworkHelper.called)
self.assertFalse(service_instance.NovaNetworkHelper.called)
@ -215,7 +212,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
with test_utils.create_temp_config_with_opts(config_data):
self.config = configuration.Configuration(opts, 'CUSTOM')
self._manager = service_instance.ServiceInstanceManager(
self._db, self.config)
self.config)
self.assertEqual(
True,
self._manager.get_config_option("driver_handles_share_servers"))
@ -234,7 +231,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
with test_utils.create_temp_config_with_opts(config_data):
self.config = configuration.Configuration(opts, 'CUSTOM')
self._manager = service_instance.ServiceInstanceManager(
self._db, self.config)
self.config)
self.assertNotEqual(None, self._manager.driver_config)
self.assertFalse(hasattr(self._manager, 'network_helper'))
self.assertFalse(service_instance.NovaNetworkHelper.called)
@ -248,7 +245,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
driver_handles_share_servers=True,
service_instance_network_helper_type=service_instance.NOVA_NAME))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
self.assertEqual(
True,
self._manager.get_config_option("driver_handles_share_servers"))
@ -264,7 +261,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
service_instance_user='fake_username',
driver_handles_share_servers=False))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
self.assertEqual(
False,
self._manager.get_config_option("driver_handles_share_servers"))
@ -281,7 +278,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
service_instance.common_opts, config_group=group_name)
self.assertRaises(
exception.ServiceInstanceException,
service_instance.ServiceInstanceManager, self._db, config)
service_instance.ServiceInstanceManager, config)
def test_get_service_instance_name_using_driver_config(self):
fake_server_id = 'fake_share_server_id_%s' % self.id()
@ -295,7 +292,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
with test_utils.create_temp_config_with_opts(config_data):
self.config = configuration.Configuration(opts, 'CUSTOM')
self._manager = service_instance.ServiceInstanceManager(
self._db, self.config)
self.config)
result = self._manager._get_service_instance_name(fake_server_id)
self.assertNotEqual(None, self._manager.driver_config)
self.assertEqual(
@ -316,7 +313,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
service_instance_user='fake_user',
service_instance_network_helper_type=service_instance.NOVA_NAME))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
result = self._manager._get_service_instance_name(fake_server_id)
self.assertEqual(None, self._manager.driver_config)
self.assertEqual(
@ -899,7 +896,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
service_instance_user='fake_user',
service_instance_network_helper_type=helper_type))
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager(self._db)
self._manager = service_instance.ServiceInstanceManager()
server_create = dict(id='fakeid', status='CREATING', networks=dict())
net_name = self._manager.get_config_option("service_network_name")

Loading…
Cancel
Save