mirror of
https://github.com/ceph/ceph
synced 2025-03-31 07:53:23 +00:00
qa/workunits/rbd: small fixup and improvements for rbd-mirror tests
- log to stderr; - log status if a `wait_for` function failed; - don't needlessly sleep in `wait_for` functions after the last unsuccessful iteration; - make `wait_for_pool_images` work for image removal case; - fix `wait_for_pool_images` reset timeout (last_count set). Signed-off-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
parent
98602ae6c6
commit
fdb971a266
@ -120,7 +120,7 @@ daemon_pid_file()
|
||||
|
||||
testlog()
|
||||
{
|
||||
echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log"
|
||||
echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log" >&2
|
||||
}
|
||||
|
||||
expect_failure()
|
||||
@ -481,7 +481,7 @@ test_status_in_pool_dir()
|
||||
|
||||
local status_log=${TEMPDIR}/${cluster}-${image}.mirror_status
|
||||
rbd --cluster ${cluster} -p ${pool} mirror image status ${image} |
|
||||
tee ${status_log}
|
||||
tee ${status_log} >&2
|
||||
grep "state: .*${state_pattern}" ${status_log}
|
||||
grep "description: .*${description_pattern}" ${status_log}
|
||||
}
|
||||
|
@ -56,17 +56,18 @@ wait_for_pool_images()
|
||||
|
||||
while true; do
|
||||
for s in `seq 1 40`; do
|
||||
test $s -ne 1 && sleep 30
|
||||
count=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'images: ' | cut -d' ' -f 2)
|
||||
test "${count}" = "${image_count}" && return 0
|
||||
|
||||
# reset timeout if making forward progress
|
||||
test $count -gt $last_count && break
|
||||
sleep 30
|
||||
test $count -ne $last_count && break
|
||||
done
|
||||
|
||||
test $count -eq $last_count && return 1
|
||||
$last_count=$count
|
||||
test $count -eq $last_count && break
|
||||
last_count=$count
|
||||
done
|
||||
rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -78,11 +79,12 @@ wait_for_pool_healthy()
|
||||
local state
|
||||
|
||||
for s in `seq 1 40`; do
|
||||
test $s -ne 1 && sleep 30
|
||||
state=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'health:' | cut -d' ' -f 2)
|
||||
test "${state}" = "ERROR" && return 1
|
||||
test "${state}" = "ERROR" && break
|
||||
test "${state}" = "OK" && return 0
|
||||
sleep 30
|
||||
done
|
||||
rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user