mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
rbd-mirror: test: added image-deleter test case when mirroring is disabled
Signed-off-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
parent
9cb0b180bc
commit
d85e312ead
@ -462,6 +462,58 @@ promote_image()
|
||||
rbd --cluster=${cluster} mirror image promote ${POOL}/${image}
|
||||
}
|
||||
|
||||
set_pool_mirror_mode()
|
||||
{
|
||||
local cluster=$1
|
||||
local mode=$2
|
||||
|
||||
rbd --cluster=${cluster} -p ${POOL} mirror pool enable ${mode}
|
||||
}
|
||||
|
||||
disable_mirror()
|
||||
{
|
||||
local cluster=$1
|
||||
local image=$2
|
||||
|
||||
rbd --cluster=${cluster} mirror image disable ${POOL}/${image}
|
||||
}
|
||||
|
||||
enable_mirror()
|
||||
{
|
||||
local cluster=$1
|
||||
local image=$2
|
||||
|
||||
rbd --cluster=${cluster} mirror image enable ${POOL}/${image}
|
||||
}
|
||||
|
||||
test_image_present()
|
||||
{
|
||||
local cluster=$1
|
||||
local image=$2
|
||||
local test_state=$3
|
||||
local current_state=deleted
|
||||
|
||||
rbd --cluster=${cluster} -p ${POOL} ls | grep "^${image}$" &&
|
||||
current_state=present
|
||||
|
||||
test "${test_state}" = "${current_state}"
|
||||
}
|
||||
|
||||
wait_for_image_present()
|
||||
{
|
||||
local cluster=$1
|
||||
local image=$2
|
||||
local state=$3
|
||||
local s
|
||||
|
||||
# TODO: add a way to force rbd-mirror to update replayers
|
||||
for s in 1 2 4 8 8 8 8 8 8 8 8 16 16; do
|
||||
sleep ${s}
|
||||
test_image_present "${cluster}" "${image}" "${state}" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
@ -588,4 +640,25 @@ test_status_in_pool_dir ${CLUSTER1} ${image} 'up+replaying' 'master_position'
|
||||
test_status_in_pool_dir ${CLUSTER2} ${image} 'up+stopped'
|
||||
compare_images ${image}
|
||||
|
||||
testlog "TEST: disable mirroring / delete non-primary image"
|
||||
test_image_present ${CLUSTER1} ${image} 'present'
|
||||
set_pool_mirror_mode ${CLUSTER2} 'image'
|
||||
disable_mirror ${CLUSTER2} ${image}
|
||||
wait_for_image_present ${CLUSTER1} ${image} 'deleted'
|
||||
set_pool_mirror_mode ${CLUSTER2} 'pool'
|
||||
wait_for_image_present ${CLUSTER1} ${image} 'present'
|
||||
wait_for_image_replay_started ${CLUSTER1} ${image}
|
||||
|
||||
testlog "TEST: disable mirror while daemon is stopped"
|
||||
stop_mirror ${CLUSTER1}
|
||||
stop_mirror ${CLUSTER2}
|
||||
set_pool_mirror_mode ${CLUSTER2} 'image'
|
||||
disable_mirror ${CLUSTER2} ${image}
|
||||
test_image_present ${CLUSTER1} ${image} 'present'
|
||||
start_mirror ${CLUSTER1}
|
||||
wait_for_image_present ${CLUSTER1} ${image} 'deleted'
|
||||
set_pool_mirror_mode ${CLUSTER2} 'pool'
|
||||
wait_for_image_present ${CLUSTER1} ${image} 'present'
|
||||
wait_for_image_replay_started ${CLUSTER1} ${image}
|
||||
|
||||
echo OK
|
||||
|
Loading…
Reference in New Issue
Block a user