2018-04-24 13:00:18 +00:00
|
|
|
#!/bin/sh -ex
|
2016-03-14 14:47:04 +00:00
|
|
|
#
|
|
|
|
# rbd_mirror.sh - test rbd-mirror daemon
|
|
|
|
#
|
|
|
|
# The scripts starts two ("local" and "remote") clusters using mstart.sh script,
|
|
|
|
# creates a temporary directory, used for cluster configs, daemon logs, admin
|
|
|
|
# socket, temporary files, and launches rbd-mirror daemon.
|
|
|
|
#
|
2016-03-10 14:18:13 +00:00
|
|
|
|
2016-12-15 20:10:28 +00:00
|
|
|
. $(dirname $0)/rbd_mirror_helpers.sh
|
2016-03-10 14:18:13 +00:00
|
|
|
|
2018-04-24 13:00:18 +00:00
|
|
|
setup
|
|
|
|
|
2016-04-28 06:32:33 +00:00
|
|
|
testlog "TEST: add image and test replay"
|
2018-04-18 19:14:24 +00:00
|
|
|
start_mirrors ${CLUSTER1}
|
2016-03-10 14:18:13 +00:00
|
|
|
image=test
|
2016-05-26 16:49:45 +00:00
|
|
|
create_image ${CLUSTER2} ${POOL} ${image}
|
2017-09-28 18:00:29 +00:00
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} "key1" "value1"
|
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} "key2" "value2"
|
2016-05-26 16:49:45 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 100
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-05-18 18:17:13 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'down+unknown'
|
2016-05-18 18:17:13 +00:00
|
|
|
fi
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${image}
|
2017-09-28 18:00:29 +00:00
|
|
|
compare_image_meta ${CLUSTER1} ${POOL} ${image} "key1" "value1"
|
|
|
|
compare_image_meta ${CLUSTER1} ${POOL} ${image} "key2" "value2"
|
2016-03-10 14:18:13 +00:00
|
|
|
|
2016-04-28 06:32:33 +00:00
|
|
|
testlog "TEST: stop mirror, add image, start mirror and test replay"
|
2018-04-18 19:14:24 +00:00
|
|
|
stop_mirrors ${CLUSTER1}
|
2016-03-10 14:18:13 +00:00
|
|
|
image1=test1
|
2016-05-26 16:49:45 +00:00
|
|
|
create_image ${CLUSTER2} ${POOL} ${image1}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image1} 100
|
2018-04-18 19:14:24 +00:00
|
|
|
start_mirrors ${CLUSTER1}
|
2016-05-26 16:49:45 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image1}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying' 'master_position'
|
2016-05-18 18:17:13 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image1} 'down+unknown'
|
2016-05-18 18:17:13 +00:00
|
|
|
fi
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${image1}
|
2016-03-10 14:18:13 +00:00
|
|
|
|
2016-04-28 06:32:33 +00:00
|
|
|
testlog "TEST: test the first image is replaying after restart"
|
2016-05-26 16:49:45 +00:00
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 100
|
2016-11-21 20:31:43 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
2016-05-26 16:49:45 +00:00
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${image}
|
2016-03-28 19:57:58 +00:00
|
|
|
|
2018-04-18 19:14:24 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
|
|
|
testlog "TEST: stop/start/restart mirror via admin socket"
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror stop
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
|
|
|
|
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror start
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
|
|
|
|
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror restart
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
|
|
|
|
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror stop
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
|
|
|
|
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror restart
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
|
|
|
|
|
2018-09-11 17:12:24 +00:00
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}${PEER_CLUSTER_SUFFIX}
|
2018-04-18 19:14:24 +00:00
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
|
|
|
|
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
|
2018-09-11 17:12:24 +00:00
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror start ${POOL} ${CLUSTER2}${PEER_CLUSTER_SUFFIX}
|
2018-04-18 19:14:24 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
|
|
|
|
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror restart ${POOL}/${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
|
2018-09-11 17:12:24 +00:00
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}${PEER_CLUSTER_SUFFIX}
|
2018-04-18 19:14:24 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
|
2018-09-11 17:12:24 +00:00
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}${PEER_CLUSTER_SUFFIX}
|
2018-04-18 19:14:24 +00:00
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
|
|
|
|
|
2018-09-11 17:12:24 +00:00
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}${PEER_CLUSTER_SUFFIX}
|
2018-04-18 19:14:24 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
|
|
|
|
|
|
|
|
flush ${CLUSTER1}
|
|
|
|
all_admin_daemons ${CLUSTER1} rbd mirror status
|
|
|
|
fi
|
2016-04-28 06:32:33 +00:00
|
|
|
|
2017-08-11 12:27:41 +00:00
|
|
|
testlog "TEST: test image rename"
|
|
|
|
new_name="${image}_RENAMED"
|
|
|
|
rename_image ${CLUSTER2} ${POOL} ${image} ${new_name}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${new_name}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${new_name} 'up+replaying'
|
2018-04-18 19:14:24 +00:00
|
|
|
admin_daemons ${CLUSTER1} rbd mirror status ${POOL}/${new_name}
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror restart ${POOL}/${new_name}
|
2017-08-11 12:27:41 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${new_name}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${new_name} 'up+replaying'
|
|
|
|
rename_image ${CLUSTER2} ${POOL} ${new_name} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
|
2018-12-14 16:47:00 +00:00
|
|
|
testlog "TEST: test trash move restore"
|
|
|
|
image_id=$(get_image_id ${CLUSTER2} ${POOL} ${image})
|
|
|
|
trash_move ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
|
|
|
|
trash_restore ${CLUSTER2} ${POOL} ${image_id}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
|
2016-04-28 06:32:33 +00:00
|
|
|
testlog "TEST: failover and failback"
|
2018-04-18 19:14:24 +00:00
|
|
|
start_mirrors ${CLUSTER2}
|
2016-03-28 19:57:58 +00:00
|
|
|
|
2016-08-08 14:39:01 +00:00
|
|
|
# demote and promote same cluster
|
|
|
|
demote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
2017-07-24 15:53:17 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
|
2016-08-08 14:39:01 +00:00
|
|
|
promote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 100
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-08-08 14:39:01 +00:00
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
2017-05-04 21:56:22 +00:00
|
|
|
# failover (unmodified)
|
|
|
|
demote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
2017-07-24 15:53:17 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
|
2017-05-04 21:56:22 +00:00
|
|
|
promote_image ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER2} ${POOL} ${image}
|
|
|
|
|
|
|
|
# failback (unmodified)
|
|
|
|
demote_image ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${image}
|
2017-07-24 15:53:17 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
|
2017-05-04 21:56:22 +00:00
|
|
|
promote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
|
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
2016-03-28 19:57:58 +00:00
|
|
|
# failover
|
2016-05-26 16:49:45 +00:00
|
|
|
demote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
2017-07-24 15:53:17 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
|
2016-05-26 16:49:45 +00:00
|
|
|
promote_image ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER2} ${POOL} ${image}
|
|
|
|
write_image ${CLUSTER1} ${POOL} ${image} 100
|
|
|
|
wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${image}
|
2016-03-28 19:57:58 +00:00
|
|
|
|
|
|
|
# failback
|
2016-05-26 16:49:45 +00:00
|
|
|
demote_image ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${image}
|
2017-07-24 15:53:17 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+unknown'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+unknown'
|
2016-05-26 16:49:45 +00:00
|
|
|
promote_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 100
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped'
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
2016-09-13 16:32:45 +00:00
|
|
|
# force promote
|
|
|
|
force_promote_image=test_force_promote
|
|
|
|
create_image ${CLUSTER2} ${POOL} ${force_promote_image}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${force_promote_image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${force_promote_image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+replaying' 'master_position'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
|
|
|
|
promote_image ${CLUSTER1} ${POOL} ${force_promote_image} '--force'
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${force_promote_image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${force_promote_image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${force_promote_image} 'up+stopped'
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${force_promote_image} 'up+stopped'
|
|
|
|
write_image ${CLUSTER1} ${POOL} ${force_promote_image} 100
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${force_promote_image} 100
|
|
|
|
|
2016-05-26 16:49:45 +00:00
|
|
|
testlog "TEST: cloned images"
|
|
|
|
parent_image=test_parent
|
|
|
|
parent_snap=snap
|
|
|
|
create_image ${CLUSTER2} ${PARENT_POOL} ${parent_image}
|
|
|
|
write_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} 100
|
2016-06-10 01:14:27 +00:00
|
|
|
create_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
|
|
|
|
protect_snapshot ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap}
|
2016-05-26 16:49:45 +00:00
|
|
|
|
|
|
|
clone_image=test_clone
|
|
|
|
clone_image ${CLUSTER2} ${PARENT_POOL} ${parent_image} ${parent_snap} ${POOL} ${clone_image}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${clone_image} 100
|
|
|
|
|
|
|
|
enable_mirror ${CLUSTER2} ${PARENT_POOL} ${parent_image}
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${PARENT_POOL} ${parent_image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${PARENT_POOL} ${parent_image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${PARENT_POOL} ${parent_image} 'up+replaying' 'master_position'
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${PARENT_POOL} ${parent_image}
|
|
|
|
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${clone_image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${clone_image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${clone_image} 'up+replaying' 'master_position'
|
2016-05-26 16:49:45 +00:00
|
|
|
compare_images ${POOL} ${clone_image}
|
2016-03-10 14:18:13 +00:00
|
|
|
|
2017-12-19 15:23:44 +00:00
|
|
|
clone_image ${CLUSTER1} ${PARENT_POOL} ${parent_image} ${parent_snap} ${POOL} ${clone_image}1
|
2016-07-04 10:54:32 +00:00
|
|
|
|
2017-08-17 07:58:18 +00:00
|
|
|
testlog "TEST: data pool"
|
|
|
|
dp_image=test_data_pool
|
|
|
|
create_image ${CLUSTER2} ${POOL} ${dp_image} 128 --data-pool ${PARENT_POOL}
|
|
|
|
data_pool=$(get_image_data_pool ${CLUSTER2} ${POOL} ${dp_image})
|
|
|
|
test "${data_pool}" = "${PARENT_POOL}"
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${dp_image}
|
|
|
|
data_pool=$(get_image_data_pool ${CLUSTER1} ${POOL} ${dp_image})
|
|
|
|
test "${data_pool}" = "${PARENT_POOL}"
|
|
|
|
create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap1'
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${dp_image} 100
|
|
|
|
create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap2'
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${dp_image} 100
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${dp_image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${dp_image} 'up+replaying' 'master_position'
|
|
|
|
compare_images ${POOL} ${dp_image}@snap1
|
|
|
|
compare_images ${POOL} ${dp_image}@snap2
|
|
|
|
compare_images ${POOL} ${dp_image}
|
|
|
|
|
2016-05-13 15:47:25 +00:00
|
|
|
testlog "TEST: disable mirroring / delete non-primary image"
|
2016-06-10 01:14:27 +00:00
|
|
|
image2=test2
|
|
|
|
image3=test3
|
|
|
|
image4=test4
|
|
|
|
image5=test5
|
|
|
|
for i in ${image2} ${image3} ${image4} ${image5}; do
|
|
|
|
create_image ${CLUSTER2} ${POOL} ${i}
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${i} 100
|
|
|
|
create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
|
|
|
|
create_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
|
|
|
|
if [ "${i}" = "${image4}" ] || [ "${i}" = "${image5}" ]; then
|
|
|
|
protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
|
|
|
|
protect_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
|
|
|
|
fi
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${i} 100
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
|
|
|
|
wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
|
|
|
|
done
|
|
|
|
|
2016-05-26 16:49:45 +00:00
|
|
|
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
|
2016-06-10 01:14:27 +00:00
|
|
|
for i in ${image2} ${image4}; do
|
|
|
|
disable_mirror ${CLUSTER2} ${POOL} ${i}
|
|
|
|
done
|
|
|
|
|
|
|
|
unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap1'
|
|
|
|
unprotect_snapshot ${CLUSTER2} ${POOL} ${image5} 'snap2'
|
|
|
|
for i in ${image3} ${image5}; do
|
|
|
|
remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap1'
|
|
|
|
remove_snapshot ${CLUSTER2} ${POOL} ${i} 'snap2'
|
2016-09-14 12:49:39 +00:00
|
|
|
remove_image_retry ${CLUSTER2} ${POOL} ${i}
|
2016-06-10 01:14:27 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
for i in ${image2} ${image3} ${image4} ${image5}; do
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'deleted'
|
|
|
|
done
|
|
|
|
|
2016-05-26 16:49:45 +00:00
|
|
|
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
|
2016-06-10 01:14:27 +00:00
|
|
|
for i in ${image2} ${image4}; do
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${i} 'present'
|
|
|
|
wait_for_snap_present ${CLUSTER1} ${POOL} ${i} 'snap2'
|
2016-06-13 04:19:37 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${i}
|
2016-06-10 01:14:27 +00:00
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${i}
|
|
|
|
compare_images ${POOL} ${i}
|
|
|
|
done
|
2016-05-13 15:47:25 +00:00
|
|
|
|
2016-07-08 02:16:51 +00:00
|
|
|
testlog "TEST: snapshot rename"
|
|
|
|
snap_name='snap_rename'
|
|
|
|
create_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_0"
|
|
|
|
for i in `seq 1 20`; do
|
|
|
|
rename_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_$(expr ${i} - 1)" "${snap_name}_${i}"
|
|
|
|
done
|
|
|
|
wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}"
|
|
|
|
|
2016-05-13 15:47:25 +00:00
|
|
|
testlog "TEST: disable mirror while daemon is stopped"
|
2018-04-18 19:14:24 +00:00
|
|
|
stop_mirrors ${CLUSTER1}
|
|
|
|
stop_mirrors ${CLUSTER2}
|
2016-05-26 16:49:45 +00:00
|
|
|
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
|
|
|
|
disable_mirror ${CLUSTER2} ${POOL} ${image}
|
2016-11-21 20:31:43 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
|
|
|
test_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
|
|
|
fi
|
2018-04-18 19:14:24 +00:00
|
|
|
start_mirrors ${CLUSTER1}
|
2016-05-26 16:49:45 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
|
|
|
|
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
2016-05-13 15:47:25 +00:00
|
|
|
|
2016-05-19 11:06:08 +00:00
|
|
|
testlog "TEST: simple image resync"
|
2016-11-27 14:27:51 +00:00
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
2017-07-19 20:18:23 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
2016-05-19 11:06:08 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-05-19 11:06:08 +00:00
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
|
|
|
testlog "TEST: image resync while replayer is stopped"
|
2018-05-14 12:35:57 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror stop ${POOL}/${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
fi
|
2016-05-19 11:06:08 +00:00
|
|
|
|
|
|
|
testlog "TEST: request image resync while daemon is offline"
|
2018-04-18 19:14:24 +00:00
|
|
|
stop_mirrors ${CLUSTER1}
|
2016-11-27 14:27:51 +00:00
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
2018-04-18 19:14:24 +00:00
|
|
|
start_mirrors ${CLUSTER1}
|
2016-11-21 20:31:43 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
2017-07-19 20:18:23 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
2016-05-19 11:06:08 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-05-19 11:06:08 +00:00
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
2016-07-27 10:45:32 +00:00
|
|
|
testlog "TEST: client disconnect"
|
|
|
|
image=laggy
|
|
|
|
create_image ${CLUSTER2} ${POOL} ${image} 128 --journal-object-size 64K
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 10
|
|
|
|
|
|
|
|
testlog " - replay stopped after disconnect"
|
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
disconnect_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
|
2016-07-27 10:45:32 +00:00
|
|
|
|
|
|
|
testlog " - replay started after resync requested"
|
2016-11-27 14:27:51 +00:00
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
2017-07-19 20:18:23 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
2016-07-27 10:45:32 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
|
|
|
testlog " - disconnected after max_concurrent_object_sets reached"
|
2018-05-14 12:35:57 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror stop ${POOL}/${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} \
|
|
|
|
conf_rbd_journal_max_concurrent_object_sets 1
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 20 16384
|
|
|
|
write_image ${CLUSTER2} ${POOL} ${image} 20 16384
|
|
|
|
test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} \
|
|
|
|
conf_rbd_journal_max_concurrent_object_sets 0
|
|
|
|
|
|
|
|
testlog " - replay is still stopped (disconnected) after restart"
|
|
|
|
admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
|
|
|
|
fi
|
2016-07-27 10:45:32 +00:00
|
|
|
|
|
|
|
testlog " - replay started after resync requested"
|
2016-11-27 14:27:51 +00:00
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
2017-07-19 20:18:23 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
2016-07-27 10:45:32 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
compare_images ${POOL} ${image}
|
|
|
|
|
2016-08-10 10:46:46 +00:00
|
|
|
testlog " - rbd_mirroring_resync_after_disconnect config option"
|
2016-10-03 14:02:59 +00:00
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} \
|
2016-08-10 10:46:46 +00:00
|
|
|
conf_rbd_mirroring_resync_after_disconnect true
|
2016-10-03 14:02:59 +00:00
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2018-04-29 17:07:38 +00:00
|
|
|
image_id=$(get_image_id ${CLUSTER1} ${POOL} ${image})
|
2016-08-10 10:46:46 +00:00
|
|
|
disconnect_image ${CLUSTER2} ${POOL} ${image}
|
2017-07-19 20:18:23 +00:00
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
|
|
|
|
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
|
2016-08-10 10:46:46 +00:00
|
|
|
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
compare_images ${POOL} ${image}
|
2016-10-03 14:02:59 +00:00
|
|
|
set_image_meta ${CLUSTER2} ${POOL} ${image} \
|
2016-08-10 10:46:46 +00:00
|
|
|
conf_rbd_mirroring_resync_after_disconnect false
|
2016-10-03 14:02:59 +00:00
|
|
|
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image}
|
2016-08-10 10:46:46 +00:00
|
|
|
disconnect_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
2016-09-13 16:32:45 +00:00
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
|
2016-08-10 10:46:46 +00:00
|
|
|
|
2016-11-29 09:40:14 +00:00
|
|
|
testlog "TEST: split-brain"
|
|
|
|
image=split-brain
|
|
|
|
create_image ${CLUSTER2} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2017-12-19 21:29:18 +00:00
|
|
|
promote_image ${CLUSTER1} ${POOL} ${image} --force
|
|
|
|
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
|
2016-11-29 09:40:14 +00:00
|
|
|
write_image ${CLUSTER1} ${POOL} ${image} 10
|
|
|
|
demote_image ${CLUSTER1} ${POOL} ${image}
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'split-brain'
|
2016-11-29 09:44:05 +00:00
|
|
|
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
|
|
|
|
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
|
2016-11-29 09:40:14 +00:00
|
|
|
|
2018-04-18 19:14:24 +00:00
|
|
|
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
|
|
|
|
# teuthology will trash the daemon
|
|
|
|
testlog "TEST: no blacklists"
|
|
|
|
CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
|
|
|
|
CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
|
|
|
|
fi
|