]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/fs/full/subvolume_rm.sh
import ceph quincy 17.2.4
[ceph.git] / ceph / qa / workunits / fs / full / subvolume_rm.sh
CommitLineData
b3b6e05e
TL
1#!/usr/bin/env bash
2set -ex
3
4# This testcase tests the scenario of the 'ceph fs subvolume rm' mgr command
5# when the osd is full. The command used to hang. The osd is of the size 1GB.
6# The subvolume is created and 500MB file is written. The full-ratios are
7# set below 500MB such that the osd is treated as full. Now the subvolume is
8# is removed. This should be successful with the introduction of FULL
9# capabilities which the mgr holds.
10
11set -e
12expect_failure() {
13 if "$@"; then return 1; else return 0; fi
14}
15
16ceph fs subvolume create cephfs sub_0
17subvol_path=$(ceph fs subvolume getpath cephfs sub_0 2>/dev/null)
18
19#For debugging
20echo "Before write"
21df -h
22ceph osd df
23
24sudo dd if=/dev/urandom of=$CEPH_MNT$subvol_path/500MB_file-1 status=progress bs=1M count=500
25
26ceph osd set-full-ratio 0.2
27ceph osd set-nearfull-ratio 0.16
28ceph osd set-backfillfull-ratio 0.18
29
30timeout=30
31while [ $timeout -gt 0 ]
32do
33 health=$(ceph health detail)
34 [[ $health = *"OSD_FULL"* ]] && echo "OSD is full" && break
35 echo "Wating for osd to be full: $timeout"
36 sleep 1
37 let "timeout-=1"
38done
39
40#For debugging
41echo "After ratio set"
42df -h
43ceph osd df
44
45#Delete subvolume
46ceph fs subvolume rm cephfs sub_0
47
48#Validate subvolume is deleted
49expect_failure ceph fs subvolume info cephfs sub_0
50
51#Wait for subvolume to delete data
52trashdir=$CEPH_MNT/volumes/_deleting
53timeout=30
54while [ $timeout -gt 0 ]
55do
56 [ -z "$(sudo ls -A $trashdir)" ] && echo "Trash directory $trashdir is empty" && break
57 echo "Wating for trash dir to be empty: $timeout"
58 sleep 1
59 let "timeout-=1"
60done
61
2a845540
TL
62#Set the ratios back for other full tests to run
63ceph osd set-full-ratio 0.95
64ceph osd set-nearfull-ratio 0.95
65ceph osd set-backfillfull-ratio 0.95
66
67#After test
68echo "After test"
69df -h
70ceph osd df
71
b3b6e05e 72echo OK