Coverage for manila/policies/scheduler_stats.py: 100%
10 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
13from oslo_log import versionutils
14from oslo_policy import policy
16from manila.policies import base
19BASE_POLICY_NAME = 'scheduler_stats:pools:%s'
21DEPRECATED_REASON = """
22The storage pool statistics API now support system scope and default roles.
23"""
25deprecated_pool_index = policy.DeprecatedRule(
26 name=BASE_POLICY_NAME % 'index',
27 check_str=base.RULE_ADMIN_API,
28 deprecated_reason=DEPRECATED_REASON,
29 deprecated_since=versionutils.deprecated.WALLABY
30)
31deprecated_pool_detail = policy.DeprecatedRule(
32 name=BASE_POLICY_NAME % 'detail',
33 check_str=base.RULE_ADMIN_API,
34 deprecated_reason=DEPRECATED_REASON,
35 deprecated_since=versionutils.deprecated.WALLABY
36)
39scheduler_stats_policies = [
40 policy.DocumentedRuleDefault(
41 name=BASE_POLICY_NAME % 'index',
42 check_str=base.ADMIN,
43 scope_types=['project'],
44 description="Get information regarding backends "
45 "(and storage pools) known to the scheduler.",
46 operations=[
47 {
48 'method': 'GET',
49 'path': '/scheduler-stats/pools?{query}'
50 }
51 ],
52 deprecated_rule=deprecated_pool_index
53 ),
54 policy.DocumentedRuleDefault(
55 name=BASE_POLICY_NAME % 'detail',
56 check_str=base.ADMIN,
57 scope_types=['project'],
58 description="Get detailed information regarding backends "
59 "(and storage pools) known to the scheduler.",
60 operations=[
61 {
62 'method': 'GET',
63 'path': '/scheduler-stats/pools/detail?{query}'
64 },
65 ],
66 deprecated_rule=deprecated_pool_detail
67 ),
68]
71def list_rules():
72 return scheduler_stats_policies