From 7a6ca17f185283d135d9e7ef9789491318b9cfde Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 18 Oct 2014 13:15:41 -0700 Subject: [PATCH] tests: use different ports for each mon Run the mon on each test on a different port so they can run in parallel. http://tracker.ceph.com/issues/9815 Fixes: #9815 Signed-off-by: Loic Dachary --- src/test/erasure-code/test-erasure-code.sh | 5 ++-- src/test/mon/misc.sh | 6 +++-- src/test/mon/mkfs.sh | 13 +++++------ src/test/mon/mon-handle-forward.sh | 3 ++- src/test/mon/osd-crush.sh | 6 +++-- src/test/mon/osd-erasure-code-profile.sh | 12 ++++++---- src/test/mon/osd-pool-create.sh | 27 +++++++++++----------- src/test/osd/osd-bench.sh | 8 ++++--- src/test/osd/osd-config.sh | 10 ++++---- src/test/osd/osd-scrub-repair.sh | 5 ++-- 10 files changed, 54 insertions(+), 41 deletions(-) diff --git a/src/test/erasure-code/test-erasure-code.sh b/src/test/erasure-code/test-erasure-code.sh index b8a10212192c8..41bee7b49f90d 100755 --- a/src/test/erasure-code/test-erasure-code.sh +++ b/src/test/erasure-code/test-erasure-code.sh @@ -22,12 +22,13 @@ source test/osd/osd-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7101" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " setup $dir || return 1 - run_mon $dir a --public-addr 127.0.0.1 || return 1 + run_mon $dir a --public-addr $CEPH_MON || return 1 # check that erasure code plugins are preloaded CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1 grep 'load: jerasure.*lrc' $dir/a/log || return 1 diff --git a/src/test/mon/misc.sh b/src/test/mon/misc.sh index 1c8caa0a7a41f..8201be73eaf97 100755 --- a/src/test/mon/misc.sh +++ b/src/test/mon/misc.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -19,12 +20,13 @@ source test/mon/mon-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7102" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " setup $dir || return 1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} for TEST_function in $FUNCTIONS ; do if ! $TEST_function $dir ; then diff --git a/src/test/mon/mkfs.sh b/src/test/mon/mkfs.sh index fbf560be26f2b..13b9a1bec9cb0 100755 --- a/src/test/mon/mkfs.sh +++ b/src/test/mon/mkfs.sh @@ -23,8 +23,7 @@ export CEPH_CONF=/dev/null unset CEPH_ARGS MON_ID=a MON_DIR=$DIR/$MON_ID -PORT=7451 -MONA=127.0.0.1:$PORT +CEPH_MON=127.0.0.1:7110 TIMEOUT=360 function setup() { @@ -47,7 +46,7 @@ function mon_mkfs() { --mkfs \ --mon-data=$MON_DIR \ --mon-initial-members=$MON_ID \ - --mon-host=$MONA \ + --mon-host=$CEPH_MON \ "$@" } @@ -63,7 +62,7 @@ function mon_run() { --mon-cluster-log-file=$MON_DIR/log \ --run-dir=$MON_DIR \ --pid-file=$MON_DIR/pidfile \ - --public-addr $MONA \ + --public-addr $CEPH_MON \ "$@" } @@ -94,7 +93,7 @@ function auth_none() { mon_run --auth-supported=none - timeout $TIMEOUT ./ceph --mon-host $MONA mon stat || return 1 + timeout $TIMEOUT ./ceph --mon-host $CEPH_MON mon stat || return 1 } function auth_cephx_keyring() { @@ -113,7 +112,7 @@ EOF timeout $TIMEOUT ./ceph \ --name mon. \ --keyring $MON_DIR/keyring \ - --mon-host $MONA mon stat || return 1 + --mon-host $CEPH_MON mon stat || return 1 } function auth_cephx_key() { @@ -140,7 +139,7 @@ function auth_cephx_key() { timeout $TIMEOUT ./ceph \ --name mon. \ --keyring $MON_DIR/keyring \ - --mon-host $MONA mon stat || return 1 + --mon-host $CEPH_MON mon stat || return 1 } function makedir() { diff --git a/src/test/mon/mon-handle-forward.sh b/src/test/mon/mon-handle-forward.sh index 6f3ea676f9057..bdbe72e4b4719 100755 --- a/src/test/mon/mon-handle-forward.sh +++ b/src/test/mon/mon-handle-forward.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2013 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -19,7 +20,7 @@ source test/mon/mon-test-helpers.sh function run() { local dir=$1 - PORT=7451 + PORT=7300 # CEPH_MON= MONA=127.0.0.1:$PORT MONB=127.0.0.1:$(($PORT + 1)) ( diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index e7a98e8166b82..4b1c601d41aac 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -19,14 +20,15 @@ source test/mon/mon-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7104" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} for TEST_function in $FUNCTIONS ; do setup $dir || return 1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON if ! $TEST_function $dir ; then cat $dir/a/log return 1 diff --git a/src/test/mon/osd-erasure-code-profile.sh b/src/test/mon/osd-erasure-code-profile.sh index fd0cf73692e30..5b9fc33dc4eac 100755 --- a/src/test/mon/osd-erasure-code-profile.sh +++ b/src/test/mon/osd-erasure-code-profile.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -19,12 +20,13 @@ source test/mon/mon-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7108" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " local id=a - call_TEST_functions $dir $id --public-addr 127.0.0.1 || return 1 + call_TEST_functions $dir $id --public-addr $CEPH_MON || return 1 } function SHARE_MON_TEST_set() { @@ -113,7 +115,7 @@ function TEST_format_invalid() { local profile=profile # osd_pool_default_erasure-code-profile is # valid JSON but not of the expected type - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_erasure-code-profile 1 ! ./ceph osd erasure-code-profile set $profile > $dir/out 2>&1 || return 1 cat $dir/out @@ -125,7 +127,7 @@ function TEST_format_json() { # osd_pool_default_erasure-code-profile is JSON expected='"plugin":"example"' - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_erasure-code-profile "{$expected}" ./ceph --format json osd erasure-code-profile get default | \ grep "$expected" || return 1 @@ -136,7 +138,7 @@ function TEST_format_plain() { # osd_pool_default_erasure-code-profile is plain text expected='"plugin":"example"' - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_erasure-code-profile "plugin=example" ./ceph --format json osd erasure-code-profile get default | \ grep "$expected" || return 1 diff --git a/src/test/mon/osd-pool-create.sh b/src/test/mon/osd-pool-create.sh index cbcd65c7b8175..1cae8a644a1c9 100755 --- a/src/test/mon/osd-pool-create.sh +++ b/src/test/mon/osd-pool-create.sh @@ -20,9 +20,10 @@ source test/mon/mon-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7105" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} for TEST_function in $FUNCTIONS ; do @@ -36,7 +37,7 @@ function TEST_default_deprectated_0() { local dir=$1 # explicitly set the default crush rule expected=66 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_crush_replicated_ruleset $expected ./ceph --format json osd dump | grep '"crush_ruleset":'$expected CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1 @@ -47,7 +48,7 @@ function TEST_default_deprectated_1() { local dir=$1 # explicitly set the default crush rule using deprecated option expected=55 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_crush_rule $expected ./ceph --format json osd dump | grep '"crush_ruleset":'$expected CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1 @@ -58,7 +59,7 @@ function TEST_default_deprectated_2() { local dir=$1 expected=77 unexpected=33 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_default_crush_rule $expected \ --osd_pool_default_crush_replicated_ruleset $unexpected ./ceph --format json osd dump | grep '"crush_ruleset":'$expected @@ -70,7 +71,7 @@ function TEST_default_deprectated_2() { # Before http://tracker.ceph.com/issues/8307 the invalid profile was created function TEST_erasure_invalid_profile() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON local poolname=pool_erasure local notaprofile=not-a-valid-erasure-code-profile ! ./ceph osd pool create $poolname 12 12 erasure $notaprofile || return 1 @@ -79,7 +80,7 @@ function TEST_erasure_invalid_profile() { function TEST_erasure_crush_rule() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON # # choose the crush ruleset used with an erasure coded pool # @@ -109,7 +110,7 @@ function TEST_erasure_crush_rule() { function TEST_erasure_code_profile_default() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON ./ceph osd erasure-code-profile rm default || return 1 ! ./ceph osd erasure-code-profile ls | grep default || return 1 ./ceph osd pool create $poolname 12 12 erasure default @@ -119,7 +120,7 @@ function TEST_erasure_code_profile_default() { function TEST_erasure_crush_stripe_width() { local dir=$1 # the default stripe width is used to initialize the pool - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON stripe_width=$(./ceph-conf --show-config-value osd_pool_erasure_code_stripe_width) ./ceph osd pool create pool_erasure 12 12 erasure ./ceph --format json osd dump | tee $dir/osd.json @@ -138,7 +139,7 @@ function TEST_erasure_crush_stripe_width_padded() { expected_chunk_size=2048 actual_stripe_width=$(($expected_chunk_size * $k)) desired_stripe_width=$(($actual_stripe_width - 1)) - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ --osd_pool_erasure_code_stripe_width $desired_stripe_width \ --osd_pool_default_erasure_code_profile "$profile" ./ceph osd pool create pool_erasure 12 12 erasure @@ -148,7 +149,7 @@ function TEST_erasure_crush_stripe_width_padded() { function TEST_erasure_code_pool() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON ./ceph --format json osd dump > $dir/osd.json local expected='"erasure_code_profile":"default"' ! grep "$expected" $dir/osd.json || return 1 @@ -164,7 +165,7 @@ function TEST_erasure_code_pool() { function TEST_replicated_pool_with_ruleset() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON local ruleset=ruleset0 local root=host1 ./ceph osd crush add-bucket $root host @@ -184,7 +185,7 @@ function TEST_replicated_pool_with_ruleset() { function TEST_erasure_code_pool_lrc() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON ./ceph osd erasure-code-profile set LRCprofile \ plugin=lrc \ @@ -203,7 +204,7 @@ function TEST_erasure_code_pool_lrc() { function TEST_replicated_pool() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 + run_mon $dir a --public-addr $CEPH_MON ./ceph osd pool create replicated 12 12 replicated replicated_ruleset 2>&1 | \ grep "pool 'replicated' created" || return 1 ./ceph osd pool create replicated 12 12 replicated replicated_ruleset 2>&1 | \ diff --git a/src/test/osd/osd-bench.sh b/src/test/osd/osd-bench.sh index 6feb8418e9e9c..b4ae3fd4ff154 100755 --- a/src/test/osd/osd-bench.sh +++ b/src/test/osd/osd-bench.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -21,18 +22,19 @@ source test/osd/osd-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7106" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " local id=a - call_TEST_functions $dir $id --public-addr 127.0.0.1 || return 1 + call_TEST_functions $dir $id || return 1 } function TEST_bench() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr $CEPH_MON \ || return 1 run_osd $dir 0 || return 1 diff --git a/src/test/osd/osd-config.sh b/src/test/osd/osd-config.sh index 042a2280141b2..aceda0cf121bf 100755 --- a/src/test/osd/osd-config.sh +++ b/src/test/osd/osd-config.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -21,18 +22,19 @@ source test/osd/osd-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7100" export CEPH_ARGS + CEPH_ARGS+="--mon-host=$CEPH_MON " CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " local id=a - call_TEST_functions $dir $id --public-addr 127.0.0.1 || return 1 + call_TEST_functions $dir $id || return 1 } function TEST_config_init() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr=$CEPH_MON \ || return 1 local advance=1000 local stale=1000 @@ -50,7 +52,7 @@ function TEST_config_init() { function TEST_config_track() { local dir=$1 - run_mon $dir a --public-addr 127.0.0.1 \ + run_mon $dir a --public-addr=$CEPH_MON \ || return 1 run_osd $dir 0 || return 1 diff --git a/src/test/osd/osd-scrub-repair.sh b/src/test/osd/osd-scrub-repair.sh index 0c805b0b69e39..a24237b2925b0 100755 --- a/src/test/osd/osd-scrub-repair.sh +++ b/src/test/osd/osd-scrub-repair.sh @@ -21,12 +21,13 @@ source test/osd/osd-test-helpers.sh function run() { local dir=$1 + export CEPH_MON="127.0.0.1:7107" export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " - CEPH_ARGS+="--mon-host=127.0.0.1 " + CEPH_ARGS+="--mon-host=$CEPH_MON " setup $dir || return 1 - run_mon $dir a --public-addr 127.0.0.1 || return 1 + run_mon $dir a --public-addr $CEPH_MON || return 1 for id in $(seq 0 3) ; do run_osd $dir $id || return 1 done -- 2.39.5