mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
qa/workunits/ceph-helpers: start and stop mgr daemons
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
6c21532bf7
commit
83b19dd1f1
@ -174,6 +174,7 @@ function test_teardown() {
|
||||
# @param delays sequence of sleep times before failure
|
||||
#
|
||||
function kill_daemon() {
|
||||
set -x
|
||||
local pid=$(cat $1)
|
||||
local send_signal=$2
|
||||
local delays=${3:-0.1 0.2 1 1 1 2 3 5 5 5 10 10 20 60 60 60 120}
|
||||
@ -195,6 +196,7 @@ function test_kill_daemon() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
|
||||
name_prefix=osd
|
||||
@ -214,6 +216,14 @@ function test_kill_daemon() {
|
||||
|
||||
ceph osd dump | grep "osd.0 down" || return 1
|
||||
|
||||
name_prefix=mgr
|
||||
for pidfile in $(find $dir 2>/dev/null | grep $name_prefix'[^/]*\.pid') ; do
|
||||
#
|
||||
# kill the mgr
|
||||
#
|
||||
kill_daemon $pidfile TERM || return 1
|
||||
done
|
||||
|
||||
name_prefix=mon
|
||||
for pidfile in $(find $dir 2>/dev/null | grep $name_prefix'[^/]*\.pid') ; do
|
||||
#
|
||||
@ -279,6 +289,7 @@ function test_kill_daemons() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
#
|
||||
# sending signal 0 won't kill the daemon
|
||||
@ -293,6 +304,10 @@ function test_kill_daemons() {
|
||||
kill_daemons $dir TERM osd || return 1
|
||||
ceph osd dump | grep "osd.0 down" || return 1
|
||||
#
|
||||
# kill the mgr
|
||||
#
|
||||
kill_daemons $dir TERM mgr || return 1
|
||||
#
|
||||
# kill the mon and verify it cannot be reached
|
||||
#
|
||||
kill_daemons $dir TERM || return 1
|
||||
@ -428,6 +443,32 @@ function test_run_mon() {
|
||||
|
||||
#######################################################################
|
||||
|
||||
function run_mgr() {
|
||||
local dir=$1
|
||||
shift
|
||||
local id=$1
|
||||
shift
|
||||
local data=$dir/$id
|
||||
|
||||
ceph-mgr \
|
||||
--id $id \
|
||||
--erasure-code-dir=$CEPH_LIB \
|
||||
--plugin-dir=$CEPH_LIB \
|
||||
--debug-mgr 20 \
|
||||
--debug-objecter 20 \
|
||||
--debug-ms 20 \
|
||||
--debug-paxos 20 \
|
||||
--chdir= \
|
||||
--mgr-data=$data \
|
||||
--log-file=$dir/\$name.log \
|
||||
--admin-socket=$dir/\$cluster-\$name.asok \
|
||||
--run-dir=$dir \
|
||||
--pid-file=$dir/\$name.pid \
|
||||
"$@" || return 1
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
|
||||
##
|
||||
# Create (prepare) and run (activate) an osd by the name osd.**id**
|
||||
# with data in **dir**/**id**. The logs can be found in
|
||||
@ -484,6 +525,7 @@ function test_run_osd() {
|
||||
setup $dir || return 1
|
||||
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
|
||||
run_osd $dir 0 || return 1
|
||||
local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.0.asok \
|
||||
@ -534,6 +576,7 @@ function test_destroy_osd() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
destroy_osd $dir 0 || return 1
|
||||
! ceph osd dump | grep "osd.$id " || return 1
|
||||
@ -625,6 +668,7 @@ function test_activate_osd() {
|
||||
setup $dir || return 1
|
||||
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
|
||||
run_osd $dir 0 || return 1
|
||||
local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.0.asok \
|
||||
@ -672,6 +716,7 @@ function test_wait_for_osd() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_osd up 0 || return 1
|
||||
kill_daemons $dir TERM osd || return 1
|
||||
@ -706,6 +751,7 @@ function test_get_osds() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=2 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
wait_for_clean || return 1
|
||||
@ -773,6 +819,7 @@ function test_get_pg() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
get_pg rbd GROUP | grep --quiet '^[0-9]\.[0-9a-f][0-9a-f]*$' || return 1
|
||||
@ -809,6 +856,7 @@ function test_get_config() {
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
test $(get_config mon a osd_pool_default_size) = 1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 --osd_max_scrubs=3 || return 1
|
||||
test $(get_config osd 0 osd_max_scrubs) = 3 || return 1
|
||||
teardown $dir || return 1
|
||||
@ -876,6 +924,7 @@ function test_get_primary() {
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
local osd=0
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir $osd || return 1
|
||||
wait_for_clean || return 1
|
||||
test $(get_primary rbd GROUP) = $osd || return 1
|
||||
@ -908,6 +957,7 @@ function test_get_not_primary() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=2 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
wait_for_clean || return 1
|
||||
@ -958,6 +1008,7 @@ function test_objectstore_tool() {
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
local osd=0
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir $osd || return 1
|
||||
wait_for_clean || return 1
|
||||
rados --pool rbd put GROUP /etc/group || return 1
|
||||
@ -991,6 +1042,7 @@ function test_get_is_making_recovery_progress() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
! get_is_making_recovery_progress || return 1
|
||||
teardown $dir || return 1
|
||||
}
|
||||
@ -1024,6 +1076,7 @@ function test_get_num_active_clean() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
local num_active_clean=$(get_num_active_clean)
|
||||
@ -1050,6 +1103,7 @@ function test_get_num_pgs() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
local num_pgs=$(get_num_pgs)
|
||||
@ -1080,6 +1134,7 @@ function test_get_last_scrub_stamp() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
stamp=$(get_last_scrub_stamp 1.0)
|
||||
@ -1106,6 +1161,7 @@ function test_is_clean() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
! is_clean || return 1
|
||||
wait_for_clean || return 1
|
||||
@ -1202,6 +1258,7 @@ function test_wait_for_clean() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
! TIMEOUT=1 wait_for_clean || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
@ -1230,6 +1287,7 @@ function test_repair() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
repair 1.0 || return 1
|
||||
@ -1268,6 +1326,7 @@ function test_pg_scrub() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
pg_scrub 1.0 || return 1
|
||||
@ -1358,6 +1417,7 @@ function test_wait_for_scrub() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
wait_for_clean || return 1
|
||||
local pgid=1.0
|
||||
@ -1405,6 +1465,7 @@ function test_erasure_code_plugin_exists() {
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
erasure_code_plugin_exists jerasure || return 1
|
||||
! erasure_code_plugin_exists FAKE || return 1
|
||||
teardown $dir || return 1
|
||||
|
Loading…
Reference in New Issue
Block a user