]>
Commit | Line | Data |
---|---|---|
b3b6e05e TL |
1 | #!/usr/bin/env bash |
2 | set -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 | ||
11 | set -e | |
12 | expect_failure() { | |
13 | if "$@"; then return 1; else return 0; fi | |
14 | } | |
15 | ||
16 | ceph fs subvolume create cephfs sub_0 | |
17 | subvol_path=$(ceph fs subvolume getpath cephfs sub_0 2>/dev/null) | |
18 | ||
19 | #For debugging | |
20 | echo "Before write" | |
21 | df -h | |
22 | ceph osd df | |
23 | ||
24 | sudo dd if=/dev/urandom of=$CEPH_MNT$subvol_path/500MB_file-1 status=progress bs=1M count=500 | |
25 | ||
26 | ceph osd set-full-ratio 0.2 | |
27 | ceph osd set-nearfull-ratio 0.16 | |
28 | ceph osd set-backfillfull-ratio 0.18 | |
29 | ||
30 | timeout=30 | |
31 | while [ $timeout -gt 0 ] | |
32 | do | |
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" | |
38 | done | |
39 | ||
40 | #For debugging | |
41 | echo "After ratio set" | |
42 | df -h | |
43 | ceph osd df | |
44 | ||
45 | #Delete subvolume | |
46 | ceph fs subvolume rm cephfs sub_0 | |
47 | ||
48 | #Validate subvolume is deleted | |
49 | expect_failure ceph fs subvolume info cephfs sub_0 | |
50 | ||
51 | #Wait for subvolume to delete data | |
52 | trashdir=$CEPH_MNT/volumes/_deleting | |
53 | timeout=30 | |
54 | while [ $timeout -gt 0 ] | |
55 | do | |
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" | |
60 | done | |
61 | ||
2a845540 TL |
62 | #Set the ratios back for other full tests to run |
63 | ceph osd set-full-ratio 0.95 | |
64 | ceph osd set-nearfull-ratio 0.95 | |
65 | ceph osd set-backfillfull-ratio 0.95 | |
66 | ||
67 | #After test | |
68 | echo "After test" | |
69 | df -h | |
70 | ceph osd df | |
71 | ||
b3b6e05e | 72 | echo OK |