]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/vstart_wrapper.sh
update sources to v12.1.0
[ceph.git] / ceph / src / test / vstart_wrapper.sh
CommitLineData
7c673cae
FG
1#!/bin/bash
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
19source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
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"
25
31f18b77
FG
26export MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr
27
7c673cae
FG
28function vstart_setup()
29{
30 rm -fr $CEPH_DEV_DIR $CEPH_OUT_DIR
31 mkdir -p $CEPH_DEV_DIR
32 trap "teardown $CEPH_DIR" EXIT
33 export LC_ALL=C # some tests are vulnerable to i18n
34 export PATH="$(pwd):${PATH}"
35 OBJSTORE_ARGS=""
36 if [ "bluestore" = "${CEPH_OBJECTSTORE}" ]; then
37 OBJSTORE_ARGS="-b"
38 fi
39 $CEPH_ROOT/src/vstart.sh \
40 --short \
41 $OBJSTORE_ARGS \
42 -o 'paxos propose interval = 0.01' \
43 -d -n -l || return 1
44 export CEPH_CONF=$CEPH_DIR/ceph.conf
45
46 crit=$(expr 100 - $(ceph-conf --show-config-value mon_data_avail_crit))
47 if [ $(df . | perl -ne 'print if(s/.*\s(\d+)%.*/\1/)') -ge $crit ] ; then
48 df .
49 cat <<EOF
50error: not enough free disk space for mon to run
51The mon will shutdown with a message such as
52 "reached critical levels of available space on local monitor storage -- shutdown!"
53as soon as it finds the disk has is more than ${crit}% full.
54This is a limit determined by
55 ceph-conf --show-config-value mon_data_avail_crit
56EOF
57 return 1
58 fi
59}
60
61function main()
62{
63 teardown $CEPH_DIR
64 vstart_setup || return 1
31f18b77
FG
65 if CEPH_CONF=$CEPH_DIR/ceph.conf "$@"; then
66 code=0
67 else
68 code=1
69 display_logs $CEPH_OUT_DIR
70 fi
71 return $code
7c673cae
FG
72}
73
74main "$@"