Statistics
| Branch: | Tag: | Revision:

root / live-test.sh @ 691dcd2a

History | View | Annotate | Download (3.5 kB)

1
#!/bin/bash
2

    
3
# Copyright (C) 2009 Google Inc.
4

    
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9

    
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
# General Public License for more details.
14

    
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
# 02110-1301, USA.
19

    
20
# This is a live-testing script for most/all of the htools
21
# programs. It needs either to run on a live cluster or access to a
22
# cluster via ssh and an exported LUXI interface (via socat, for
23
# example). The cluster must not be empty (otherwise the hail relocate
24
# test will fail).
25

    
26
# Use: if running on a cluster master, just running it should be
27
# enough. If running remotely, set env vars as follows: LUXI to the
28
# export unix socket, RAPI to the cluster IP, CLUSTER to the command
29
# used to login on the cluster (e.g. CLUSTER="ssh root@cluster").
30

    
31
set -e
32
: ${RAPI:=localhost}
33
T=`mktemp -d`
34
trap 'rm -rf $T' EXIT
35
echo Using $T as temporary dir
36

    
37
echo Checking command line
38
for prog in hscan hbal hail hspace; do
39
    ./$prog --version
40
    ./$prog --help
41
done
42

    
43
echo Testing hscan/rapi
44
./hscan -d$T $RAPI -p
45
echo Testing hscan/luxi
46
./hscan -d$T -L$LUXI -p
47
echo Comparing hscan results...
48
diff -u $T/$RAPI.data $T/LOCAL.data
49

    
50
echo Testing hbal/luxi
51
./hbal -L$LUXI -p --print-instances -C$T/hbal-luxi-cmds.sh
52
bash -n $T/hbal-luxi-cmds.sh
53
echo Testing hbal/rapi
54
./hbal -m$RAPI -p --print-instances -C$T/hbal-rapi-cmds.sh
55
bash -n $T/hbal-rapi-cmds.sh
56
echo Testing hbal/text
57
./hbal -t$T/$RAPI.data -p --print-instances -C$T/hbal-text-cmds.sh
58
bash -n $T/hbal-text-cmds.sh
59

    
60
echo Testing hbal/text with evacuation mode
61
./hbal -t$T/$RAPI.data -E
62
echo Testing hbal/text with offline node mode
63
FN=$(head -n1 $T/$RAPI.data|cut -d \| -f1)
64
./hbal -t$T/$RAPI.data -O$FN
65

    
66
echo Getting data files for hail
67
IR=`$CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list`
68
for dtemplate in plain drbd; do
69
  $CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \
70
      --disks 128m -t $dtemplate -o no_such_os no_such_instance \
71
      > $T/h-alloc-$dtemplate.json
72
done
73
$CLUSTER gnt-debug allocator --dir in --mode relocate \
74
    -o no_such_os $IR > $T/h-reloc.json
75
$CLUSTER gnt-debug allocator --dir in --mode multi-evacuate \
76
    $FN > $T/h-evacuate.json
77
for dtemplate in plain drbd; do
78
  echo Testing hail/allocate-$dtemplate
79
  ./hail $T/h-alloc-$dtemplate.json
80
done
81
echo Testing hail/relocate for instance $IR
82
./hail $T/h-reloc.json
83
echo Testing hail/evacuate for node $FN
84
./hail $T/h-evacuate.json
85

    
86
HOUT="$T/hspace.out"
87

    
88
check_hspace_out() {
89
    set -u
90
    set -e
91
    source "$HOUT"
92
    echo ALLOC_INSTANCES=$HTS_ALLOC_INSTANCES
93
    echo TSPEC=$HTS_TSPEC
94
    echo OK=$HTS_OK
95
}
96

    
97
TIER="--tiered 102400,8192,2"
98
echo Testing hspace/luxi
99
./hspace -L$LUXI $TIER -v > $HOUT
100
( check_hspace_out ) || exit 1
101
echo Testing hspace/rapi
102
./hspace -m$RAPI $TIER -v > $HOUT
103
( check_hspace_out ) || exit 1
104
echo Testing hspace/text
105
./hspace -t$T/$RAPI.data $TIER -v > $HOUT
106
( check_hspace_out ) || exit 1
107
echo Testing hspace/simu
108
# ~6T disk space, 32G ram, 4 VCPUs
109
./hspace --simu=10,6835937,32768,4 $TIER -v > $HOUT
110
( check_hspace_out ) || exit 1
111
echo All OK