From 5a85a6a035bad2f86f1390aec02985bf65dca364 Mon Sep 17 00:00:00 2001 From: Sridhar Seshasayee Date: Mon, 14 Jun 2021 13:36:23 +0530 Subject: [PATCH] qa/standalone: Modify ceph-helpers.sh tests for mclock scheduler. List of changes: 1. Remove the enforcement to use osd_op_queue=wpq when an osd is brought up in the following functions: - run_osd() - run_osd_filestore() and - activate_osd() 2. New functions: - get_op_scheduler() - Get the current osd_op_queue for an osd. 3. Modified test cases: - test_run_osd() - Add check for osd_max_backfill count. The mclock scheduler overrides the count to 1000. 4. New test cases: - test_activate_osd_after_mark_down() - test_get_op_scheduler() Signed-off-by: Sridhar Seshasayee --- qa/standalone/ceph-helpers.sh | 79 ++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/qa/standalone/ceph-helpers.sh b/qa/standalone/ceph-helpers.sh index 71201b3ee98..adcb8217256 100755 --- a/qa/standalone/ceph-helpers.sh +++ b/qa/standalone/ceph-helpers.sh @@ -642,7 +642,6 @@ function run_osd() { ceph_args+=" --osd-scrub-load-threshold=2000" ceph_args+=" --osd-data=$osd_data" ceph_args+=" --osd-journal=${osd_data}/journal" - ceph_args+=" --osd-op-queue=wpq" ceph_args+=" --chdir=" ceph_args+=$EXTRA_OPTS ceph_args+=" --run-dir=$dir" @@ -698,7 +697,6 @@ function run_osd_filestore() { ceph_args+=" --osd-scrub-load-threshold=2000" ceph_args+=" --osd-data=$osd_data" ceph_args+=" --osd-journal=${osd_data}/journal" - ceph_args+=" --osd-op-queue=wpq" ceph_args+=" --chdir=" ceph_args+=$EXTRA_OPTS ceph_args+=" --run-dir=$dir" @@ -756,14 +754,24 @@ function test_run_osd() { echo "$backfills" | grep --quiet 'osd_max_backfills' || return 1 run_osd $dir 1 --osd-max-backfills 20 || return 1 + local scheduler=$(get_op_scheduler 1) local backfills=$(CEPH_ARGS='' ceph --format=json daemon $(get_asok_path osd.1) \ config get osd_max_backfills) - test "$backfills" = '{"osd_max_backfills":"20"}' || return 1 + if [ "$scheduler" = "mclock_scheduler" ]; then + test "$backfills" = '{"osd_max_backfills":"1000"}' || return 1 + else + test "$backfills" = '{"osd_max_backfills":"20"}' || return 1 + fi CEPH_ARGS="$CEPH_ARGS --osd-max-backfills 30" run_osd $dir 2 || return 1 + local scheduler=$(get_op_scheduler 2) local backfills=$(CEPH_ARGS='' ceph --format=json daemon $(get_asok_path osd.2) \ config get osd_max_backfills) - test "$backfills" = '{"osd_max_backfills":"30"}' || return 1 + if [ "$scheduler" = "mclock_scheduler" ]; then + test "$backfills" = '{"osd_max_backfills":"1000"}' || return 1 + else + test "$backfills" = '{"osd_max_backfills":"30"}' || return 1 + fi teardown $dir || return 1 } @@ -856,7 +864,6 @@ function activate_osd() { ceph_args+=" --osd-scrub-load-threshold=2000" ceph_args+=" --osd-data=$osd_data" ceph_args+=" --osd-journal=${osd_data}/journal" - ceph_args+=" --osd-op-queue=wpq" ceph_args+=" --chdir=" ceph_args+=$EXTRA_OPTS ceph_args+=" --run-dir=$dir" @@ -906,6 +913,35 @@ function test_activate_osd() { teardown $dir || return 1 } +function test_activate_osd_after_mark_down() { + local dir=$1 + + 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 $(get_asok_path osd.0) \ + config get osd_max_backfills) + echo "$backfills" | grep --quiet 'osd_max_backfills' || return 1 + + kill_daemons $dir TERM osd || return 1 + ceph osd down 0 || return 1 + wait_for_osd down 0 || return 1 + + activate_osd $dir 0 --osd-max-backfills 20 || return 1 + local scheduler=$(get_op_scheduler 0) + local backfills=$(CEPH_ARGS='' ceph --format=json daemon $(get_asok_path osd.0) \ + config get osd_max_backfills) + if [ "$scheduler" = "mclock_scheduler" ]; then + test "$backfills" = '{"osd_max_backfills":"1000"}' || return 1 + else + test "$backfills" = '{"osd_max_backfills":"20"}' || return 1 + fi + + teardown $dir || return 1 +} ####################################################################### ## @@ -2113,6 +2149,39 @@ function test_flush_pg_stats() teardown $dir } +######################################################################## +## +# Get the current op scheduler enabled on an osd by reading the +# osd_op_queue config option +# +# Example: +# get_op_scheduler $osdid +# +# @param id the id of the OSD +# @return the name of the op scheduler enabled for the OSD +# +function get_op_scheduler() { + local id=$1 + + get_config osd $id osd_op_queue +} + +function test_get_op_scheduler() { + local dir=$1 + + setup $dir || return 1 + + run_mon $dir a || return 1 + run_mgr $dir x || return 1 + + run_osd $dir 0 --osd_op_queue=wpq || return 1 + test $(get_op_scheduler 0) = "wpq" || return 1 + + run_osd $dir 1 --osd_op_queue=mclock_scheduler || return 1 + test $(get_op_scheduler 1) = "mclock_scheduler" || return 1 + teardown $dir || return 1 +} + ####################################################################### ## -- 2.39.5