]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/vstart_wrapper.sh
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / test / vstart_wrapper.sh
CommitLineData
11fdf7f2 1#!/usr/bin/env bash
7c673cae
FG
2#
3# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
4# Copyright (C) 2015 Red Hat <contact@redhat.com>
5#
6# Author: Loic Dachary <loic@dachary.org>
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU Library Public License as published by
10# the Free Software Foundation; either version 2, or (at your option)
11# any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Library Public License for more details.
17#
18
c07f9fc5 19source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
7c673cae
FG
20
21export CEPH_VSTART_WRAPPER=1
22export CEPH_DIR="${TMPDIR:-$PWD}/td/t-$CEPH_PORT"
23export CEPH_DEV_DIR="$CEPH_DIR/dev"
24export CEPH_OUT_DIR="$CEPH_DIR/out"
c07f9fc5 25export CEPH_ASOK_DIR="$CEPH_DIR/out"
7c673cae 26
31f18b77
FG
27export MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr
28
7c673cae
FG
29function vstart_setup()
30{
31 rm -fr $CEPH_DEV_DIR $CEPH_OUT_DIR
32 mkdir -p $CEPH_DEV_DIR
33 trap "teardown $CEPH_DIR" EXIT
34 export LC_ALL=C # some tests are vulnerable to i18n
35 export PATH="$(pwd):${PATH}"
36 OBJSTORE_ARGS=""
37 if [ "bluestore" = "${CEPH_OBJECTSTORE}" ]; then
38 OBJSTORE_ARGS="-b"
39 fi
40 $CEPH_ROOT/src/vstart.sh \
41 --short \
42 $OBJSTORE_ARGS \
43 -o 'paxos propose interval = 0.01' \
44 -d -n -l || return 1
45 export CEPH_CONF=$CEPH_DIR/ceph.conf
46
47 crit=$(expr 100 - $(ceph-conf --show-config-value mon_data_avail_crit))
48 if [ $(df . | perl -ne 'print if(s/.*\s(\d+)%.*/\1/)') -ge $crit ] ; then
49 df .
50 cat <<EOF
51error: not enough free disk space for mon to run
52The mon will shutdown with a message such as
53 "reached critical levels of available space on local monitor storage -- shutdown!"
54as soon as it finds the disk has is more than ${crit}% full.
55This is a limit determined by
56 ceph-conf --show-config-value mon_data_avail_crit
57EOF
58 return 1
59 fi
60}
61
62function main()
63{
64 teardown $CEPH_DIR
65 vstart_setup || return 1
31f18b77
FG
66 if CEPH_CONF=$CEPH_DIR/ceph.conf "$@"; then
67 code=0
68 else
69 code=1
70 display_logs $CEPH_OUT_DIR
71 fi
72 return $code
7c673cae
FG
73}
74
75main "$@"