コード例 #1
0
ファイル: test_ganesha.py プロジェクト: stacifractals/ceph
    def setUp(self):
        self.mock_kv_store()

        Settings.GANESHA_CLUSTERS_RADOS_POOL_NAMESPACE = "ganesha/ns"

        self.temp_store = {
            'export-1': GaneshaConfTest.RObject("export-1", self.export_1),
            'conf-nodea': GaneshaConfTest.RObject("conf-nodea",
                                                  self.conf_nodea),
            'export-2': GaneshaConfTest.RObject("export-2", self.export_2),
            'conf-nodeb': GaneshaConfTest.RObject("conf-nodeb",
                                                  self.conf_nodeb)
        }

        self.io_mock = MagicMock()
        self.io_mock.list_objects.side_effect = self._ioctx_list_objects_mock
        self.io_mock.write_full.side_effect = self._ioctx_write_full_mock
        self.io_mock.remove_object.side_effect = self._ioctx_remove_mock

        ioctx_mock = MagicMock()
        ioctx_mock.__enter__ = Mock(return_value=(self.io_mock))
        ioctx_mock.__exit__ = Mock(return_value=None)

        mgr.rados = MagicMock()
        mgr.rados.open_ioctx.return_value = ioctx_mock

        # pylint: disable=protected-access
        mgr._select_orchestrator.side_effect = orchestrator.NoOrchestrator()

        ganesha.CephX = MagicMock()
        ganesha.CephX.list_clients.return_value = ['ganesha']
        ganesha.CephX.get_client_key.return_value = 'ganesha'

        ganesha.CephFS = MagicMock()
コード例 #2
0
ファイル: module.py プロジェクト: roybhaskar9/cephstorage
 def add_host(self, host):
     if host == 'raise_no_support':
         raise orchestrator.OrchestratorValidationError("MON count must be either 1, 3 or 5")
     if host == 'raise_bug':
         raise ZeroDivisionError()
     if host == 'raise_not_implemented':
         raise NotImplementedError()
     if host == 'raise_no_orchestrator':
         raise orchestrator.NoOrchestrator()
     if host == 'raise_import_error':
         raise ImportError("test_orchestrator not enabled")
     assert isinstance(host, six.string_types)
コード例 #3
0
ファイル: module.py プロジェクト: zhangshun2014/ceph
    def _status(self):
        o = self._select_orchestrator()
        if o is None:
            raise orchestrator.NoOrchestrator()

        avail, why = self.available()
        if avail is None:
            # The module does not report its availability
            return HandleCommandResult(stdout="Backend: {0}".format(o))
        else:
            return HandleCommandResult(
                stdout="Backend: {0}\nAvailable: {1}{2}".format(
                    o, avail, " ({0})".format(why) if not avail else ""))
コード例 #4
0
ファイル: module.py プロジェクト: doitroot/ceph_source
 def add_host(self, spec):
     # type: (orchestrator.HostSpec) -> None
     host = spec.hostname
     if host == 'raise_no_support':
         raise orchestrator.OrchestratorValidationError(
             "MON count must be either 1, 3 or 5")
     if host == 'raise_bug':
         raise ZeroDivisionError()
     if host == 'raise_not_implemented':
         raise NotImplementedError()
     if host == 'raise_no_orchestrator':
         raise orchestrator.NoOrchestrator()
     if host == 'raise_import_error':
         raise ImportError("test_orchestrator not enabled")
     assert isinstance(host, str)