]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rbd/rbd_mirror.sh
bump version to 12.2.1-pve3
[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
b5b8bbf5
FG
219testlog "TEST: data pool"
220dp_image=test_data_pool
221create_image ${CLUSTER2} ${POOL} ${dp_image} 128 --data-pool ${PARENT_POOL}
222data_pool=$(get_image_data_pool ${CLUSTER2} ${POOL} ${dp_image})
223test "${data_pool}" = "${PARENT_POOL}"
224wait_for_image_replay_started ${CLUSTER1} ${POOL} ${dp_image}
225data_pool=$(get_image_data_pool ${CLUSTER1} ${POOL} ${dp_image})
226test "${data_pool}" = "${PARENT_POOL}"
227create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap1'
228write_image ${CLUSTER2} ${POOL} ${dp_image} 100
229create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap2'
230write_image ${CLUSTER2} ${POOL} ${dp_image} 100
231wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${dp_image}
232wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${dp_image} 'up+replaying' 'master_position'
233compare_images ${POOL} ${dp_image}@snap1
234compare_images ${POOL} ${dp_image}@snap2
235compare_images ${POOL} ${dp_image}
236
7c673cae
FG
237testlog "TEST: disable mirroring / delete non-primary image"
238image2=test2
239image3=test3
240image4=test4
241image5=test5
242for i in ${image2} ${image3} ${image4} ${image5}; do
243 create_image ${CLUSTER2} ${POOL} ${i}
244 write_image ${CLUSTER2} ${POOL} ${i} 100
245 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
246 create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
247 if [ "${i}" = "${image4}" ] || [ "${i}" = "${image5}" ]; then
248 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
249 protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
250 fi
251 write_image ${CLUSTER2} ${POOL} ${i} 100
252 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
253 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
254done
255
256set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
257for i in ${image2} ${image4}; do
258 disable_mirror ${CLUSTER2} ${POOL} ${i}
259done
260
261unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap1'
262unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap2'
263for i in ${image3} ${image5}; do
264 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
265 remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
266 remove_image_retry ${CLUSTER2} ${POOL} ${i}
267done
268
269for i in ${image2} ${image3} ${image4} ${image5}; do
270 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'deleted'
271done
272
273set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
274for i in ${image2} ${image4}; do
275 wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
276 wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
277 wait_for_image_replay_started ${CLUSTER1} ${POOL} ${i}
278 wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${i}
279 compare_images ${POOL} ${i}
280done
281
282testlog "TEST: snapshot rename"
283snap_name='snap_rename'
284create_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_0"
285for i in `seq 1 20`; do
286 rename_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_$(expr ${i} - 1)" "${snap_name}_${i}"
287done
288wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}"
289
290testlog "TEST: disable mirror while daemon is stopped"
291stop_mirror ${CLUSTER1}
292stop_mirror ${CLUSTER2}
293set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
294disable_mirror ${CLUSTER2} ${POOL} ${image}
295if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
296 test_image_present ${CLUSTER1} ${POOL} ${image} 'present'
297fi
298start_mirror ${CLUSTER1}
299wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
300set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
301wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
302wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
303
304testlog "TEST: simple image resync"
305request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
306wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 307wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
308wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
309wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
310compare_images ${POOL} ${image}
311
312testlog "TEST: image resync while replayer is stopped"
313admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
314wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
315request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
316admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
317wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
318admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
d2e6a577 319wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
320wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
321wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
322compare_images ${POOL} ${image}
323
324testlog "TEST: request image resync while daemon is offline"
325stop_mirror ${CLUSTER1}
326request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
327start_mirror ${CLUSTER1}
328wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 329wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
330wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
331wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
332compare_images ${POOL} ${image}
333
334testlog "TEST: client disconnect"
335image=laggy
336create_image ${CLUSTER2} ${POOL} ${image} 128 --journal-object-size 64K
337write_image ${CLUSTER2} ${POOL} ${image} 10
338
339testlog " - replay stopped after disconnect"
340wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
341wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
342test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
343disconnect_image ${CLUSTER2} ${POOL} ${image}
344test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
345wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
346wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
347
348testlog " - replay started after resync requested"
349request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
350wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 351wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
352wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
353wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
354test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
355compare_images ${POOL} ${image}
356
357testlog " - disconnected after max_concurrent_object_sets reached"
358admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
359wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
360test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
361set_image_meta ${CLUSTER2} ${POOL} ${image} \
362 conf_rbd_journal_max_concurrent_object_sets 1
363write_image ${CLUSTER2} ${POOL} ${image} 20 16384
364write_image ${CLUSTER2} ${POOL} ${image} 20 16384
365test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
366set_image_meta ${CLUSTER2} ${POOL} ${image} \
367 conf_rbd_journal_max_concurrent_object_sets 0
368
369testlog " - replay is still stopped (disconnected) after restart"
370admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
371wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
372wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
373
374testlog " - replay started after resync requested"
375request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
376wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
d2e6a577 377wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
378wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
379wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
380test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
381compare_images ${POOL} ${image}
382
383testlog " - rbd_mirroring_resync_after_disconnect config option"
384set_image_meta ${CLUSTER2} ${POOL} ${image} \
385 conf_rbd_mirroring_resync_after_disconnect true
386wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
d2e6a577 387image_id=$(get_image_id ${CLUSTER1} ${pool} ${image})
7c673cae 388disconnect_image ${CLUSTER2} ${POOL} ${image}
d2e6a577
FG
389wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
390wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
7c673cae
FG
391wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
392wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
393test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
394compare_images ${POOL} ${image}
395set_image_meta ${CLUSTER2} ${POOL} ${image} \
396 conf_rbd_mirroring_resync_after_disconnect false
397wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
398disconnect_image ${CLUSTER2} ${POOL} ${image}
399test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
400wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
401wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
402
403testlog "TEST: split-brain"
404image=split-brain
405create_image ${CLUSTER2} ${POOL} ${image}
406wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
407demote_image ${CLUSTER2} ${POOL} ${image}
c07f9fc5 408wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
7c673cae
FG
409promote_image ${CLUSTER1} ${POOL} ${image}
410write_image ${CLUSTER1} ${POOL} ${image} 10
411demote_image ${CLUSTER1} ${POOL} ${image}
412promote_image ${CLUSTER2} ${POOL} ${image}
413wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'split-brain'
414request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
415wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
416
31f18b77 417testlog "TEST: no blacklists"
c07f9fc5
FG
418CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
419CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
31f18b77 420
7c673cae 421echo OK