]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rbd/rbd_mirror.sh
bump version to 12.1.1-pve1 while rebasing patches
[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}
120wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
121wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
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}
133wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
134wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
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}
141wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
142promote_image ${CLUSTER2} ${POOL} ${image}
143wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
144wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
145wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
146wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
147compare_images ${POOL} ${image}
148
149# failover
150demote_image ${CLUSTER2} ${POOL} ${image}
151wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
152wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
153wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
154promote_image ${CLUSTER1} ${POOL} ${image}
155wait_for_image_replay_started ${CLUSTER2} ${POOL} ${image}
156write_image ${CLUSTER1} ${POOL} ${image} 100
157wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} ${image}
158wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
159wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+replaying' 'master_position'
160compare_images ${POOL} ${image}
161
162# failback
163demote_image ${CLUSTER1} ${POOL} ${image}
164wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${image}
165wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
166promote_image ${CLUSTER2} ${POOL} ${image}
167wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
168write_image ${CLUSTER2} ${POOL} ${image} 100
169wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
170wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
171wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
172compare_images ${POOL} ${image}
173
174# force promote
175force_promote_image=test_force_promote
176create_image ${CLUSTER2} ${POOL} ${force_promote_image}
177write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
178wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
179wait_for_image_replay_started ${CLUSTER1} ${POOL} ${force_promote_image}
180wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${force_promote_image}
181wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+replaying' 'master_position'
182wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
183promote_image ${CLUSTER1} ${POOL} ${force_promote_image} '--force'
184wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${force_promote_image}
185wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
186wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+stopped'
187wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
188write_image ${CLUSTER1} ${POOL} ${force_promote_image} 100
189write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
190
191testlog "TEST: cloned images"
192parent_image=test_parent
193parent_snap=snap
194create_image ${CLUSTER2} ${PARENT_POOL} ${parent_image}
195write_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} 100
196create_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
197protect_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
198
199clone_image=test_clone
200clone_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap} ${POOL} ${clone_image}
201write_image ${CLUSTER2} ${POOL} ${clone_image} 100
202
203enable_mirror ${CLUSTER2} ${PARENT_POOL} ${parent_image}
204wait_for_image_replay_started ${CLUSTER1} ${PARENT_POOL} ${parent_image}
205wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${PARENT_POOL} ${parent_image}
206wait_for_status_in_pool_dir ${CLUSTER1} ${PARENT_POOL} ${parent_image} 'up+replaying' 'master_position'
207compare_images ${PARENT_POOL} ${parent_image}
208
209wait_for_image_replay_started ${CLUSTER1} ${POOL} ${clone_image}
210wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${clone_image}
211wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${clone_image} 'up+replaying' 'master_position'
212compare_images ${POOL} ${clone_image}
213
214expect_failure "is non-primary" clone_image ${CLUSTER1} ${PARENT_POOL} \
215 ${parent_image} ${parent_snap} ${POOL} ${clone_image}1
216
217testlog "TEST: disable mirroring / delete non-primary image"
218image2=test2
219image3=test3
220image4=test4
221image5=test5
222for i in ${image2} ${image3} ${image4} ${image5}; do
223 create_image ${CLUSTER2} ${POOL} ${i}
224 write_image ${CLUSTER2} ${POOL} ${i} 100
225 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
226 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
227 if [ "${i}" = "${image4}" ] || [ "${i}" = "${image5}" ]; then
228 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
229 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
230 fi
231 write_image ${CLUSTER2} ${POOL} ${i} 100
232 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
233 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
234done
235
236set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
237for i in ${image2} ${image4}; do
238 disable_mirror ${CLUSTER2} ${POOL} ${i}
239done
240
241unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap1'
242unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap2'
243for i in ${image3} ${image5}; do
244 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
245 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
246 remove_image_retry ${CLUSTER2} ${POOL} ${i}
247done
248
249for i in ${image2} ${image3} ${image4} ${image5}; do
250 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'deleted'
251done
252
253set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
254for i in ${image2} ${image4}; do
255 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
256 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
257 wait_for_image_replay_started ${CLUSTER1} ${POOL} ${i}
258 wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${i}
259 compare_images ${POOL} ${i}
260done
261
262testlog "TEST: snapshot rename"
263snap_name='snap_rename'
264create_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_0"
265for i in `seq 1 20`; do
266 rename_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_$(expr ${i} - 1)" "${snap_name}_${i}"
267done
268wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}"
269
270testlog "TEST: disable mirror while daemon is stopped"
271stop_mirror ${CLUSTER1}
272stop_mirror ${CLUSTER2}
273set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
274disable_mirror ${CLUSTER2} ${POOL} ${image}
275if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
276 test_image_present ${CLUSTER1} ${POOL} ${image} 'present'
277fi
278start_mirror ${CLUSTER1}
279wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
280set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
281wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
282wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
283
284testlog "TEST: simple image resync"
285request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
286wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
287wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
288wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
289compare_images ${POOL} ${image}
290
291testlog "TEST: image resync while replayer is stopped"
292admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
293wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
294request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
295admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
296wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
297admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
298wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
299wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
300compare_images ${POOL} ${image}
301
302testlog "TEST: request image resync while daemon is offline"
303stop_mirror ${CLUSTER1}
304request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
305start_mirror ${CLUSTER1}
306wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
307wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
308wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
309compare_images ${POOL} ${image}
310
311testlog "TEST: client disconnect"
312image=laggy
313create_image ${CLUSTER2} ${POOL} ${image} 128 --journal-object-size 64K
314write_image ${CLUSTER2} ${POOL} ${image} 10
315
316testlog " - replay stopped after disconnect"
317wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
318wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
319test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
320disconnect_image ${CLUSTER2} ${POOL} ${image}
321test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
322wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
323wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
324
325testlog " - replay started after resync requested"
326request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
327wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
328wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
329wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
330test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
331compare_images ${POOL} ${image}
332
333testlog " - disconnected after max_concurrent_object_sets reached"
334admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
335wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
336test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
337set_image_meta ${CLUSTER2} ${POOL} ${image} \
338 conf_rbd_journal_max_concurrent_object_sets 1
339write_image ${CLUSTER2} ${POOL} ${image} 20 16384
340write_image ${CLUSTER2} ${POOL} ${image} 20 16384
341test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
342set_image_meta ${CLUSTER2} ${POOL} ${image} \
343 conf_rbd_journal_max_concurrent_object_sets 0
344
345testlog " - replay is still stopped (disconnected) after restart"
346admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
347wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
348wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
349
350testlog " - replay started after resync requested"
351request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
352wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
353wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
354wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
355test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
356compare_images ${POOL} ${image}
357
358testlog " - rbd_mirroring_resync_after_disconnect config option"
359set_image_meta ${CLUSTER2} ${POOL} ${image} \
360 conf_rbd_mirroring_resync_after_disconnect true
361wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
362disconnect_image ${CLUSTER2} ${POOL} ${image}
363wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
364wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
365wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
366test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
367compare_images ${POOL} ${image}
368set_image_meta ${CLUSTER2} ${POOL} ${image} \
369 conf_rbd_mirroring_resync_after_disconnect false
370wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
371disconnect_image ${CLUSTER2} ${POOL} ${image}
372test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
373wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
374wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
375
376testlog "TEST: split-brain"
377image=split-brain
378create_image ${CLUSTER2} ${POOL} ${image}
379wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
380demote_image ${CLUSTER2} ${POOL} ${image}
381wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
382promote_image ${CLUSTER1} ${POOL} ${image}
383write_image ${CLUSTER1} ${POOL} ${image} 10
384demote_image ${CLUSTER1} ${POOL} ${image}
385promote_image ${CLUSTER2} ${POOL} ${image}
386wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'split-brain'
387request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
388wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
389
31f18b77
FG
390testlog "TEST: no blacklists"
391ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
392ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
393
7c673cae 394echo OK