Revision 6bbd76d2 htools/offline-test.sh

b/htools/offline-test.sh
101 101
# policy, then we change all nodes from this group to the allocable
102 102
# one, and we check for rebalancing
103 103
FROOT="$T/simu-rebal-orig"
104
hspace --simu p,4,8T,64g,16 --simu u,4,8T,64g,16 \
104
hspace --simu u,4,8T,64g,16 --simu p,4,8T,64g,16 \
105 105
  -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1
106 106
for suffix in standard tiered; do
107 107
  RELOC="$T/simu-rebal-merged.$suffix"
......
129 129
done
130 130
echo OK
131 131

  
132
echo IAllocator checks
133
# test that on invalid files it can't parse the request
134
! hail /dev/null 2>&1 | grep -q "Invalid JSON"
135
! hail <(echo '[]') >/dev/null 2>&1
136
! hail <(echo '{}') 2>&1 | grep -q "key 'request' not found"
137
! hail <(echo '{"request": 0}') 2>&1 | grep -q "key 'request'"
138
! hail $TESTDATA_DIR/hail-invalid-reloc.json >/dev/null 2>&1
139

  
140
# just test that it can read the file, print the cluster and generate
141
# pre and post allocation files
142
hail -v -v -v -p $TESTDATA_DIR/hail-alloc-drbd.json \
143
  -S $T/hail-alloc >/dev/null 2>&1
144
! cmp -s $T/hail-alloc.pre-ialloc $T/hail-alloc.post-ialloc
145
hail -v -v -v -p $TESTDATA_DIR/hail-reloc-drbd.json \
146
  -S $T/hail-reloc >/dev/null 2>&1
147
! cmp -s $T/hail-reloc.pre-ialloc $T/hail-reloc.post-ialloc
148

  
149
# and now start the real tests
150
hail $TESTDATA_DIR/hail-alloc-drbd.json | \
151
  grep -q '"success":true,.*,"result":\["node2","node1"\]'
152
hail $TESTDATA_DIR/hail-reloc-drbd.json | \
153
  grep -q '"success":true,.*,"result":\["node1"\]'
154

  
155
hail $TESTDATA_DIR/hail-node-evac.json | \
156
  grep -Fq '"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"'
157

  
158
hail $TESTDATA_DIR/hail-change-group.json | \
159
  grep -Fq '"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"'
160

  
161
for evac_mode in primary-only secondary-only all; do
162
  sed -e 's/"evac_mode": "all"/"evac_mode": "'${evac_mode}'"/' \
163
    < $TESTDATA_DIR/hail-node-evac.json \
164
    > $T/hail-node-evac.json.$evac_mode
165
  hail $T/hail-node-evac.json.$evac_mode | \
166
    grep -q '"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"'
167
done
168

  
169
# check that hail can use the simu and text backends
170
hail --simu p,8,8T,16g,16 $TESTDATA_DIR/hail-alloc-drbd.json | \
171
  grep -q '"success":true,'
172
hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json | \
173
  grep -q '"success":true,'
174
echo OK
175

  
132 176
echo All OK

Also available in: Unified diff