Exemplo n.º 1
0
 def test_get_cell_capacity(self):
     self._mock_cell_capacity()
     state_manager = state.CellStateManager()
     my_state = state_manager.get_my_state()
     response = self._do_get('os-cells/%s/capacities' % my_state.name)
     return self._verify_response('cells-capacities-resp', {}, response,
                                  200)
 def test_filemanager_returned(self, mock_read_cached_file, mock_find_file):
     mock_find_file.return_value = "/etc/nova/cells.json"
     mock_read_cached_file.return_value = (False, six.StringIO('{}'))
     self.flags(cells_config='cells.json', group='cells')
     manager = state.CellStateManager()
     self.assertIsInstance(manager, state.CellStateManagerFile)
     self.assertRaises(exception.CellsUpdateUnsupported,
                       manager.cell_create, None, None)
     self.assertRaises(exception.CellsUpdateUnsupported,
                       manager.cell_update, None, None, None)
     self.assertRaises(exception.CellsUpdateUnsupported,
                       manager.cell_delete, None, None)
 def _get_state_manager(self, reserve_percent=0.0):
     self.flags(reserve_percent=reserve_percent, group='cells')
     return state.CellStateManager()
 def test_dbmanager_returned(self):
     self.assertIsInstance(state.CellStateManager(),
                           state.CellStateManagerDB)
Exemplo n.º 5
0
 def test_filemanager_returned(self, mock_read_cached_file, mock_find_file):
     mock_find_file.return_value = "/etc/nova/cells.json"
     mock_read_cached_file.return_value = (False, six.StringIO({}))
     self.flags(cells_config='cells.json', group='cells')
     self.assertIsInstance(state.CellStateManager(),
                           state.CellStateManagerFile)
    def _capacity(self, reserve_percent):
        self.flags(reserve_percent=reserve_percent, group='cells')

        mgr = state.CellStateManager()
        my_state = mgr.get_my_state()
        return my_state.capacities