]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/rbd_mirror.py
7e0bdb7187431eccdabb48c2643197b9d6166e4d
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 util
import get_remote_for_role
13 log
= logging
.getLogger(__name__
)
16 class RBDMirror(Task
):
18 Run an rbd-mirror daemon to sync rbd images between clusters.
20 This requires two clients (one from each cluster) on the same host
21 to connect with. The pool configuration should be adjusted by later
22 test scripts to include the remote client and cluster name. This task
23 just needs to know how to connect to the local cluster.
28 - [primary.mon.a, primary.osd.0, primary.osd.1, primary.osd.2]
29 - [secondary.mon.a, secondary.osd.0, secondary.osd.1, secondary.osd.2]
30 - [primary.client.mirror, secondary.client.mirror]
37 client: primary.client.mirror
39 To mirror back to the primary cluster as well, add another
43 client: secondary.client.mirror
45 Possible options for this task are:
47 client: role - ceph client to connect as
48 valgrind: [--tool=<valgrind tool>] - none by default
49 coverage: bool - whether this run may be collecting coverage data
51 def __init__(self
, ctx
, config
):
52 super(RBDMirror
, self
).__init
__(ctx
, config
)
56 super(RBDMirror
, self
).setup()
58 self
.client
= self
.config
['client']
60 raise ConfigError('rbd-mirror requires a client to connect with')
62 self
.cluster_name
, type_
, self
.client_id
= misc
.split_role(self
.client
)
65 msg
= 'client role ({0}) must be a client'.format(self
.client
)
66 raise ConfigError(msg
)
68 self
.remote
= get_remote_for_role(self
.ctx
, self
.client
)
71 super(RBDMirror
, self
).begin()
72 testdir
= misc
.get_testdir(self
.ctx
)
73 daemon_signal
= 'kill'
74 if 'coverage' in self
.config
or 'valgrind' in self
.config
:
75 daemon_signal
= 'term'
80 '{tdir}/archive/coverage'.format(tdir
=testdir
),
85 if 'valgrind' in self
.config
:
86 args
= misc
.get_valgrind_args(
88 'rbd-mirror-{id}'.format(id=self
.client
),
90 self
.config
.get('valgrind')
101 self
.ctx
.daemons
.add_daemon(
102 self
.remote
, 'rbd-mirror', self
.client
,
103 cluster
=self
.cluster_name
,
105 logger
=self
.log
.getChild(self
.client
),
111 mirror_daemon
= self
.ctx
.daemons
.get_daemon('rbd-mirror',
115 super(RBDMirror
, self
).end()