2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Filestore/filejournal handler
|
|
|
|
"""
|
2011-11-11 05:35:11 +00:00
|
|
|
import logging
|
2014-08-07 14:24:59 +00:00
|
|
|
from teuthology.orchestra import run
|
2012-04-14 21:06:12 +00:00
|
|
|
import random
|
2011-11-11 05:35:11 +00:00
|
|
|
|
|
|
|
from teuthology import misc as teuthology
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Test filestore/filejournal handling of non-idempotent events.
|
|
|
|
|
|
|
|
Currently this is a kludge; we require the ceph task preceeds us just
|
|
|
|
so that we get the tarball installed to run the test binary.
|
2013-10-12 08:28:27 +00:00
|
|
|
|
|
|
|
:param ctx: Context
|
|
|
|
:param config: Configuration
|
2011-11-11 05:35:11 +00:00
|
|
|
"""
|
|
|
|
assert config is None or isinstance(config, list) \
|
|
|
|
or isinstance(config, dict), \
|
|
|
|
"task only supports a list or dictionary for configuration"
|
|
|
|
all_clients = ['client.{id}'.format(id=id_)
|
|
|
|
for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
|
|
|
|
if config is None:
|
|
|
|
config = all_clients
|
|
|
|
if isinstance(config, list):
|
|
|
|
config = dict.fromkeys(config)
|
|
|
|
clients = config.keys()
|
|
|
|
|
|
|
|
# just use the first client...
|
|
|
|
client = clients[0];
|
2014-03-27 16:35:28 +00:00
|
|
|
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
|
2011-11-11 05:35:11 +00:00
|
|
|
|
2013-01-23 20:37:39 +00:00
|
|
|
testdir = teuthology.get_testdir(ctx)
|
|
|
|
|
2016-05-11 19:08:17 +00:00
|
|
|
dir = '%s/ceph.data/test.%s' % (testdir, client)
|
2011-11-11 05:35:11 +00:00
|
|
|
|
2012-04-14 21:06:12 +00:00
|
|
|
seed = str(int(random.uniform(1,100)))
|
|
|
|
|
|
|
|
try:
|
|
|
|
log.info('creating a working dir')
|
|
|
|
remote.run(args=['mkdir', dir])
|
|
|
|
remote.run(
|
|
|
|
args=[
|
|
|
|
'cd', dir,
|
|
|
|
run.Raw('&&'),
|
|
|
|
'wget','-q', '-Orun_seed_to.sh',
|
2015-04-16 16:05:30 +00:00
|
|
|
'http://git.ceph.com/?p=ceph.git;a=blob_plain;f=src/test/objectstore/run_seed_to.sh;hb=HEAD',
|
2012-04-14 21:06:12 +00:00
|
|
|
run.Raw('&&'),
|
|
|
|
'wget','-q', '-Orun_seed_to_range.sh',
|
2015-04-16 16:05:30 +00:00
|
|
|
'http://git.ceph.com/?p=ceph.git;a=blob_plain;f=src/test/objectstore/run_seed_to_range.sh;hb=HEAD',
|
2012-04-14 21:06:12 +00:00
|
|
|
run.Raw('&&'),
|
|
|
|
'chmod', '+x', 'run_seed_to.sh', 'run_seed_to_range.sh',
|
|
|
|
]);
|
|
|
|
|
|
|
|
log.info('running a series of tests')
|
|
|
|
proc = remote.run(
|
|
|
|
args=[
|
|
|
|
'cd', dir,
|
|
|
|
run.Raw('&&'),
|
|
|
|
'./run_seed_to_range.sh', seed, '50', '300',
|
|
|
|
],
|
|
|
|
wait=False,
|
|
|
|
check_status=False)
|
2014-05-30 19:32:38 +00:00
|
|
|
result = proc.wait()
|
|
|
|
|
2012-04-14 21:06:12 +00:00
|
|
|
if result != 0:
|
|
|
|
remote.run(
|
|
|
|
args=[
|
2013-01-23 20:37:39 +00:00
|
|
|
'cp', '-a', dir, '{tdir}/archive/idempotent_failure'.format(tdir=testdir),
|
2012-04-14 21:06:12 +00:00
|
|
|
])
|
|
|
|
raise Exception("./run_seed_to_range.sh errored out")
|
|
|
|
|
|
|
|
finally:
|
|
|
|
remote.run(args=[
|
|
|
|
'rm', '-rf', '--', dir
|
|
|
|
])
|
2014-05-30 19:32:38 +00:00
|
|
|
|