]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/mgr/dashboard/test_health.py
08551e488ab99164f79afe1e1cd9302c75c30b1d
1 # -*- coding: utf-8 -*-
2 from __future__
import absolute_import
4 from .helper
import DashboardTestCase
, JAny
, JLeaf
, JList
, JObj
7 class HealthTest(DashboardTestCase
):
10 __pg_info_schema
= JObj({
11 'object_stats': JObj({
13 'num_object_copies': int,
14 'num_objects_degraded': int,
15 'num_objects_misplaced': int,
16 'num_objects_unfound': int
19 'statuses': JObj({}, allow_unknown
=True, unknown_schema
=int)
22 __mdsmap_schema
= JObj({
23 'session_autoclose': int,
25 'up': JObj({}, allow_unknown
=True),
26 'last_failure_osd_epoch': int,
30 'explicitly_allowed_features': int,
31 'damaged': JList(int),
36 'stopped': JList(int),
39 'compat': JObj({}, allow_unknown
=True),
40 'ro_compat': JObj({}, allow_unknown
=True),
41 'incompat': JObj({}, allow_unknown
=True)
43 'min_compat_client': str,
44 'data_pools': JList(int),
45 'info': JObj({}, allow_unknown
=True),
48 'standby_count_wanted': int,
51 'session_timeout': int,
53 'ever_allowed_features': int,
57 def test_minimal_health(self
):
58 data
= self
._get
('/api/health/minimal')
59 self
.assertStatus(200)
62 'read_bytes_sec': int,
63 'read_op_per_sec': int,
64 'recovering_bytes_per_sec': int,
65 'write_bytes_sec': int,
66 'write_op_per_sec': int
70 'total_avail_bytes': int,
72 'total_used_raw_bytes': int,
78 'mdsmap': self
.__mdsmap
_schema
81 'standbys': JList(JObj({}, allow_unknown
=True)),
84 'checks': JList(JObj({}, allow_unknown
=True)),
85 'mutes': JList(JObj({}, allow_unknown
=True)),
89 'iscsi_daemons': JObj({
95 'standbys': JList(JLeaf(dict))
99 'mons': JList(JLeaf(dict)),
110 'pg_info': self
.__pg
_info
_schema
,
111 'pools': JList(JLeaf(dict)),
115 self
.assertSchema(data
, schema
)
117 def test_full_health(self
):
118 data
= self
._get
('/api/health/full')
119 self
.assertStatus(200)
120 module_info_schema
= JObj({
124 'module_options': JObj(
127 unknown_schema
=JObj({
132 'default_value': str,
135 'enum_allowed': JList(str),
136 'see_also': JList(str),
143 'client_perf': JObj({
144 'read_bytes_sec': int,
145 'read_op_per_sec': int,
146 'recovering_bytes_per_sec': int,
147 'write_bytes_sec': int,
148 'write_op_per_sec': int
151 'pools': JList(JObj({
159 'data_bytes_used': int,
160 'omap_bytes_used': int,
161 'percent_used': float,
163 'quota_objects': int,
170 'compress_bytes_used': int,
171 'compress_under_bytes': int,
178 'total_avail_bytes': int,
180 'total_used_bytes': int,
181 'total_used_raw_bytes': int,
182 'total_used_raw_ratio': float,
184 'num_per_pool_osds': int,
185 'num_per_pool_omap_osds': int
190 'compat': JObj({}, allow_unknown
=True, unknown_schema
=str),
192 {}, allow_unknown
=True, unknown_schema
=str),
194 {}, allow_unknown
=True, unknown_schema
=str)
196 'default_fscid': int,
198 'feature_flags': JObj(
199 {}, allow_unknown
=True, unknown_schema
=bool),
200 'filesystems': JList(
203 'mdsmap': self
.__mdsmap
_schema
206 'standbys': JList(JObj({}, allow_unknown
=True)),
209 'checks': JList(JObj({}, allow_unknown
=True)),
210 'mutes': JList(JObj({}, allow_unknown
=True)),
214 'iscsi_daemons': JObj({
220 'active_addrs': JObj({
221 'addrvec': JList(JObj({
227 'active_change': str, # timestamp
228 'active_mgr_features': int,
231 'always_on_modules': JObj({}, allow_unknown
=True),
233 'available_modules': JList(module_info_schema
),
235 'modules': JList(str),
237 {'dashboard': str}, # This module should always be present
238 allow_unknown
=True, unknown_schema
=str
240 'standbys': JList(JObj({
241 'available_modules': JList(module_info_schema
),
245 }, allow_unknown
=True))
246 }, allow_unknown
=True),
248 'election_epoch': int,
249 'extra_probe_peers': JList(JAny(none
=True)),
251 {}, allow_unknown
=True, unknown_schema
=JList(JObj({
259 'quorum_mon': JList(str),
261 'required_mon': JList(str)
264 # TODO: expand on monmap schema
265 'mons': JList(JLeaf(dict)),
266 }, allow_unknown
=True),
268 'outside_quorum': JList(int),
269 'quorum': JList(int),
273 # TODO: What type should be expected here?
274 'sync_provider': JList(JAny(none
=True))
277 # TODO: define schema for crush map and osd_metadata, among
283 }, allow_unknown
=True)),
284 }, allow_unknown
=True),
285 'pg_info': self
.__pg
_info
_schema
,
286 'pools': JList(JLeaf(dict)),
290 self
.assertSchema(data
, schema
)
292 cluster_pools
= self
.ceph_cluster
.mon_manager
.list_pools()
293 self
.assertEqual(len(cluster_pools
), len(data
['pools']))
294 for pool
in data
['pools']:
295 self
.assertIn(pool
['pool_name'], cluster_pools
)
297 @DashboardTestCase.RunAs('test', 'test', ['pool-manager'])
298 def test_health_permissions(self
):
299 data
= self
._get
('/api/health/full')
300 self
.assertStatus(200)
303 'client_perf': JObj({}, allow_unknown
=True),
304 'df': JObj({}, allow_unknown
=True),
306 'checks': JList(JObj({}, allow_unknown
=True)),
307 'mutes': JList(JObj({}, allow_unknown
=True)),
310 'pools': JList(JLeaf(dict)),
312 self
.assertSchema(data
, schema
)
314 cluster_pools
= self
.ceph_cluster
.mon_manager
.list_pools()
315 self
.assertEqual(len(cluster_pools
), len(data
['pools']))
316 for pool
in data
['pools']:
317 self
.assertIn(pool
['pool_name'], cluster_pools
)