]> git.proxmox.com Git - ceph.git/blame - ceph/qa/tasks/filestore_idempotent.py
update sources to 12.2.7
[ceph.git] / ceph / qa / tasks / filestore_idempotent.py
CommitLineData
7c673cae
FG
1"""
2Filestore/filejournal handler
3"""
4import logging
5from teuthology.orchestra import run
6import random
7
8from teuthology import misc as teuthology
9
10log = logging.getLogger(__name__)
11
12def task(ctx, config):
13 """
14 Test filestore/filejournal handling of non-idempotent events.
15
16 Currently this is a kludge; we require the ceph task preceeds us just
17 so that we get the tarball installed to run the test binary.
18
19 :param ctx: Context
20 :param config: Configuration
21 """
22 assert config is None or isinstance(config, list) \
23 or isinstance(config, dict), \
24 "task only supports a list or dictionary for configuration"
25 all_clients = ['client.{id}'.format(id=id_)
26 for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
27 if config is None:
28 config = all_clients
29 if isinstance(config, list):
30 config = dict.fromkeys(config)
31 clients = config.keys()
32
33 # just use the first client...
34 client = clients[0];
35 (remote,) = ctx.cluster.only(client).remotes.iterkeys()
36
37 testdir = teuthology.get_testdir(ctx)
38
39 dir = '%s/ceph.data/test.%s' % (testdir, client)
40
28e407b8
AA
41 seed = int(random.uniform(1,100))
42 start = 800 + random.randint(800,1200)
43 end = start + 150
7c673cae
FG
44
45 try:
46 log.info('creating a working dir')
47 remote.run(args=['mkdir', dir])
48 remote.run(
49 args=[
50 'cd', dir,
51 run.Raw('&&'),
52 'wget','-q', '-Orun_seed_to.sh',
53 'http://git.ceph.com/?p=ceph.git;a=blob_plain;f=src/test/objectstore/run_seed_to.sh;hb=HEAD',
54 run.Raw('&&'),
55 'wget','-q', '-Orun_seed_to_range.sh',
56 'http://git.ceph.com/?p=ceph.git;a=blob_plain;f=src/test/objectstore/run_seed_to_range.sh;hb=HEAD',
57 run.Raw('&&'),
58 'chmod', '+x', 'run_seed_to.sh', 'run_seed_to_range.sh',
59 ]);
60
61 log.info('running a series of tests')
62 proc = remote.run(
63 args=[
64 'cd', dir,
65 run.Raw('&&'),
28e407b8 66 './run_seed_to_range.sh', str(seed), str(start), str(end),
7c673cae
FG
67 ],
68 wait=False,
69 check_status=False)
70 result = proc.wait()
71
72 if result != 0:
73 remote.run(
74 args=[
75 'cp', '-a', dir, '{tdir}/archive/idempotent_failure'.format(tdir=testdir),
76 ])
77 raise Exception("./run_seed_to_range.sh errored out")
78
79 finally:
80 remote.run(args=[
81 'rm', '-rf', '--', dir
82 ])
83