def setUp(self): super(CephFSDriverTestCase, self).setUp() self._execute = mock.Mock() self.fake_conf = configuration.Configuration(None) self._context = context.get_admin_context() self._share = fake_share.fake_share(share_proto='CEPHFS') self._snapshot = fake_share.fake_snapshot_instance() self.fake_conf.set_default('driver_handles_share_servers', False) self.fake_conf.set_default('cephfs_auth_id', 'manila') self.mock_object(driver, "rados_command") self.mock_object(driver, "rados", MockRadosModule) self.mock_object(driver, "json_command", MockCephArgparseModule) self.mock_object(driver, 'NativeProtocolHelper') self.mock_object(driver, 'NFSProtocolHelper') driver.ceph_default_target = ('mon-mgr', ) self._driver = (driver.CephFSDriver(execute=self._execute, configuration=self.fake_conf)) self._driver.protocol_helper = mock.Mock() type(self._driver).volname = mock.PropertyMock(return_value='cephfs') self.mock_object(share_types, 'get_share_type_extra_specs', mock.Mock(return_value={}))
def test_do_setup_alt_volume_mode(self, protocol_helper): self.fake_conf.set_default('cephfs_volume_mode', ALT_VOLUME_MODE_CFG) self._driver = driver.CephFSDriver(execute=self._execute, configuration=self.fake_conf) self._driver.configuration.cephfs_protocol_helper_type = ( protocol_helper) self._driver.do_setup(self._context) if protocol_helper == 'cephfs': driver.NativeProtocolHelper.assert_called_once_with( self._execute, self._driver.configuration, ceph_vol_client=self._driver._volume_client) else: driver.NFSProtocolHelper.assert_called_once_with( self._execute, self._driver.configuration, ceph_vol_client=self._driver._volume_client) self._driver.protocol_helper.init_helper.assert_called_once_with() self.assertEqual(ALT_VOLUME_MODE, self._driver._cephfs_volume_mode)
def test_do_setup_alt_volume_mode(self, protocol_helper): self.fake_conf.set_default('cephfs_volume_mode', ALT_VOLUME_MODE) self._driver = driver.CephFSDriver(execute=self._execute, configuration=self.fake_conf, rados_client=self._rados_client) type(self._driver).volname = mock.PropertyMock(return_value='cephfs') self._driver.configuration.cephfs_protocol_helper_type = ( protocol_helper) self._driver.do_setup(self._context) if protocol_helper == 'cephfs': driver.NativeProtocolHelper.assert_called_once_with( self._execute, self._driver.configuration, rados_client=self._driver.rados_client, volname=self._driver.volname) else: driver.NFSProtocolHelper.assert_called_once_with( self._execute, self._driver.configuration, rados_client=self._driver._rados_client, volname=self._driver.volname) self._driver.protocol_helper.init_helper.assert_called_once_with() self.assertEqual(ALT_VOLUME_MODE, self._driver._cephfs_volume_mode)
def setUp(self): super(CephFSDriverTestCase, self).setUp() self.fake_conf = configuration.Configuration(None) self._context = context.get_admin_context() self._share = fake_share.fake_share(share_proto='CEPHFS') self.fake_conf.set_default('driver_handles_share_servers', False) self.fake_conf.set_default('cephfs_auth_id', 'manila') self.mock_object(driver, "ceph_volume_client", MockVolumeClientModule) self.mock_object(driver, "ceph_module_found", True) self.mock_object(driver, "cephfs_share_path") self.mock_object(driver, 'NativeProtocolHelper') self._driver = (driver.CephFSDriver(configuration=self.fake_conf)) self._driver.protocol_helper = mock.Mock() self.mock_object(share_types, 'get_share_type_extra_specs', mock.Mock(return_value={}))