Ejemplo n.º 1
0
    def setUp(self):
        super(TestOsd, self).setUp()

        self.rpc.list = mock.Mock(return_value=fake_async([]))
        self.rpc.get_sync_object = mock.Mock(return_value=fake_async([]))
        self.rpc.get_valid_commands = mock.Mock(return_value=fake_async([]))
        self.rpc.server_by_service = mock.Mock(return_value=fake_async([]))
Ejemplo n.º 2
0
    def setUp(self):
        super(TestOsd, self).setUp()

        self.rpc.list = mock.Mock(return_value=fake_async([]))
        self.rpc.get_sync_object = mock.Mock(return_value=fake_async([]))
        self.rpc.get_valid_commands = mock.Mock(return_value=fake_async([]))
        self.rpc.server_by_service = mock.Mock(return_value=fake_async([]))
Ejemplo n.º 3
0
    def test_firefly(self):
        config = self.FIREFLY_CONFIG.copy()
        rules = [{'ruleset': 0}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        self.assert_defaults(self.FIREFLY_DEFAULTS)
Ejemplo n.º 4
0
    def test_firefly(self):
        config = self.FIREFLY_CONFIG.copy()
        rules = [{'ruleset': 0}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        self.assert_defaults(self.FIREFLY_DEFAULTS)
Ejemplo n.º 5
0
    def test_dumpling(self):
        config = self.DUMPLING_CONFIG.copy()
        rules = [{'ruleset': 0}, {'ruleset': 1}, {'ruleset': 2}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        self.assert_defaults(self.DUMPLING_DEFAULTS)
Ejemplo n.º 6
0
    def test_dumpling(self):
        config = self.DUMPLING_CONFIG.copy()
        rules = [{'ruleset': 0}, {'ruleset': 1}, {'ruleset': 2}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        self.assert_defaults(self.DUMPLING_DEFAULTS)
Ejemplo n.º 7
0
    def test_dumpling_bad_default(self):
        config = self.DUMPLING_CONFIG.copy()
        config['osd_pool_default_crush_rule'] = 0
        rules = [{'ruleset': 24}, {'ruleset': 23}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        # Should pick the lowest numbered valid crush rule
        expected = self.DUMPLING_DEFAULTS.copy()
        expected['crush_ruleset'] = 23
        self.assert_defaults(expected)
Ejemplo n.º 8
0
    def test_dumpling_bad_default(self):
        config = self.DUMPLING_CONFIG.copy()
        config['osd_pool_default_crush_rule'] = 0
        rules = [{'ruleset': 24}, {'ruleset': 23}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        # Should pick the lowest numbered valid crush rule
        expected = self.DUMPLING_DEFAULTS.copy()
        expected['crush_ruleset'] = 23
        self.assert_defaults(expected)
Ejemplo n.º 9
0
    def test_firefly_bad_default(self):
        config = self.FIREFLY_CONFIG.copy()
        # Let the config try to use '0' which may not exist
        config['osd_pool_default_crush_replicated_ruleset'] = 0
        rules = [{'ruleset': 24}, {'ruleset': 23}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        # Should pick the lowest numbered valid crush rule
        expected = self.FIREFLY_DEFAULTS.copy()
        expected['crush_ruleset'] = 23
        self.assert_defaults(expected)
Ejemplo n.º 10
0
    def test_firefly_bad_default(self):
        config = self.FIREFLY_CONFIG.copy()
        # Let the config try to use '0' which may not exist
        config['osd_pool_default_crush_replicated_ruleset'] = 0
        rules = [{'ruleset': 24}, {'ruleset': 23}]

        self.rpc.get_sync_object = mock.Mock(return_value=fake_async(config))
        self.rpc.list = mock.Mock(return_value=fake_async(rules))

        # Should pick the lowest numbered valid crush rule
        expected = self.FIREFLY_DEFAULTS.copy()
        expected['crush_ruleset'] = 23
        self.assert_defaults(expected)
Ejemplo n.º 11
0
    def test_no_rules(self):
        self.rpc.get_sync_object = mock.Mock(return_value=fake_async({}))
        self.rpc.list = mock.Mock(return_value=fake_async([]))

        response = self.client.get("/api/v2/cluster/abc/pool?defaults")
        self.assertStatus(response, 503)
Ejemplo n.º 12
0
    def test_no_rules(self):
        self.rpc.get_sync_object = mock.Mock(return_value=fake_async({}))
        self.rpc.list = mock.Mock(return_value=fake_async([]))

        response = self.client.get("/api/v2/cluster/abc/pool?defaults")
        self.assertStatus(response, 503)