2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Test Object locations going down
|
|
|
|
"""
|
2012-03-30 01:07:10 +00:00
|
|
|
import logging
|
2016-06-02 22:24:56 +00:00
|
|
|
import time
|
2012-03-30 01:07:10 +00:00
|
|
|
from teuthology import misc as teuthology
|
2020-03-24 08:33:22 +00:00
|
|
|
from tasks import ceph_manager
|
|
|
|
from tasks.util.rados import rados
|
2012-03-30 01:07:10 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Test handling of object location going down
|
|
|
|
"""
|
|
|
|
if config is None:
|
|
|
|
config = {}
|
|
|
|
assert isinstance(config, dict), \
|
|
|
|
'lost_unfound task only accepts a dict for configuration'
|
|
|
|
first_mon = teuthology.get_first_mon(ctx, config)
|
2019-10-11 15:57:47 +00:00
|
|
|
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
|
2012-03-30 01:07:10 +00:00
|
|
|
|
|
|
|
manager = ceph_manager.CephManager(
|
|
|
|
mon,
|
|
|
|
ctx=ctx,
|
|
|
|
logger=log.getChild('ceph_manager'),
|
|
|
|
)
|
|
|
|
|
2012-04-19 19:43:54 +00:00
|
|
|
while len(manager.get_osd_status()['up']) < 3:
|
2016-06-02 22:24:56 +00:00
|
|
|
time.sleep(10)
|
2012-03-30 01:07:10 +00:00
|
|
|
manager.wait_for_clean()
|
|
|
|
|
|
|
|
# something that is always there
|
|
|
|
dummyfile = '/etc/fstab'
|
|
|
|
|
|
|
|
# take 0, 1 out
|
|
|
|
manager.mark_out_osd(0)
|
|
|
|
manager.mark_out_osd(1)
|
|
|
|
manager.wait_for_clean()
|
|
|
|
|
|
|
|
# delay recovery, and make the pg log very long (to prevent backfill)
|
|
|
|
manager.raw_cluster_cmd(
|
|
|
|
'tell', 'osd.0',
|
|
|
|
'injectargs',
|
|
|
|
'--osd-recovery-delay-start 10000 --osd-min-pg-log-entries 100000000'
|
|
|
|
)
|
|
|
|
# delay recovery, and make the pg log very long (to prevent backfill)
|
|
|
|
manager.raw_cluster_cmd(
|
|
|
|
'tell', 'osd.1',
|
|
|
|
'injectargs',
|
|
|
|
'--osd-recovery-delay-start 10000 --osd-min-pg-log-entries 100000000'
|
|
|
|
)
|
|
|
|
# delay recovery, and make the pg log very long (to prevent backfill)
|
|
|
|
manager.raw_cluster_cmd(
|
|
|
|
'tell', 'osd.2',
|
|
|
|
'injectargs',
|
|
|
|
'--osd-recovery-delay-start 10000 --osd-min-pg-log-entries 100000000'
|
|
|
|
)
|
|
|
|
# delay recovery, and make the pg log very long (to prevent backfill)
|
|
|
|
manager.raw_cluster_cmd(
|
|
|
|
'tell', 'osd.3',
|
|
|
|
'injectargs',
|
|
|
|
'--osd-recovery-delay-start 10000 --osd-min-pg-log-entries 100000000'
|
|
|
|
)
|
|
|
|
|
|
|
|
# kludge to make sure they get a map
|
2013-07-22 21:21:51 +00:00
|
|
|
rados(ctx, mon, ['-p', 'data', 'put', 'dummy', dummyfile])
|
2012-03-30 01:07:10 +00:00
|
|
|
|
|
|
|
# create old objects
|
|
|
|
for f in range(1, 10):
|
2013-07-22 21:21:51 +00:00
|
|
|
rados(ctx, mon, ['-p', 'data', 'put', 'existing_%d' % f, dummyfile])
|
2012-03-30 01:07:10 +00:00
|
|
|
|
|
|
|
manager.mark_out_osd(3)
|
|
|
|
manager.wait_till_active()
|
|
|
|
|
|
|
|
manager.mark_in_osd(0)
|
|
|
|
manager.wait_till_active()
|
|
|
|
|
2017-05-18 22:16:55 +00:00
|
|
|
manager.flush_pg_stats([2, 0])
|
2012-03-30 01:07:10 +00:00
|
|
|
|
|
|
|
manager.mark_out_osd(2)
|
|
|
|
manager.wait_till_active()
|
|
|
|
|
|
|
|
# bring up 1
|
|
|
|
manager.mark_in_osd(1)
|
|
|
|
manager.wait_till_active()
|
|
|
|
|
2017-05-18 22:16:55 +00:00
|
|
|
manager.flush_pg_stats([0, 1])
|
2012-03-30 01:07:10 +00:00
|
|
|
log.info("Getting unfound objects")
|
|
|
|
unfound = manager.get_num_unfound_objects()
|
|
|
|
assert not unfound
|
|
|
|
|
|
|
|
manager.kill_osd(2)
|
|
|
|
manager.mark_down_osd(2)
|
|
|
|
manager.kill_osd(3)
|
|
|
|
manager.mark_down_osd(3)
|
|
|
|
|
2017-05-18 22:16:55 +00:00
|
|
|
manager.flush_pg_stats([0, 1])
|
2012-03-30 01:07:10 +00:00
|
|
|
log.info("Getting unfound objects")
|
|
|
|
unfound = manager.get_num_unfound_objects()
|
|
|
|
assert unfound
|