]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/rbd_mirror.py
2 Task for running rbd mirroring daemons and configuring mirroring
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
14 log
= logging
.getLogger(__name__
)
17 class RBDMirror(Task
):
19 Run an rbd-mirror daemon to sync rbd images between clusters.
21 This requires two clients (one from each cluster) on the same host
22 to connect with. The pool configuration should be adjusted by later
23 test scripts to include the remote client and cluster name. This task
24 just needs to know how to connect to the local cluster.
29 - [primary.mon.a, primary.osd.0, primary.osd.1, primary.osd.2]
30 - [secondary.mon.a, secondary.osd.0, secondary.osd.1, secondary.osd.2]
31 - [primary.client.mirror, secondary.client.mirror]
38 client: primary.client.mirror
40 To mirror back to the primary cluster as well, add another
44 client: secondary.client.mirror
46 Possible options for this task are:
48 client: role - ceph client to connect as
49 valgrind: [--tool=<valgrind tool>] - none by default
50 coverage: bool - whether this run may be collecting coverage data
51 thrash: bool - whether this run may be thrashed
53 def __init__(self
, ctx
, config
):
54 super(RBDMirror
, self
).__init
__(ctx
, config
)
58 super(RBDMirror
, self
).setup()
60 self
.client
= self
.config
['client']
62 raise ConfigError('rbd-mirror requires a client to connect with')
64 self
.cluster_name
, type_
, self
.client_id
= misc
.split_role(self
.client
)
67 msg
= 'client role ({0}) must be a client'.format(self
.client
)
68 raise ConfigError(msg
)
70 self
.remote
= get_remote_for_role(self
.ctx
, self
.client
)
73 super(RBDMirror
, self
).begin()
74 testdir
= misc
.get_testdir(self
.ctx
)
75 daemon_signal
= 'kill'
76 if 'coverage' in self
.config
or 'valgrind' in self
.config
or \
77 self
.config
.get('thrash', False):
78 daemon_signal
= 'term'
83 '{tdir}/archive/coverage'.format(tdir
=testdir
),
88 if 'valgrind' in self
.config
:
89 args
= get_valgrind_args(
91 'rbd-mirror-{id}'.format(id=self
.client
),
93 self
.config
.get('valgrind')
97 'rbd-mirror', '--foreground',
104 self
.ctx
.daemons
.add_daemon(
105 self
.remote
, 'rbd-mirror', self
.client
,
106 cluster
=self
.cluster_name
,
108 logger
=self
.log
.getChild(self
.client
),
114 mirror_daemon
= self
.ctx
.daemons
.get_daemon('rbd-mirror',
118 super(RBDMirror
, self
).end()