]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rbd/rbd_mirror.sh
update sources to v12.1.3
[ceph.git] / ceph / qa / workunits / rbd / rbd_mirror.sh
CommitLineData
7c673cae
FG
1#!/bin/sh
2#
3# rbd_mirror.sh - test rbd-mirror daemon
4#
5# The scripts starts two ("local" and "remote") clusters using mstart.sh script,
6# creates a temporary directory, used for cluster configs, daemon logs, admin
7# socket, temporary files, and launches rbd-mirror daemon.
8#
9
10. $(dirname $0)/rbd_mirror_helpers.sh
11
12testlog "TEST: add image and test replay"
13start_mirror ${CLUSTER1}
14image=test
15create_image ${CLUSTER2} ${POOL} ${image}
16wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
17write_image ${CLUSTER2} ${POOL} ${image} 100
18wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
19wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
20if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
21 wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'down+unknown'
22fi
23compare_images ${POOL} ${image}
24
25testlog "TEST: stop mirror, add image, start mirror and test replay"
26stop_mirror ${CLUSTER1}
27image1=test1
28create_image ${CLUSTER2} ${POOL} ${image1}
29write_image ${CLUSTER2} ${POOL} ${image1} 100
30start_mirror ${CLUSTER1}
31wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
32wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image1}
33wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying' 'master_position'
34if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
35 wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image1} 'down+unknown'
36fi
37compare_images ${POOL} ${image1}
38
39testlog "TEST: test the first image is replaying after restart"
40write_image ${CLUSTER2} ${POOL} ${image} 100
41wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
42wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
43wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
44compare_images ${POOL} ${image}
45
46testlog "TEST: stop/start/restart mirror via admin socket"
47admin_daemon ${CLUSTER1} rbd mirror stop
48wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
49wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
50wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
51wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
52
53admin_daemon ${CLUSTER1} rbd mirror start
54wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
55wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
56wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
57wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
58
59admin_daemon ${CLUSTER1} rbd mirror restart
60wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
61wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
62wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
63wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
64
65admin_daemon ${CLUSTER1} rbd mirror stop
66wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
67wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
68wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
69wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
70
71admin_daemon ${CLUSTER1} rbd mirror restart
72wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
73wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
74wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
75wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
76
77admin_daemon ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
78wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
79wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
80wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
81wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
82
83admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
84wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
85wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
86
87admin_daemon ${CLUSTER1} rbd mirror start ${POOL} ${CLUSTER2}
88wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
89wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
90
91admin_daemon ${CLUSTER1} rbd mirror restart ${POOL}/${image}
92wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
93wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
94
95admin_daemon ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
96wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
97wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
98
99admin_daemon ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
100wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
101wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
102wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
103wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
104
105admin_daemon ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
106wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
107wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
108wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
109wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
110
111admin_daemon ${CLUSTER1} rbd mirror flush
112admin_daemon ${CLUSTER1} rbd mirror status
113
114testlog "TEST: failover and failback"
115start_mirror ${CLUSTER2}
116
117# demote and promote same cluster
118demote_image ${CLUSTER2} ${POOL} ${image}
119wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
c07f9fc5
FG
120wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
121wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
7c673cae
FG
122promote_image ${CLUSTER2} ${POOL} ${image}
123wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
124write_image ${CLUSTER2} ${POOL} ${image} 100
125wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
126wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
127wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
128compare_images ${POOL} ${image}
129
130# failover (unmodified)
131demote_image ${CLUSTER2} ${POOL} ${image}
132wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
c07f9fc5
FG
133wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
134wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
7c673cae
FG
135promote_image ${CLUSTER1} ${POOL} ${image}
136wait_for_image_replay_started ${CLUSTER2} ${POOL} ${image}
137
138# failback (unmodified)
139demote_image ${CLUSTER1} ${POOL} ${image}
140wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${image}
c07f9fc5
FG
141wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
142wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
7c673cae
FG
143promote_image ${CLUSTER2} ${POOL} ${image}
144wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
145wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
146wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
147wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
148compare_images ${POOL} ${image}
149
150# failover
151demote_image ${CLUSTER2} ${POOL} ${image}
152wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
c07f9fc5
FG
153wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
154wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
7c673cae
FG
155promote_image ${CLUSTER1} ${POOL} ${image}
156wait_for_image_replay_started ${CLUSTER2} ${POOL} ${image}
157write_image ${CLUSTER1} ${POOL} ${image} 100
158wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} ${image}
159wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
160wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+replaying' 'master_position'
161compare_images ${POOL} ${image}
162
163# failback
164demote_image ${CLUSTER1} ${POOL} ${image}
165wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${image}
c07f9fc5
FG
166wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
167wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
7c673cae
FG
168promote_image ${CLUSTER2} ${POOL} ${image}
169wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
170write_image ${CLUSTER2} ${POOL} ${image} 100
171wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
172wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
173wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
174compare_images ${POOL} ${image}
175
176# force promote
177force_promote_image=test_force_promote
178create_image ${CLUSTER2} ${POOL} ${force_promote_image}
179write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
180wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
181wait_for_image_replay_started ${CLUSTER1} ${POOL} ${force_promote_image}
182wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${force_promote_image}
183wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+replaying' 'master_position'
184wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
185promote_image ${CLUSTER1} ${POOL} ${force_promote_image} '--force'
186wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${force_promote_image}
187wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
188wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+stopped'
189wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
190write_image ${CLUSTER1} ${POOL} ${force_promote_image} 100
191write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
192
193testlog "TEST: cloned images"
194parent_image=test_parent
195parent_snap=snap
196create_image ${CLUSTER2} ${PARENT_POOL} ${parent_image}
197write_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} 100
198create_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
199protect_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
200
201clone_image=test_clone
202clone_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap} ${POOL} ${clone_image}
203write_image ${CLUSTER2} ${POOL} ${clone_image} 100
204
205enable_mirror ${CLUSTER2} ${PARENT_POOL} ${parent_image}
206wait_for_image_replay_started ${CLUSTER1} ${PARENT_POOL} ${parent_image}
207wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${PARENT_POOL} ${parent_image}
208wait_for_status_in_pool_dir ${CLUSTER1} ${PARENT_POOL} ${parent_image} 'up+replaying' 'master_position'
209compare_images ${PARENT_POOL} ${parent_image}
210
211wait_for_image_replay_started ${CLUSTER1} ${POOL} ${clone_image}
212wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${clone_image}
213wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${clone_image} 'up+replaying' 'master_position'
214compare_images ${POOL} ${clone_image}
215
216expect_failure "is non-primary" clone_image ${CLUSTER1} ${PARENT_POOL} \
217 ${parent_image} ${parent_snap} ${POOL} ${clone_image}1
218
219testlog "TEST: disable mirroring / delete non-primary image"
220image2=test2
221image3=test3
222image4=test4
223image5=test5
224for i in ${image2} ${image3} ${image4} ${image5}; do
225 create_image ${CLUSTER2} ${POOL} ${i}
226 write_image ${CLUSTER2} ${POOL} ${i} 100
227 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
228 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
229 if [ "${i}" = "${image4}" ] || [ "${i}" = "${image5}" ]; then
230 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
231 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
232 fi
233 write_image ${CLUSTER2} ${POOL} ${i} 100
234 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
235 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
236done
237
238set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
239for i in ${image2} ${image4}; do
240 disable_mirror ${CLUSTER2} ${POOL} ${i}
241done
242
243unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap1'
244unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap2'
245for i in ${image3} ${image5}; do
246 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
247 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
248 remove_image_retry ${CLUSTER2} ${POOL} ${i}
249done
250
251for i in ${image2} ${image3} ${image4} ${image5}; do
252 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'deleted'
253done
254
255set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
256for i in ${image2} ${image4}; do
257 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
258 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
259 wait_for_image_replay_started ${CLUSTER1} ${POOL} ${i}
260 wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${i}
261 compare_images ${POOL} ${i}
262done
263
264testlog "TEST: snapshot rename"
265snap_name='snap_rename'
266create_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_0"
267for i in `seq 1 20`; do
268 rename_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_$(expr ${i} - 1)" "${snap_name}_${i}"
269done
270wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}"
271
272testlog "TEST: disable mirror while daemon is stopped"
273stop_mirror ${CLUSTER1}
274stop_mirror ${CLUSTER2}
275set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
276disable_mirror ${CLUSTER2} ${POOL} ${image}
277if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
278 test_image_present ${CLUSTER1} ${POOL} ${image} 'present'
279fi
280start_mirror ${CLUSTER1}
281wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
282set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
283wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
284wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
285
286testlog "TEST: simple image resync"
287request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
288wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 289wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
290wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
291wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
292compare_images ${POOL} ${image}
293
294testlog "TEST: image resync while replayer is stopped"
295admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
296wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
297request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
298admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
299wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
300admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
d2e6a577 301wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
302wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
303wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
304compare_images ${POOL} ${image}
305
306testlog "TEST: request image resync while daemon is offline"
307stop_mirror ${CLUSTER1}
308request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
309start_mirror ${CLUSTER1}
310wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 311wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
312wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
313wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
314compare_images ${POOL} ${image}
315
316testlog "TEST: client disconnect"
317image=laggy
318create_image ${CLUSTER2} ${POOL} ${image} 128 --journal-object-size 64K
319write_image ${CLUSTER2} ${POOL} ${image} 10
320
321testlog " - replay stopped after disconnect"
322wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
323wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
324test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
325disconnect_image ${CLUSTER2} ${POOL} ${image}
326test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
327wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
328wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
329
330testlog " - replay started after resync requested"
331request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
332wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 333wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
334wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
335wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
336test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
337compare_images ${POOL} ${image}
338
339testlog " - disconnected after max_concurrent_object_sets reached"
340admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
341wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
342test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
343set_image_meta ${CLUSTER2} ${POOL} ${image} \
344 conf_rbd_journal_max_concurrent_object_sets 1
345write_image ${CLUSTER2} ${POOL} ${image} 20 16384
346write_image ${CLUSTER2} ${POOL} ${image} 20 16384
347test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
348set_image_meta ${CLUSTER2} ${POOL} ${image} \
349 conf_rbd_journal_max_concurrent_object_sets 0
350
351testlog " - replay is still stopped (disconnected) after restart"
352admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
353wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
354wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
355
356testlog " - replay started after resync requested"
357request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
358wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 359wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
360wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
361wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
362test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
363compare_images ${POOL} ${image}
364
365testlog " - rbd_mirroring_resync_after_disconnect config option"
366set_image_meta ${CLUSTER2} ${POOL} ${image} \
367 conf_rbd_mirroring_resync_after_disconnect true
368wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
d2e6a577 369image_id=$(get_image_id ${CLUSTER1} ${pool} ${image})
7c673cae 370disconnect_image ${CLUSTER2} ${POOL} ${image}
d2e6a577
FG
371wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
372wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
373wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
374wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
375test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
376compare_images ${POOL} ${image}
377set_image_meta ${CLUSTER2} ${POOL} ${image} \
378 conf_rbd_mirroring_resync_after_disconnect false
379wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
380disconnect_image ${CLUSTER2} ${POOL} ${image}
381test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
382wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
383wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
384
385testlog "TEST: split-brain"
386image=split-brain
387create_image ${CLUSTER2} ${POOL} ${image}
388wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
389demote_image ${CLUSTER2} ${POOL} ${image}
c07f9fc5 390wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
7c673cae
FG
391promote_image ${CLUSTER1} ${POOL} ${image}
392write_image ${CLUSTER1} ${POOL} ${image} 10
393demote_image ${CLUSTER1} ${POOL} ${image}
394promote_image ${CLUSTER2} ${POOL} ${image}
395wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'split-brain'
396request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
397wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
398
31f18b77 399testlog "TEST: no blacklists"
c07f9fc5
FG
400CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
401CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
31f18b77 402
7c673cae 403echo OK