Statistics
| Branch: | Tag: | Revision:

root / live-test.sh @ 691dcd2a

History | View | Annotate | Download (3.5 kB)

1 31728b11 Iustin Pop
#!/bin/bash
2 31728b11 Iustin Pop
3 31728b11 Iustin Pop
# Copyright (C) 2009 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 31728b11 Iustin Pop
# used to login on the cluster (e.g. CLUSTER="ssh root@cluster").
30 31728b11 Iustin Pop
31 31728b11 Iustin Pop
set -e
32 31728b11 Iustin Pop
: ${RAPI:=localhost}
33 31728b11 Iustin Pop
T=`mktemp -d`
34 31728b11 Iustin Pop
trap 'rm -rf $T' EXIT
35 31728b11 Iustin Pop
echo Using $T as temporary dir
36 31728b11 Iustin Pop
37 b880f1d1 Iustin Pop
echo Checking command line
38 b880f1d1 Iustin Pop
for prog in hscan hbal hail hspace; do
39 b880f1d1 Iustin Pop
    ./$prog --version
40 b880f1d1 Iustin Pop
    ./$prog --help
41 b880f1d1 Iustin Pop
done
42 b880f1d1 Iustin Pop
43 b880f1d1 Iustin Pop
echo Testing hscan/rapi
44 b880f1d1 Iustin Pop
./hscan -d$T $RAPI -p
45 b880f1d1 Iustin Pop
echo Testing hscan/luxi
46 b880f1d1 Iustin Pop
./hscan -d$T -L$LUXI -p
47 b880f1d1 Iustin Pop
echo Comparing hscan results...
48 b880f1d1 Iustin Pop
diff -u $T/$RAPI.data $T/LOCAL.data
49 31728b11 Iustin Pop
50 31728b11 Iustin Pop
echo Testing hbal/luxi
51 b880f1d1 Iustin Pop
./hbal -L$LUXI -p --print-instances -C$T/hbal-luxi-cmds.sh
52 b880f1d1 Iustin Pop
bash -n $T/hbal-luxi-cmds.sh
53 31728b11 Iustin Pop
echo Testing hbal/rapi
54 b880f1d1 Iustin Pop
./hbal -m$RAPI -p --print-instances -C$T/hbal-rapi-cmds.sh
55 b880f1d1 Iustin Pop
bash -n $T/hbal-rapi-cmds.sh
56 31728b11 Iustin Pop
echo Testing hbal/text
57 b880f1d1 Iustin Pop
./hbal -t$T/$RAPI.data -p --print-instances -C$T/hbal-text-cmds.sh
58 b880f1d1 Iustin Pop
bash -n $T/hbal-text-cmds.sh
59 b880f1d1 Iustin Pop
60 b880f1d1 Iustin Pop
echo Testing hbal/text with evacuation mode
61 b880f1d1 Iustin Pop
./hbal -t$T/$RAPI.data -E
62 b880f1d1 Iustin Pop
echo Testing hbal/text with offline node mode
63 b880f1d1 Iustin Pop
FN=$(head -n1 $T/$RAPI.data|cut -d \| -f1)
64 b880f1d1 Iustin Pop
./hbal -t$T/$RAPI.data -O$FN
65 31728b11 Iustin Pop
66 31728b11 Iustin Pop
echo Getting data files for hail
67 31728b11 Iustin Pop
IR=`$CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list`
68 b880f1d1 Iustin Pop
for dtemplate in plain drbd; do
69 b880f1d1 Iustin Pop
  $CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \
70 b880f1d1 Iustin Pop
      --disks 128m -t $dtemplate -o no_such_os no_such_instance \
71 b880f1d1 Iustin Pop
      > $T/h-alloc-$dtemplate.json
72 b880f1d1 Iustin Pop
done
73 b880f1d1 Iustin Pop
$CLUSTER gnt-debug allocator --dir in --mode relocate \
74 b880f1d1 Iustin Pop
    -o no_such_os $IR > $T/h-reloc.json
75 b880f1d1 Iustin Pop
$CLUSTER gnt-debug allocator --dir in --mode multi-evacuate \
76 b880f1d1 Iustin Pop
    $FN > $T/h-evacuate.json
77 b880f1d1 Iustin Pop
for dtemplate in plain drbd; do
78 b880f1d1 Iustin Pop
  echo Testing hail/allocate-$dtemplate
79 b880f1d1 Iustin Pop
  ./hail $T/h-alloc-$dtemplate.json
80 b880f1d1 Iustin Pop
done
81 b880f1d1 Iustin Pop
echo Testing hail/relocate for instance $IR
82 31728b11 Iustin Pop
./hail $T/h-reloc.json
83 b880f1d1 Iustin Pop
echo Testing hail/evacuate for node $FN
84 b880f1d1 Iustin Pop
./hail $T/h-evacuate.json
85 31728b11 Iustin Pop
86 31728b11 Iustin Pop
HOUT="$T/hspace.out"
87 31728b11 Iustin Pop
88 31728b11 Iustin Pop
check_hspace_out() {
89 31728b11 Iustin Pop
    set -u
90 31728b11 Iustin Pop
    set -e
91 31728b11 Iustin Pop
    source "$HOUT"
92 31728b11 Iustin Pop
    echo ALLOC_INSTANCES=$HTS_ALLOC_INSTANCES
93 31728b11 Iustin Pop
    echo TSPEC=$HTS_TSPEC
94 31728b11 Iustin Pop
    echo OK=$HTS_OK
95 31728b11 Iustin Pop
}
96 31728b11 Iustin Pop
97 31728b11 Iustin Pop
TIER="--tiered 102400,8192,2"
98 31728b11 Iustin Pop
echo Testing hspace/luxi
99 b880f1d1 Iustin Pop
./hspace -L$LUXI $TIER -v > $HOUT
100 31728b11 Iustin Pop
( check_hspace_out ) || exit 1
101 31728b11 Iustin Pop
echo Testing hspace/rapi
102 b880f1d1 Iustin Pop
./hspace -m$RAPI $TIER -v > $HOUT
103 31728b11 Iustin Pop
( check_hspace_out ) || exit 1
104 31728b11 Iustin Pop
echo Testing hspace/text
105 b880f1d1 Iustin Pop
./hspace -t$T/$RAPI.data $TIER -v > $HOUT
106 31728b11 Iustin Pop
( check_hspace_out ) || exit 1
107 31728b11 Iustin Pop
echo Testing hspace/simu
108 31728b11 Iustin Pop
# ~6T disk space, 32G ram, 4 VCPUs
109 b880f1d1 Iustin Pop
./hspace --simu=10,6835937,32768,4 $TIER -v > $HOUT
110 31728b11 Iustin Pop
( check_hspace_out ) || exit 1
111 31728b11 Iustin Pop
echo All OK