Small update to the Makefile
[ganeti-local] / live-test.sh
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 Testing hscan
38 ./hscan -d$T $RAPI
39
40 echo Testing hbal/luxi
41 ./hbal -L$LUXI
42 echo Testing hbal/rapi
43 ./hbal -m$RAPI
44 echo Testing hbal/text
45 ./hbal -t$T/$RAPI.data
46
47 echo Getting data files for hail
48 IR=`$CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list`
49 $CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \
50     --disks 128m -t drbd -o no_such_os no_such_instance \
51     > $T/h-alloc.json
52 $CLUSTER gnt-debug allocator --dir in --mode relocate --mem 128m \
53     --disks 128m -t drbd -o no_such_os $IR > $T/h-reloc.json
54 echo Testing hail/allocate
55 ./hail $T/h-alloc.json
56 echo Testing hail/relocate
57 ./hail $T/h-reloc.json
58
59 HOUT="$T/hspace.out"
60
61 check_hspace_out() {
62     set -u
63     set -e
64     source "$HOUT"
65     echo ALLOC_INSTANCES=$HTS_ALLOC_INSTANCES
66     echo TSPEC=$HTS_TSPEC
67     echo OK=$HTS_OK
68 }
69
70 TIER="--tiered 102400,8192,2"
71 echo Testing hspace/luxi
72 ./hspace -L$LUXI $TIER > $HOUT
73 ( check_hspace_out ) || exit 1
74 echo Testing hspace/rapi
75 ./hspace -m$RAPI $TIER > $HOUT
76 ( check_hspace_out ) || exit 1
77 echo Testing hspace/text
78 ./hspace -t$T/$RAPI.data $TIER > $HOUT
79 ( check_hspace_out ) || exit 1
80 echo Testing hspace/simu
81 # ~6T disk space, 32G ram, 4 VCPUs
82 ./hspace --simu=10,6835937,32768,4 $TIER > $HOUT
83 ( check_hspace_out ) || exit 1
84 echo All OK