]> git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/cephfs_mirror.py
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / qa / tasks / cephfs_mirror.py
1 """
2 Task for running cephfs mirror daemons
3 """
4
5 import logging
6
7 from teuthology.orchestra import run
8 from teuthology import misc
9 from teuthology.exceptions import ConfigError
10 from teuthology.task import Task
11 from tasks.ceph_manager import get_valgrind_args
12 from tasks.util import get_remote_for_role
13
14 log = logging.getLogger(__name__)
15
16 class CephFSMirror(Task):
17 def __init__(self, ctx, config):
18 super(CephFSMirror, self).__init__(ctx, config)
19 self.log = log
20
21 def setup(self):
22 super(CephFSMirror, self).setup()
23 try:
24 self.client = self.config['client']
25 except KeyError:
26 raise ConfigError('cephfs-mirror requires a client to connect')
27
28 self.cluster_name, type_, self.client_id = misc.split_role(self.client)
29 if not type_ == 'client':
30 raise ConfigError(f'client role {self.client} must be a client')
31 self.remote = get_remote_for_role(self.ctx, self.client)
32
33 def begin(self):
34 super(CephFSMirror, self).begin()
35 testdir = misc.get_testdir(self.ctx)
36
37 args = [
38 'adjust-ulimits',
39 'ceph-coverage',
40 '{tdir}/archive/coverage'.format(tdir=testdir),
41 'daemon-helper',
42 'term',
43 ]
44
45 if 'valgrind' in self.config:
46 args = get_valgrind_args(
47 testdir, 'cephfs-mirror-{id}'.format(id=self.client),
48 args, self.config.get('valgrind'))
49
50 args.extend([
51 'cephfs-mirror',
52 '--cluster',
53 self.cluster_name,
54 '--id',
55 self.client_id,
56 ])
57
58 self.ctx.daemons.add_daemon(
59 self.remote, 'cephfs-mirror', self.client,
60 args=args,
61 logger=self.log.getChild(self.client),
62 stdin=run.PIPE,
63 wait=False,
64 )
65
66 def end(self):
67 mirror_daemon = self.ctx.daemons.get_daemon('cephfs-mirror', self.client)
68 mirror_daemon.stop()
69 super(CephFSMirror, self).end()
70
71 task = CephFSMirror