Test handling of lost objects on an ec pool. A pretty rigid cluster is brought up and tested by this task
(ctx, config)
| 11 | log = logging.getLogger(__name__) |
| 12 | |
| 13 | def task(ctx, config): |
| 14 | """ |
| 15 | Test handling of lost objects on an ec pool. |
| 16 | |
| 17 | A pretty rigid cluster is brought up and tested by this task |
| 18 | """ |
| 19 | if config is None: |
| 20 | config = {} |
| 21 | assert isinstance(config, dict), \ |
| 22 | 'lost_unfound task only accepts a dict for configuration' |
| 23 | first_mon = teuthology.get_first_mon(ctx, config) |
| 24 | (mon,) = ctx.cluster.only(first_mon).remotes.keys() |
| 25 | |
| 26 | manager = ceph_manager.CephManager( |
| 27 | mon, |
| 28 | ctx=ctx, |
| 29 | logger=log.getChild('ceph_manager'), |
| 30 | ) |
| 31 | |
| 32 | manager.wait_for_clean() |
| 33 | |
| 34 | profile = config.get('erasure_code_profile', { |
| 35 | 'k': '2', |
| 36 | 'm': '2', |
| 37 | 'crush-failure-domain': 'osd' |
| 38 | }) |
| 39 | profile_name = profile.get('name', 'lost_unfound') |
| 40 | manager.create_erasure_code_profile(profile_name, profile) |
| 41 | pool = manager.create_pool_with_unique_name( |
| 42 | erasure_code_profile_name=profile_name, |
| 43 | min_size=2) |
| 44 | |
| 45 | # something that is always there, readable and never empty |
| 46 | dummyfile = '/etc/group' |
| 47 | |
| 48 | # kludge to make sure they get a map |
| 49 | rados(ctx, mon, ['-p', pool, 'put', 'dummy', dummyfile]) |
| 50 | |
| 51 | manager.flush_pg_stats([0, 1]) |
| 52 | manager.wait_for_recovery() |
| 53 | |
| 54 | # create old objects |
| 55 | for f in range(1, 10): |
| 56 | rados(ctx, mon, ['-p', pool, 'put', 'existing_%d' % f, dummyfile]) |
| 57 | rados(ctx, mon, ['-p', pool, 'put', 'existed_%d' % f, dummyfile]) |
| 58 | rados(ctx, mon, ['-p', pool, 'rm', 'existed_%d' % f]) |
| 59 | |
| 60 | # delay recovery, and make the pg log very long (to prevent backfill) |
| 61 | manager.raw_cluster_cmd( |
| 62 | 'tell', 'osd.1', |
| 63 | 'injectargs', |
| 64 | '--osd-recovery-delay-start 1000 --osd-min-pg-log-entries 100000000' |
| 65 | ) |
| 66 | |
| 67 | manager.kill_osd(0) |
| 68 | manager.mark_down_osd(0) |
| 69 | manager.kill_osd(3) |
| 70 | manager.mark_down_osd(3) |
nothing calls this directly
no test coverage detected