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

Function task

qa/tasks/osd_backfill.py:32–102  ·  view source on GitHub ↗

Test backfill

(ctx, config)

Source from the content-addressed store, hash-verified

30 return proc
31
32def task(ctx, config):
33 """
34 Test backfill
35 """
36 if config is None:
37 config = {}
38 assert isinstance(config, dict), \
39 'thrashosds task only accepts a dict for configuration'
40 first_mon = teuthology.get_first_mon(ctx, config)
41 (mon,) = ctx.cluster.only(first_mon).remotes.keys()
42
43 num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
44 log.info('num_osds is %s' % num_osds)
45 assert num_osds == 3
46
47 manager = ceph_manager.CephManager(
48 mon,
49 ctx=ctx,
50 logger=log.getChild('ceph_manager'),
51 )
52
53 while len(manager.get_osd_status()['up']) < 3:
54 time.sleep(10)
55 manager.flush_pg_stats([0, 1, 2])
56 manager.wait_for_clean()
57
58 # write some data
59 p = rados_start(ctx, mon, ['-p', 'rbd', 'bench', '15', 'write', '-b', '4096',
60 '--no-cleanup'])
61 err = p.wait()
62 log.info('err is %d' % err)
63
64 # mark osd.0 out to trigger a rebalance/backfill
65 manager.mark_out_osd(0)
66
67 # also mark it down to it won't be included in pg_temps
68 manager.kill_osd(0)
69 manager.mark_down_osd(0)
70
71 # wait for everything to peer and be happy...
72 manager.flush_pg_stats([1, 2])
73 manager.wait_for_recovery()
74
75 # write some new data
76 p = rados_start(ctx, mon, ['-p', 'rbd', 'bench', '30', 'write', '-b', '4096',
77 '--no-cleanup'])
78
79 time.sleep(15)
80
81 # blackhole + restart osd.1
82 # this triggers a divergent backfill target
83 manager.blackhole_kill_osd(1)
84 time.sleep(2)
85 manager.revive_osd(1)
86
87 # wait for our writes to complete + succeed
88 err = p.wait()
89 log.info('err is %d' % err)

Callers

nothing calls this directly

Calls 15

get_osd_statusMethod · 0.95
flush_pg_statsMethod · 0.95
wait_for_cleanMethod · 0.95
mark_out_osdMethod · 0.95
kill_osdMethod · 0.95
mark_down_osdMethod · 0.95
wait_for_recoveryMethod · 0.95
blackhole_kill_osdMethod · 0.95
revive_osdMethod · 0.95
wait_till_osd_is_upMethod · 0.95
onlyMethod · 0.80
rados_startFunction · 0.70

Tested by

no test coverage detected