3 unset CEPH_CLI_TEST_DUP_COMMAND
5 NUM_POOLS
=$
(ceph osd pool
ls |
wc -l)
7 if [ "$NUM_POOLS" -gt 0 ]; then
8 echo "test requires no preexisting pools"
12 ceph osd pool
set noautoscale
14 ceph osd pool create pool_a
16 echo 'pool_a autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_a |
grep -o -m 1 'on\|off')
18 NUM_POOLS
=$
[NUM_POOLS
+1]
22 # Count the number of Pools with AUTOSCALE `off`
24 RESULT1
=$
(ceph osd pool autoscale-status |
grep -oe 'off' |
wc -l)
26 # number of Pools with AUTOSCALE `off` should equal to $NUM_POOLS
28 test "$RESULT1" -eq "$NUM_POOLS"
30 ceph osd pool
unset noautoscale
32 echo $
(ceph osd pool get noautoscale
)
35 ceph osd pool create pool_b
37 echo 'pool_a autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_a |
grep -o -m 1 'on\|off')
39 echo 'pool_b autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_b |
grep -o -m 1 'on\|off')
42 NUM_POOLS
=$
[NUM_POOLS
+1]
46 # Count the number of Pools with AUTOSCALE `on`
48 RESULT2
=$
(ceph osd pool autoscale-status |
grep -oe 'on' |
wc -l)
50 # number of Pools with AUTOSCALE `on` should equal to 3
52 test "$RESULT2" -eq "$[NUM_POOLS-1]"
54 ceph osd pool
set noautoscale
56 ceph osd pool create pool_c
58 echo 'pool_a autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_a |
grep -o -m 1 'on\|off')
60 echo 'pool_b autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_b |
grep -o -m 1 'on\|off')
62 echo 'pool_c autoscale_mode:' $
(ceph osd pool autoscale-status |
grep pool_c |
grep -o -m 1 'on\|off')
65 NUM_POOLS
=$
[NUM_POOLS
+1]
69 # Count the number of Pools with AUTOSCALE `off`
71 RESULT3
=$
(ceph osd pool autoscale-status |
grep -oe 'off' |
wc -l)
73 # number of Pools with AUTOSCALE `off` should equal to 4
75 test "$RESULT3" -eq "$NUM_POOLS"
77 # Now we test if we retain individual pool state of autoscale mode
78 # when we set and unset the noautoscale flag.
80 ceph osd pool
unset noautoscale
82 ceph osd pool
set pool_a pg_autoscale_mode on
84 ceph osd pool
set pool_b pg_autoscale_mode warn
86 ceph osd pool
set noautoscale
88 ceph osd pool
unset noautoscale
90 RESULT4
=$
(ceph osd pool autoscale-status |
grep pool_a |
grep -o -m 1 'on\|off\|warn')
91 RESULT5
=$
(ceph osd pool autoscale-status |
grep pool_b |
grep -o -m 1 'on\|off\|warn')
92 RESULT6
=$
(ceph osd pool autoscale-status |
grep pool_c |
grep -o -m 1 'on\|off\|warn')
94 test "$RESULT4" == 'on'
95 test "$RESULT5" == 'warn'
96 test "$RESULT6" == 'off'
98 ceph osd pool
rm pool_a pool_a
--yes-i-really-really-mean-it
100 ceph osd pool
rm pool_b pool_b
--yes-i-really-really-mean-it
102 ceph osd pool
rm pool_c pool_c
--yes-i-really-really-mean-it