summaryrefslogtreecommitdiffstats
path: root/src/test/vstart_wrapper.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/test/vstart_wrapper.sh
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/vstart_wrapper.sh')
-rwxr-xr-xsrc/test/vstart_wrapper.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/test/vstart_wrapper.sh b/src/test/vstart_wrapper.sh
new file mode 100755
index 000000000..7bd3dbe33
--- /dev/null
+++ b/src/test/vstart_wrapper.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
+# Copyright (C) 2015 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 $CEPH_ROOT/qa/standalone/ceph-helpers.sh
+
+export CEPH_VSTART_WRAPPER=1
+export CEPH_DIR="${TMPDIR:-$PWD}/td/t-$CEPH_PORT"
+export CEPH_DEV_DIR="$CEPH_DIR/dev"
+export CEPH_OUT_DIR="$CEPH_DIR/out"
+export CEPH_ASOK_DIR="$CEPH_DIR/out"
+
+export MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr
+
+function vstart_setup()
+{
+ rm -fr $CEPH_DEV_DIR $CEPH_OUT_DIR
+ mkdir -p $CEPH_DEV_DIR
+ trap "teardown $CEPH_DIR" EXIT
+ export LC_ALL=C # some tests are vulnerable to i18n
+ export PATH="$(pwd):${PATH}"
+ OBJSTORE_ARGS=""
+ if [ "bluestore" = "${CEPH_OBJECTSTORE}" ]; then
+ OBJSTORE_ARGS="-b"
+ fi
+ $CEPH_ROOT/src/vstart.sh \
+ --short \
+ $OBJSTORE_ARGS \
+ -o 'paxos propose interval = 0.01' \
+ -d -n -l || return 1
+ export CEPH_CONF=$CEPH_DIR/ceph.conf
+
+ crit=$(expr 100 - $(ceph-conf --show-config-value mon_data_avail_crit))
+ if [ $(df . | perl -ne 'print if(s/.*\s(\d+)%.*/\1/)') -ge $crit ] ; then
+ df .
+ cat <<EOF
+error: not enough free disk space for mon to run
+The mon will shutdown with a message such as
+ "reached critical levels of available space on local monitor storage -- shutdown!"
+as soon as it finds the disk has is more than ${crit}% full.
+This is a limit determined by
+ ceph-conf --show-config-value mon_data_avail_crit
+EOF
+ return 1
+ fi
+}
+
+function main()
+{
+ teardown $CEPH_DIR
+ vstart_setup || return 1
+ if CEPH_CONF=$CEPH_DIR/ceph.conf "$@"; then
+ code=0
+ else
+ code=1
+ display_logs $CEPH_OUT_DIR
+ fi
+ return $code
+}
+
+main "$@"