summaryrefslogtreecommitdiffstats
path: root/qa/workunits/mon/test_noautoscale_flag.sh
blob: ca86cdf22d3872ef8049b5c4ecf2e82ade5f9098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash -ex

unset CEPH_CLI_TEST_DUP_COMMAND

NUM_POOLS=$(ceph osd pool ls | wc -l)

if [ "$NUM_POOLS" -gt 0 ]; then
    echo "test requires no preexisting pools"
    exit 1
fi

ceph osd pool set noautoscale

ceph osd pool create pool_a

echo 'pool_a autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_a | grep -o -m 1 'on\|off')

NUM_POOLS=$[NUM_POOLS+1]

sleep 2

# Count the number of Pools with AUTOSCALE `off`

RESULT1=$(ceph osd pool autoscale-status | grep -oe 'off' | wc -l)

# number of Pools with AUTOSCALE `off` should equal to 2

test "$RESULT1" -eq "$NUM_POOLS"

ceph osd pool unset noautoscale

echo $(ceph osd pool get noautoscale)


ceph osd pool create pool_b

echo 'pool_a autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_a | grep -o -m 1 'on\|off')

echo 'pool_b autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_b | grep -o -m 1 'on\|off')


NUM_POOLS=$[NUM_POOLS+1]

sleep 2

# Count the number of Pools with AUTOSCALE `on`

RESULT2=$(ceph osd pool autoscale-status | grep -oe 'on' | wc -l)

# number of Pools with AUTOSCALE `on` should equal to 3

test "$RESULT2" -eq "$NUM_POOLS"

ceph osd pool set noautoscale

ceph osd pool create pool_c

echo 'pool_a autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_a | grep -o -m 1 'on\|off')

echo 'pool_b autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_b | grep -o -m 1 'on\|off')

echo 'pool_c autoscale_mode:' $(ceph osd pool autoscale-status | grep pool_c | grep -o -m 1 'on\|off')


NUM_POOLS=$[NUM_POOLS+1]

sleep 2

# Count the number of Pools with AUTOSCALE `off`

RESULT3=$(ceph osd pool autoscale-status | grep -oe 'off' | wc -l)

# number of Pools with AUTOSCALE `off` should equal to 4

test "$RESULT3" -eq "$NUM_POOLS"

ceph osd pool rm pool_a pool_a  --yes-i-really-really-mean-it

ceph osd pool rm pool_b pool_b  --yes-i-really-really-mean-it

ceph osd pool rm pool_c pool_c  --yes-i-really-really-mean-it

echo OK