MCPcopy Create free account
hub / github.com/ceph/ceph / task

Function task

qa/tasks/peer.py:14–90  ·  view source on GitHub ↗

Test peering.

(ctx, config)

Source from the content-addressed store, hash-verified

12log = logging.getLogger(__name__)
13
14def task(ctx, config):
15 """
16 Test peering.
17 """
18 if config is None:
19 config = {}
20 assert isinstance(config, dict), \
21 'peer task only accepts a dict for configuration'
22 first_mon = teuthology.get_first_mon(ctx, config)
23 (mon,) = ctx.cluster.only(first_mon).remotes.keys()
24
25 manager = ceph_manager.CephManager(
26 mon,
27 ctx=ctx,
28 logger=log.getChild('ceph_manager'),
29 )
30
31 while len(manager.get_osd_status()['up']) < 3:
32 time.sleep(10)
33 manager.flush_pg_stats([0, 1, 2])
34 manager.wait_for_clean()
35
36 for i in range(3):
37 manager.set_config(
38 i,
39 osd_recovery_delay_start=120)
40
41 # take on osd down
42 manager.kill_osd(2)
43 manager.mark_down_osd(2)
44
45 # kludge to make sure they get a map
46 rados(ctx, mon, ['-p', 'data', 'get', 'dummy', '-'])
47
48 manager.flush_pg_stats([0, 1])
49 manager.wait_for_recovery()
50
51 # kill another and revive 2, so that some pgs can't peer.
52 manager.kill_osd(1)
53 manager.mark_down_osd(1)
54 manager.revive_osd(2)
55 manager.wait_till_osd_is_up(2)
56
57 manager.flush_pg_stats([0, 2])
58
59 manager.wait_for_active_or_down()
60
61 manager.flush_pg_stats([0, 2])
62
63 # look for down pgs
64 num_down_pgs = 0
65 pgs = manager.get_pg_stats()
66 for pg in pgs:
67 out = manager.raw_cluster_cmd('pg', pg['pgid'], 'query')
68 log.debug("out string %s",out)
69 j = json.loads(out)
70 log.info("pg is %s, query json is %s", pg, j)
71

Callers

nothing calls this directly

Calls 15

get_osd_statusMethod · 0.95
flush_pg_statsMethod · 0.95
wait_for_cleanMethod · 0.95
set_configMethod · 0.95
kill_osdMethod · 0.95
mark_down_osdMethod · 0.95
wait_for_recoveryMethod · 0.95
revive_osdMethod · 0.95
wait_till_osd_is_upMethod · 0.95
get_pg_statsMethod · 0.95
raw_cluster_cmdMethod · 0.95

Tested by

no test coverage detected