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