]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | #!/usr/bin/env bash |
7c673cae | 2 | |
11fdf7f2 | 3 | set -ex |
7c673cae FG |
4 | |
5 | function expect_false() | |
6 | { | |
7 | set -x | |
8 | if "$@"; then return 1; else return 0; fi | |
9 | } | |
10 | ||
11 | # note: we need to pass the other args or ceph_argparse.py will take | |
12 | # 'invalid' that is not replicated|erasure and assume it is the next | |
13 | # argument, which is a string. | |
14 | expect_false ceph osd pool create foo 123 123 invalid foo-profile foo-ruleset | |
15 | ||
16 | ceph osd pool create foo 123 123 replicated | |
17 | ceph osd pool create fooo 123 123 erasure default | |
18 | ceph osd pool create foooo 123 | |
19 | ||
20 | ceph osd pool create foo 123 # idempotent | |
21 | ||
22 | ceph osd pool set foo size 1 | |
23 | ceph osd pool set foo size 4 | |
24 | ceph osd pool set foo size 10 | |
25 | expect_false ceph osd pool set foo size 0 | |
26 | expect_false ceph osd pool set foo size 20 | |
27 | ||
eafe8130 TL |
28 | ceph osd pool set foo size 3 |
29 | ceph osd getcrushmap -o crush | |
30 | crushtool -d crush -o crush.txt | |
31 | sed -i 's/max_size 10/max_size 3/' crush.txt | |
32 | crushtool -c crush.txt -o crush.new | |
33 | ceph osd setcrushmap -i crush.new | |
34 | expect_false ceph osd pool set foo size 4 | |
35 | ceph osd setcrushmap -i crush | |
36 | rm -f crush crush.txt crush.new | |
37 | ||
7c673cae FG |
38 | # should fail due to safety interlock |
39 | expect_false ceph osd pool delete foo | |
40 | expect_false ceph osd pool delete foo foo | |
41 | expect_false ceph osd pool delete foo foo --force | |
42 | expect_false ceph osd pool delete foo fooo --yes-i-really-mean-it | |
43 | expect_false ceph osd pool delete foo --yes-i-really-mean-it foo | |
44 | ||
45 | ceph osd pool delete foooo foooo --yes-i-really-really-mean-it | |
46 | ceph osd pool delete fooo fooo --yes-i-really-really-mean-it | |
47 | ceph osd pool delete foo foo --yes-i-really-really-mean-it | |
48 | ||
49 | # idempotent | |
50 | ceph osd pool delete foo foo --yes-i-really-really-mean-it | |
51 | ceph osd pool delete fooo fooo --yes-i-really-really-mean-it | |
52 | ceph osd pool delete fooo fooo --yes-i-really-really-mean-it | |
53 | ||
54 | # non-existent pool | |
55 | ceph osd pool delete fuggg fuggg --yes-i-really-really-mean-it | |
56 | ||
57 | echo OK | |
58 | ||
59 |