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