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