summaryrefslogtreecommitdiff
path: root/testing/start-testing
blob: 1837294233717bac9d10419bab08d9eed08473b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

DIR=$(dirname `readlink -f $0`)
. $DIR/testing.conf
. $DIR/scripts/function.sh

NETWORKS="vnet1 vnet2 vnet3"
CONFDIR=$DIR/config/kvm
KNLSRC=$BUILDDIR/$KERNEL/arch/x86/boot/bzImage
KNLTARGET=/var/run/kvm-swan-kernel
HOSTFSTARGET=/var/run/kvm-swan-hostfs
MCASTBRS="virbr1 virbr2"

echo "Starting test environment"

[ `id -u` -eq 0 ] || die "You must be root to run $0"

check_commands virsh

log_action "Deploying kernel $KERNEL"
execute "ln -fs $KNLSRC $KNLTARGET"

log_action "Deploying $SHAREDDIR as hostfs"
execute "chown -R $KVMUSER:$KVMGROUP $SHAREDDIR" 0
execute "ln -Tfs $SHAREDDIR $HOSTFSTARGET"

for net in $NETWORKS
do
	log_action "Network $net"
	execute "virsh net-create $CONFDIR/$net.xml"
done

for host in $STRONGSWANHOSTS
do
	ln -fs $IMGDIR/$host.$IMGEXT $VIRTIMGSTORE/$host.$IMGEXT
	log_action "Guest $host"
	execute "virsh create $CONFDIR/$host.xml"
done

# Enforce reception of multicast traffic on bridges
for br in $MCASTBRS
do
	cd /sys/devices/virtual/net/$br/brif
	for vnet in `find . -name "vnet*"`
	do
		echo 2 > $vnet/multicast_router
	done
done