]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/dump_stuck.py
8da634b5d9d1e620524d52ab1935a9d8ebfc9728
9 from teuthology
import misc
as teuthology
12 log
= logging
.getLogger(__name__
)
14 def check_stuck(manager
, num_inactive
, num_unclean
, num_stale
, timeout
=10):
16 Do checks. Make sure get_stuck_pgs return the right amout of information, then
17 extract health information from the raw_cluster_cmd and compare the results with
18 values passed in. This passes if all asserts pass.
20 :param num_manager: Ceph manager
21 :param num_inactive: number of inaactive pages that are stuck
22 :param num_unclean: number of unclean pages that are stuck
23 :paran num_stale: number of stale pages that are stuck
24 :param timeout: timeout value for get_stuck_pgs calls
26 inactive
= manager
.get_stuck_pgs('inactive', timeout
)
27 unclean
= manager
.get_stuck_pgs('unclean', timeout
)
28 stale
= manager
.get_stuck_pgs('stale', timeout
)
29 log
.info('inactive %s / %d, unclean %s / %d, stale %s / %d',
30 len(inactive
), num_inactive
,
31 len(unclean
), num_unclean
,
32 len(stale
), num_stale
)
33 assert len(inactive
) == num_inactive
34 assert len(unclean
) == num_unclean
35 assert len(stale
) == num_stale
37 def task(ctx
, config
):
39 Test the dump_stuck command.
42 :param config: Configuration
44 assert config
is None, \
45 'dump_stuck requires no configuration'
46 assert teuthology
.num_instances_of_type(ctx
.cluster
, 'osd') == 2, \
47 'dump_stuck requires exactly 2 osds'
50 first_mon
= teuthology
.get_first_mon(ctx
, config
)
51 (mon
,) = ctx
.cluster
.only(first_mon
).remotes
.iterkeys()
53 manager
= ceph_manager
.CephManager(
56 logger
=log
.getChild('ceph_manager'),
59 manager
.flush_pg_stats([0, 1])
60 manager
.wait_for_clean(timeout
)
62 manager
.raw_cluster_cmd('tell', 'mon.0', 'injectargs', '--',
63 # '--mon-osd-report-timeout 90',
64 '--mon-pg-stuck-threshold 10')
72 num_pgs
= manager
.get_num_pgs()
74 manager
.mark_out_osd(0)
76 manager
.flush_pg_stats([1])
77 manager
.wait_for_recovery(timeout
)
86 manager
.mark_in_osd(0)
87 manager
.flush_pg_stats([0, 1])
88 manager
.wait_for_clean(timeout
)
97 log
.info('stopping first osd')
99 manager
.mark_down_osd(0)
101 log
.info('waiting for all to be unclean')
102 starttime
= time
.time()
113 except AssertionError:
114 # wait up to 15 minutes to become stale
115 if time
.time() - starttime
> 900:
119 log
.info('stopping second osd')
121 manager
.mark_down_osd(1)
123 log
.info('waiting for all to be stale')
124 starttime
= time
.time()
135 except AssertionError:
136 # wait up to 15 minutes to become stale
137 if time
.time() - starttime
> 900:
141 for id_
in teuthology
.all_roles_of_type(ctx
.cluster
, 'osd'):
142 manager
.revive_osd(id_
)
143 manager
.mark_in_osd(id_
)
146 manager
.flush_pg_stats([0, 1])
149 log
.exception('osds must not be started yet, waiting...')
151 manager
.wait_for_clean(timeout
)