summaryrefslogtreecommitdiffstats
path: root/src/test/crush
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2017-07-21 04:54:48 +0200
committerSage Weil <sage@redhat.com>2017-07-25 04:11:49 +0200
commit71ea1716043843dd191830f0bcbcc4a88059a9c2 (patch)
tree1179b43682033a81daf79c099f16e10703051f1e /src/test/crush
parentdeb,rpm: require socat for ceph-test (diff)
downloadceph-71ea1716043843dd191830f0bcbcc4a88059a9c2.tar.xz
ceph-71ea1716043843dd191830f0bcbcc4a88059a9c2.zip
qa: move ceph-helpers and misc src/test/*.sh tests to qa/standalone
- stop running via make check - add teuthology yamls to run them - disable ceph_objecstore_tool.py for now (too slow for make check, and we can't use vstart in teuthology via a package install) - drop cephtool tests since those are already covered by other teuthology tests - leave a handful of (fast!) ceph-helpers tests for make check for minimal integration tests. Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/test/crush')
-rw-r--r--src/test/crush/CMakeLists.txt2
-rwxr-xr-xsrc/test/crush/crush-choose-args.sh162
-rwxr-xr-xsrc/test/crush/crush-classes.sh157
-rwxr-xr-xsrc/test/crush/crush_weights.sh1
4 files changed, 0 insertions, 322 deletions
diff --git a/src/test/crush/CMakeLists.txt b/src/test/crush/CMakeLists.txt
index 81f587fec26..e527daf817a 100644
--- a/src/test/crush/CMakeLists.txt
+++ b/src/test/crush/CMakeLists.txt
@@ -13,5 +13,3 @@ add_ceph_unittest(unittest_crush ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_crus
target_link_libraries(unittest_crush global m ${BLKID_LIBRARIES})
add_ceph_test(crush_weights.sh ${CMAKE_CURRENT_SOURCE_DIR}/crush_weights.sh)
-add_ceph_test(crush-classes.sh ${CMAKE_CURRENT_SOURCE_DIR}/crush-classes.sh)
-add_ceph_test(crush-choose-args.sh ${CMAKE_CURRENT_SOURCE_DIR}/crush-choose-args.sh)
diff --git a/src/test/crush/crush-choose-args.sh b/src/test/crush/crush-choose-args.sh
deleted file mode 100755
index 493d5d40f2d..00000000000
--- a/src/test/crush/crush-choose-args.sh
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 Red Hat <contact@redhat.com>
-#
-# Author: Loic Dachary <loic@dachary.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library Public License for more details.
-#
-
-source $(dirname $0)/../detect-build-env-vars.sh
-source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
-
-function run() {
- local dir=$1
- shift
-
- export CEPH_MON="127.0.0.1:7131" # git grep '\<7131\>' : there must be only one
- export CEPH_ARGS
- CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
- CEPH_ARGS+="--mon-host=$CEPH_MON "
- CEPH_ARGS+="--crush-location=root=default,host=HOST "
- CEPH_ARGS+="--osd-crush-initial-weight=3 "
- #
- # Disable device auto class feature for now.
- # The device class is non-deterministic and will
- # crash the crushmap comparison below.
- #
- CEPH_ARGS+="--osd-class-update-on-start=false "
-
- local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
- for func in $funcs ; do
- setup $dir || return 1
- $func $dir || return 1
- teardown $dir || return 1
- done
-}
-
-function TEST_choose_args_update() {
- #
- # adding a weighted OSD updates the weight up to the top
- #
- local dir=$1
-
- run_mon $dir a || return 1
- run_osd $dir 0 || return 1
-
- ceph osd set-require-min-compat-client luminous
- ceph osd getcrushmap > $dir/map || return 1
- crushtool -d $dir/map -o $dir/map.txt || return 1
- sed -i -e '/end crush map/d' $dir/map.txt
- cat >> $dir/map.txt <<EOF
-# choose_args
-choose_args 0 {
- {
- bucket_id -1
- weight_set [
- [ 3.000 ]
- [ 3.000 ]
- ]
- ids [ -10 ]
- }
- {
- bucket_id -2
- weight_set [
- [ 2.000 ]
- [ 2.000 ]
- ]
- ids [ -20 ]
- }
-}
-
-# end crush map
-EOF
- crushtool -c $dir/map.txt -o $dir/map-new || return 1
- ceph osd setcrushmap -i $dir/map-new || return 1
-
- run_osd $dir 1 || return 1
- ceph osd getcrushmap > $dir/map-one-more || return 1
- crushtool -d $dir/map-one-more -o $dir/map-one-more.txt || return 1
- cat $dir/map-one-more.txt
- diff -u $dir/map-one-more.txt $CEPH_ROOT/src/test/crush/crush-choose-args-expected-one-more-3.txt || return 1
-
- destroy_osd $dir 1 || return 1
- ceph osd getcrushmap > $dir/map-one-less || return 1
- crushtool -d $dir/map-one-less -o $dir/map-one-less.txt || return 1
- diff -u $dir/map-one-less.txt $dir/map.txt || return 1
-}
-
-function TEST_no_update_weight_set() {
- #
- # adding a zero weight OSD does not update the weight set at all
- #
- local dir=$1
-
- ORIG_CEPH_ARGS="$CEPH_ARGS"
- CEPH_ARGS+="--osd-crush-update-weight-set=false "
-
- run_mon $dir a || return 1
- run_osd $dir 0 || return 1
-
- ceph osd set-require-min-compat-client luminous
- ceph osd crush tree
- ceph osd getcrushmap > $dir/map || return 1
- crushtool -d $dir/map -o $dir/map.txt || return 1
- sed -i -e '/end crush map/d' $dir/map.txt
- cat >> $dir/map.txt <<EOF
-# choose_args
-choose_args 0 {
- {
- bucket_id -1
- weight_set [
- [ 2.000 ]
- [ 1.000 ]
- ]
- ids [ -10 ]
- }
- {
- bucket_id -2
- weight_set [
- [ 2.000 ]
- [ 1.000 ]
- ]
- ids [ -20 ]
- }
-}
-
-# end crush map
-EOF
- crushtool -c $dir/map.txt -o $dir/map-new || return 1
- ceph osd setcrushmap -i $dir/map-new || return 1
- ceph osd crush tree
-
-
- run_osd $dir 1 || return 1
- ceph osd crush tree
- ceph osd getcrushmap > $dir/map-one-more || return 1
- crushtool -d $dir/map-one-more -o $dir/map-one-more.txt || return 1
- cat $dir/map-one-more.txt
- diff -u $dir/map-one-more.txt $CEPH_ROOT/src/test/crush/crush-choose-args-expected-one-more-0.txt || return 1
-
- destroy_osd $dir 1 || return 1
- ceph osd crush tree
- ceph osd getcrushmap > $dir/map-one-less || return 1
- crushtool -d $dir/map-one-less -o $dir/map-one-less.txt || return 1
- diff -u $dir/map-one-less.txt $dir/map.txt || return 1
-
- CEPH_ARGS="$ORIG_CEPH_ARGS"
-}
-
-main crush-choose-args "$@"
-
-# Local Variables:
-# compile-command: "cd ../../../build ; ln -sf ../src/ceph-disk/ceph_disk/main.py bin/ceph-disk && make -j4 && ../src/test/crush/crush-choose-args.sh"
-# End:
diff --git a/src/test/crush/crush-classes.sh b/src/test/crush/crush-classes.sh
deleted file mode 100755
index b26cc8691ad..00000000000
--- a/src/test/crush/crush-classes.sh
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 Red Hat <contact@redhat.com>
-#
-# Author: Loic Dachary <loic@dachary.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library Public License for more details.
-#
-
-source $(dirname $0)/../detect-build-env-vars.sh
-source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
-
-function run() {
- local dir=$1
- shift
-
- export CEPH_MON="127.0.0.1:7130" # git grep '\<7130\>' : there must be only one
- export CEPH_ARGS
- CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
- CEPH_ARGS+="--mon-host=$CEPH_MON "
- #
- # Disable auto-class, so we can inject device class manually below
- #
- CEPH_ARGS+="--osd-class-update-on-start=false "
-
- local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
- for func in $funcs ; do
- setup $dir || return 1
- $func $dir || return 1
- teardown $dir || return 1
- done
-}
-
-function add_something() {
- local dir=$1
- local obj=${2:-SOMETHING}
-
- local payload=ABCDEF
- echo $payload > $dir/ORIGINAL
- rados --pool rbd put $obj $dir/ORIGINAL || return 1
-}
-
-function get_osds_up() {
- local poolname=$1
- local objectname=$2
-
- local osds=$(ceph --format xml osd map $poolname $objectname 2>/dev/null | \
- $XMLSTARLET sel -t -m "//up/osd" -v . -o ' ')
- # get rid of the trailing space
- echo $osds
-}
-
-function TEST_classes() {
- local dir=$1
-
- run_mon $dir a || return 1
- run_osd $dir 0 || return 1
- run_osd $dir 1 || return 1
- run_osd $dir 2 || return 1
-
- test "$(get_osds_up rbd SOMETHING)" == "1 2 0" || return 1
- add_something $dir SOMETHING || return 1
-
- #
- # osd.0 has class ssd and the rule is modified
- # to only take ssd devices.
- #
- ceph osd getcrushmap > $dir/map || return 1
- crushtool -d $dir/map -o $dir/map.txt || return 1
- ${SED} -i \
- -e '/device 0 osd.0/s/$/ class ssd/' \
- -e '/step take default/s/$/ class ssd/' \
- $dir/map.txt || return 1
- crushtool -c $dir/map.txt -o $dir/map-new || return 1
- ceph osd setcrushmap -i $dir/map-new || return 1
-
- #
- # There can only be one mapping since there only is
- # one device with ssd class.
- #
- ok=false
- for delay in 2 4 8 16 32 64 128 256 ; do
- if test "$(get_osds_up rbd SOMETHING_ELSE)" == "0" ; then
- ok=true
- break
- fi
- sleep $delay
- ceph osd dump # for debugging purposes
- ceph pg dump # for debugging purposes
- done
- $ok || return 1
- #
- # Writing keeps working because the pool is min_size 1 by
- # default.
- #
- add_something $dir SOMETHING_ELSE || return 1
-
- #
- # Sanity check that the rule indeed has ssd
- # generated bucket with a name including ~ssd.
- #
- ceph osd crush dump | grep -q '~ssd' || return 1
-}
-
-function TEST_set_device_class() {
- local dir=$1
-
- TEST_classes $dir || return 1
-
- ceph osd crush set-device-class ssd osd.0 || return 1
- ceph osd crush class ls-osd ssd | grep 0 || return 1
- ceph osd crush set-device-class ssd osd.1 || return 1
- ceph osd crush class ls-osd ssd | grep 1 || return 1
- ceph osd crush set-device-class ssd 0 1 || return 1 # should be idempotent
-
- ok=false
- for delay in 2 4 8 16 32 64 128 256 ; do
- if test "$(get_osds_up rbd SOMETHING_ELSE)" == "0 1" ; then
- ok=true
- break
- fi
- sleep $delay
- ceph osd crush dump
- ceph osd dump # for debugging purposes
- ceph pg dump # for debugging purposes
- done
- $ok || return 1
-}
-
-function TEST_mon_classes() {
- local dir=$1
-
- run_mon $dir a || return 1
- ceph osd crush class create CLASS || return 1
- ceph osd crush class create CLASS || return 1 # idempotent
- ceph osd crush class ls | grep CLASS || return 1
- ceph osd crush class rename CLASS TEMP || return 1
- ceph osd crush class ls | grep TEMP || return 1
- ceph osd crush class rename TEMP CLASS || return 1
- ceph osd crush class ls | grep CLASS || return 1
- ceph osd crush class rm CLASS || return 1
- expect_failure $dir ENOENT ceph osd crush class rm CLASS || return 1
-}
-
-main crush-classes "$@"
-
-# Local Variables:
-# compile-command: "cd ../../../build ; ln -sf ../src/ceph-disk/ceph_disk/main.py bin/ceph-disk && make -j4 && ../src/test/crush/crush-classes.sh"
-# End:
diff --git a/src/test/crush/crush_weights.sh b/src/test/crush/crush_weights.sh
index 52c0f20db32..6ae1900612d 100755
--- a/src/test/crush/crush_weights.sh
+++ b/src/test/crush/crush_weights.sh
@@ -1,7 +1,6 @@
#!/bin/bash
source $(dirname $0)/../detect-build-env-vars.sh
-source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
read -r -d '' cm <<'EOF'
# devices