root / test / hs / live-test.sh @ b008fa25
History | View | Annotate | Download (5 kB)
1 | 31728b11 | Iustin Pop | #!/bin/bash |
---|---|---|---|
2 | 31728b11 | Iustin Pop | |
3 | 01c23d75 | Iustin Pop | # Copyright (C) 2009, 2010, 2011, 2012 Google Inc. |
4 | 31728b11 | Iustin Pop | |
5 | 31728b11 | Iustin Pop | # This program is free software; you can redistribute it and/or modify |
6 | 31728b11 | Iustin Pop | # it under the terms of the GNU General Public License as published by |
7 | 31728b11 | Iustin Pop | # the Free Software Foundation; either version 2 of the License, or |
8 | 31728b11 | Iustin Pop | # (at your option) any later version. |
9 | 31728b11 | Iustin Pop | |
10 | 31728b11 | Iustin Pop | # This program is distributed in the hope that it will be useful, but |
11 | 31728b11 | Iustin Pop | # WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 31728b11 | Iustin Pop | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | 31728b11 | Iustin Pop | # General Public License for more details. |
14 | 31728b11 | Iustin Pop | |
15 | 31728b11 | Iustin Pop | # You should have received a copy of the GNU General Public License |
16 | 31728b11 | Iustin Pop | # along with this program; if not, write to the Free Software |
17 | 31728b11 | Iustin Pop | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 31728b11 | Iustin Pop | # 02110-1301, USA. |
19 | 31728b11 | Iustin Pop | |
20 | 31728b11 | Iustin Pop | # This is a live-testing script for most/all of the htools |
21 | 31728b11 | Iustin Pop | # programs. It needs either to run on a live cluster or access to a |
22 | 31728b11 | Iustin Pop | # cluster via ssh and an exported LUXI interface (via socat, for |
23 | 57df9cb3 | Iustin Pop | # example). The cluster must not be empty (otherwise the hail relocate |
24 | 57df9cb3 | Iustin Pop | # test will fail). |
25 | 31728b11 | Iustin Pop | |
26 | 31728b11 | Iustin Pop | # Use: if running on a cluster master, just running it should be |
27 | 31728b11 | Iustin Pop | # enough. If running remotely, set env vars as follows: LUXI to the |
28 | 31728b11 | Iustin Pop | # export unix socket, RAPI to the cluster IP, CLUSTER to the command |
29 | 1a3cc8ad | Iustin Pop | # used to login on the cluster (e.g. CLUSTER="ssh root@cluster"). Note |
30 | 1a3cc8ad | Iustin Pop | # that when run against a multi-group cluster, the GROUP variable |
31 | 1a3cc8ad | Iustin Pop | # should be set to one of the groups (some operations work only on one |
32 | 1a3cc8ad | Iustin Pop | # group) |
33 | 31728b11 | Iustin Pop | |
34 | 31728b11 | Iustin Pop | set -e |
35 | 31728b11 | Iustin Pop | : ${RAPI:=localhost} |
36 | 1a3cc8ad | Iustin Pop | GROUP=${GROUP:+-G $GROUP} |
37 | 1a3cc8ad | Iustin Pop | |
38 | 01c23d75 | Iustin Pop | . $(dirname $0)/cli-tests-defs.sh |
39 | 01c23d75 | Iustin Pop | |
40 | 31728b11 | Iustin Pop | T=`mktemp -d` |
41 | 31728b11 | Iustin Pop | trap 'rm -rf $T' EXIT |
42 | 31728b11 | Iustin Pop | echo Using $T as temporary dir |
43 | 31728b11 | Iustin Pop | |
44 | b880f1d1 | Iustin Pop | echo Checking command line |
45 | 01c23d75 | Iustin Pop | for prog in $ALL_ROLES; do |
46 | 01c23d75 | Iustin Pop | $prog --version |
47 | 01c23d75 | Iustin Pop | $prog --help >/dev/null |
48 | 01c23d75 | Iustin Pop | ! $prog --no-such-option 2>/dev/null |
49 | b880f1d1 | Iustin Pop | done |
50 | b880f1d1 | Iustin Pop | |
51 | b880f1d1 | Iustin Pop | echo Testing hscan/rapi |
52 | 01c23d75 | Iustin Pop | hscan -d$T $RAPI -p |
53 | b880f1d1 | Iustin Pop | echo Testing hscan/luxi |
54 | 01c23d75 | Iustin Pop | hscan -d$T -L$LUXI -p |
55 | b880f1d1 | Iustin Pop | echo Comparing hscan results... |
56 | b880f1d1 | Iustin Pop | diff -u $T/$RAPI.data $T/LOCAL.data |
57 | 31728b11 | Iustin Pop | |
58 | e4d8071d | Iustin Pop | FN=$($CLUSTER head -n1 /var/lib/ganeti/ssconf_node_list) |
59 | b7478ce1 | Iustin Pop | FI=$($CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list) |
60 | b7478ce1 | Iustin Pop | |
61 | b7478ce1 | Iustin Pop | |
62 | 31728b11 | Iustin Pop | echo Testing hbal/luxi |
63 | 01c23d75 | Iustin Pop | hbal -L$LUXI $GROUP -p --print-instances -C$T/hbal-luxi-cmds.sh |
64 | b880f1d1 | Iustin Pop | bash -n $T/hbal-luxi-cmds.sh |
65 | 31728b11 | Iustin Pop | echo Testing hbal/rapi |
66 | 01c23d75 | Iustin Pop | hbal -m$RAPI $GROUP -p --print-instances -C$T/hbal-rapi-cmds.sh |
67 | b880f1d1 | Iustin Pop | bash -n $T/hbal-rapi-cmds.sh |
68 | 31728b11 | Iustin Pop | echo Testing hbal/text |
69 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP -p --print-instances -C$T/hbal-text-cmds.sh |
70 | b880f1d1 | Iustin Pop | bash -n $T/hbal-text-cmds.sh |
71 | b7478ce1 | Iustin Pop | echo Comparing hbal results |
72 | b7478ce1 | Iustin Pop | diff -u $T/hbal-luxi-cmds.sh $T/hbal-rapi-cmds.sh |
73 | b7478ce1 | Iustin Pop | diff -u $T/hbal-luxi-cmds.sh $T/hbal-text-cmds.sh |
74 | b7478ce1 | Iustin Pop | |
75 | b880f1d1 | Iustin Pop | |
76 | b880f1d1 | Iustin Pop | echo Testing hbal/text with evacuation mode |
77 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP -E |
78 | b7478ce1 | Iustin Pop | echo Testing hbal/text with no disk moves |
79 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP --no-disk-moves |
80 | 9da4dc31 | Guido Trotter | echo Testing hbal/text with no instance moves |
81 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP --no-instance-moves |
82 | b880f1d1 | Iustin Pop | echo Testing hbal/text with offline node mode |
83 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP -O$FN |
84 | b7478ce1 | Iustin Pop | echo Testing hbal/text with utilization data |
85 | b7478ce1 | Iustin Pop | echo "$FI 2 2 2 2" > $T/util.data |
86 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP -U $T/util.data |
87 | b7478ce1 | Iustin Pop | echo Testing hbal/text with bad utilization data |
88 | b7478ce1 | Iustin Pop | echo "$FI 2 a 3b" > $T/util.data |
89 | 01c23d75 | Iustin Pop | ! hbal -t$T/$RAPI.data $GROUP -U $T/util.data |
90 | 9afa0de1 | Guido Trotter | echo Testing hbal/text with instance exclusion/selection |
91 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP --exclude-instances=$FI |
92 | 01c23d75 | Iustin Pop | hbal -t$T/$RAPI.data $GROUP --select-instances=$FI |
93 | 01c23d75 | Iustin Pop | ! hbal -t$T/$RAPI.data --exclude-instances=no_such_instance |
94 | 01c23d75 | Iustin Pop | ! hbal -t$T/$RAPI.data --select-instances=no_such_instance |
95 | b7478ce1 | Iustin Pop | echo Testing hbal/text with tag exclusion |
96 | 01c23d75 | Iustin Pop | hbal -t $T/$RAPI.data $GROUP --exclusion-tags=no_such_tag |
97 | b7478ce1 | Iustin Pop | echo Testing hbal multiple backend failure |
98 | 01c23d75 | Iustin Pop | ! hbal -t $T/$RAPI.data -L$LUXI |
99 | b7478ce1 | Iustin Pop | echo Testing hbal no backend failure |
100 | 01c23d75 | Iustin Pop | ! hbal |
101 | 31728b11 | Iustin Pop | |
102 | 31728b11 | Iustin Pop | echo Getting data files for hail |
103 | b880f1d1 | Iustin Pop | for dtemplate in plain drbd; do |
104 | b880f1d1 | Iustin Pop | $CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \ |
105 | b880f1d1 | Iustin Pop | --disks 128m -t $dtemplate -o no_such_os no_such_instance \ |
106 | b880f1d1 | Iustin Pop | > $T/h-alloc-$dtemplate.json |
107 | b880f1d1 | Iustin Pop | done |
108 | b880f1d1 | Iustin Pop | $CLUSTER gnt-debug allocator --dir in --mode relocate \ |
109 | b7478ce1 | Iustin Pop | -o no_such_os $FI > $T/h-reloc.json |
110 | b880f1d1 | Iustin Pop | $CLUSTER gnt-debug allocator --dir in --mode multi-evacuate \ |
111 | b880f1d1 | Iustin Pop | $FN > $T/h-evacuate.json |
112 | b880f1d1 | Iustin Pop | for dtemplate in plain drbd; do |
113 | b880f1d1 | Iustin Pop | echo Testing hail/allocate-$dtemplate |
114 | 01c23d75 | Iustin Pop | hail $T/h-alloc-$dtemplate.json |
115 | b880f1d1 | Iustin Pop | done |
116 | b7478ce1 | Iustin Pop | echo Testing hail/relocate for instance $FI |
117 | 01c23d75 | Iustin Pop | hail $T/h-reloc.json |
118 | b880f1d1 | Iustin Pop | echo Testing hail/evacuate for node $FN |
119 | 01c23d75 | Iustin Pop | hail $T/h-evacuate.json |
120 | 31728b11 | Iustin Pop | |
121 | 31728b11 | Iustin Pop | HOUT="$T/hspace.out" |
122 | 31728b11 | Iustin Pop | |
123 | 31728b11 | Iustin Pop | check_hspace_out() { |
124 | 01c23d75 | Iustin Pop | set -u |
125 | 01c23d75 | Iustin Pop | set -e |
126 | 01c23d75 | Iustin Pop | source "$HOUT" |
127 | 01c23d75 | Iustin Pop | echo ALLOC_INSTANCES=$HTS_ALLOC_INSTANCES |
128 | 01c23d75 | Iustin Pop | echo TSPEC=$HTS_TSPEC |
129 | 01c23d75 | Iustin Pop | echo OK=$HTS_OK |
130 | 31728b11 | Iustin Pop | } |
131 | 31728b11 | Iustin Pop | |
132 | 31728b11 | Iustin Pop | TIER="--tiered 102400,8192,2" |
133 | 1c78dbd2 | Iustin Pop | SIMU="--simu=preferred,10,6835937,32768,4" |
134 | 31728b11 | Iustin Pop | echo Testing hspace/luxi |
135 | 01c23d75 | Iustin Pop | hspace -L$LUXI $TIER -v > $HOUT |
136 | 31728b11 | Iustin Pop | ( check_hspace_out ) || exit 1 |
137 | 31728b11 | Iustin Pop | echo Testing hspace/rapi |
138 | 01c23d75 | Iustin Pop | hspace -m$RAPI $TIER -v > $HOUT |
139 | 31728b11 | Iustin Pop | ( check_hspace_out ) || exit 1 |
140 | 31728b11 | Iustin Pop | echo Testing hspace/text |
141 | 01c23d75 | Iustin Pop | hspace -t$T/$RAPI.data $TIER -v > $HOUT |
142 | 31728b11 | Iustin Pop | ( check_hspace_out ) || exit 1 |
143 | 31728b11 | Iustin Pop | echo Testing hspace/simu |
144 | 31728b11 | Iustin Pop | # ~6T disk space, 32G ram, 4 VCPUs |
145 | 01c23d75 | Iustin Pop | hspace $SIMU $TIER -v > $HOUT |
146 | 31728b11 | Iustin Pop | ( check_hspace_out ) || exit 1 |
147 | b7478ce1 | Iustin Pop | # Wrong tiered spec input |
148 | 01c23d75 | Iustin Pop | ! hspace $SIMU --tiered 1,2,3x |
149 | 01c23d75 | Iustin Pop | ! hspace $SIMU --tiered 1,2,x |
150 | 01c23d75 | Iustin Pop | ! hspace $SIMU --tiered 1,2 |
151 | b7478ce1 | Iustin Pop | # Wrong simu spec |
152 | 01c23d75 | Iustin Pop | ! hspace --simu=1,2,x |
153 | b7478ce1 | Iustin Pop | |
154 | 31728b11 | Iustin Pop | echo All OK |