From: Nathan Cutler Date: Sun, 29 Jul 2018 16:24:48 +0000 (+0200) Subject: mimic: qa/ceph-disk: fixes for OVH and add ceph-detect-init subsuite X-Git-Tag: v12.2.13~129^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=17bc3dc73a14701f5f6541245955bdd343ffbee2;p=ceph.git mimic: qa/ceph-disk: fixes for OVH and add ceph-detect-init subsuite With the move to OVH and the addition of RHEL as a supported distro, the ceph-disk/basic suite was no longer green. This commit brings it back into a green state. Also, although ceph-disk/basic presumably exercises ceph-detect-init, it seemed prudent to add a test case that runs it explicitly. Can not be cherry-picked because ceph-disk and ceph-detect-init are no longer present in master. Reverts: 230c030fad091ae9c136a421e6206d3e8c9378f8 Fixes: https://tracker.ceph.com/issues/25031 Signed-off-by: Nathan Cutler (cherry picked from commit 6bbeb4496e310a4974ddee21b37119979f8e61c2) Conflicts: qa/workunits/ceph-disk/ceph-disk.sh - luminous does not have 3aae5ca6fda8b07ef875ae47c1b620aa3e2cdcd9 so we leave the shebang as it is --- diff --git a/qa/suites/ceph-disk/basic/distros b/qa/suites/ceph-disk/basic/distros index c5d59352cb5e..23d9e9be86f0 120000 --- a/qa/suites/ceph-disk/basic/distros +++ b/qa/suites/ceph-disk/basic/distros @@ -1 +1 @@ -../../../distros/supported \ No newline at end of file +.qa/distros/supported \ No newline at end of file diff --git a/qa/suites/ceph-disk/basic/tasks/ceph-detect-init.yaml b/qa/suites/ceph-disk/basic/tasks/ceph-detect-init.yaml new file mode 100644 index 000000000000..f464ff8c388a --- /dev/null +++ b/qa/suites/ceph-disk/basic/tasks/ceph-detect-init.yaml @@ -0,0 +1,11 @@ +openstack: +- volumes: # attached to each instance + count: 0 +roles: +- [client.0] +tasks: +- install: +- exec: + client.0: + - ceph-detect-init + - test "$(ceph-detect-init)" = "systemd" diff --git a/qa/workunits/ceph-disk/ceph-disk.sh b/qa/workunits/ceph-disk/ceph-disk.sh index 7102efba181c..19737ccdc5e2 100755 --- a/qa/workunits/ceph-disk/ceph-disk.sh +++ b/qa/workunits/ceph-disk/ceph-disk.sh @@ -1,13 +1,23 @@ #!/bin/bash -if [ -f $(dirname $0)/../ceph-helpers-root.sh ]; then - source $(dirname $0)/../ceph-helpers-root.sh +BASEDIR=$(dirname $0) +if [ -f $BASEDIR/../ceph-helpers-root.sh ]; then + source $BASEDIR/../ceph-helpers-root.sh else - echo "$(dirname $0)/../ceph-helpers-root.sh does not exist." + echo "$BASEDIR/../ceph-helpers-root.sh does not exist." exit 1 fi -install python-pytest || true -install pytest || true +PATH=$BASEDIR:$BASEDIR/..:$PATH + +: ${PYTHON:=python} +$PYTHON --version + +type pip + +# newer versions of pytest (e.g. 3.7.0) seem to work fine with Python 2.7, +# so just grab the latest version +sudo -H pip install pytest +$PYTHON -m pytest --version # complete the cluster setup done by the teuthology ceph task sudo chown $(id -u) /etc/ceph/ceph.conf @@ -20,27 +30,18 @@ fi sudo ceph osd crush rm osd.0 || true sudo ceph osd crush rm osd.1 || true -sudo cp $(dirname $0)/60-ceph-by-partuuid.rules /lib/udev/rules.d +sudo cp $BASEDIR/60-ceph-by-partuuid.rules /lib/udev/rules.d sudo udevadm control --reload -perl -pi -e 's|pid file.*|pid file = /var/run/ceph/\$cluster-\$name.pid|' /etc/ceph/ceph.conf - -PATH=$(dirname $0):$(dirname $0)/..:$PATH - -: ${PYTHON:=python} -PY_VERSION=$($PYTHON --version 2>&1) - -if ! ${PYTHON} -m pytest --version > /dev/null 2>&1; then - echo "py.test not installed for ${PY_VERSION}" - exit 1 -fi +sudo perl -pi -e 's|pid file.*|pid file = /var/run/ceph/\$cluster-\$name.pid|' /etc/ceph/ceph.conf -sudo env PATH=$(dirname $0):$(dirname $0)/..:$PATH PYTHONWARNINGS=ignore ${PYTHON} -m pytest -s -v $(dirname $0)/ceph-disk-test.py +sudo env PATH=$PATH PYTHONWARNINGS=ignore ${PYTHON} -m pytest -s -v --rootdir=$BASEDIR $BASEDIR/ceph-disk-test.py result=$? +sudo rm -rf $BASEDIR/.pytest_cache sudo rm -f /lib/udev/rules.d/60-ceph-by-partuuid.rules # own whatever was created as a side effect of the py.test run # so that it can successfully be removed later on by a non privileged # process -sudo chown -R $(id -u) $(dirname $0) +sudo chown -R $(id -u) $BASEDIR exit $result