mirror of
https://github.com/ceph/ceph
synced 2024-12-23 20:03:56 +00:00
unittests: fail early when low on disk
Scripts from qa that are run as unittests via test/vstart_wrapper.sh may fail because the partition on which it runs is low on space ( 95% full ). When it happens the cause of the problem may be unclear because it is likely to show only as a client not being able to reach the mon. A test is added in test/vstart_wrapper.sh to verify the disk space usage using the same method as the mon would and fail with a detailed error if it is the case. Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
parent
97edd2fcad
commit
c06eca2448
@ -25,20 +25,34 @@ function vstart_setup()
|
||||
mkdir -p dev
|
||||
trap "vstart_teardown ; rm -f $TMPFILE" EXIT
|
||||
export LC_ALL=C # some tests are vulnerable to i18n
|
||||
MON=1 OSD=3 ./vstart.sh -n -X -l mon osd
|
||||
MON=1 OSD=3 ./vstart.sh -n -X -l mon osd || return 1
|
||||
export PATH=.:$PATH
|
||||
export CEPH_CONF=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()
|
||||
{
|
||||
if [[ $(pwd) =~ /src$ ]] && [ -d .libs ] && [ -d pybind ] ; then
|
||||
vstart_setup
|
||||
vstart_setup || return 1
|
||||
else
|
||||
trap "rm -f $TMPFILE" EXIT
|
||||
fi
|
||||
|
||||
"$@"
|
||||
"$@" || return 1
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user