aboutsummaryrefslogtreecommitdiffstats
path: root/testing/stop-testing
blob: 8abf5f223936558197cd143b58ac02a4d71d0970 (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
#!/bin/bash

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

echo "Stopping test environment"

NETWORKS="vnet1 vnet2 vnet3"
KNLTARGET=/var/run/kvm-swan-kernel
HOSTFSTARGET=/var/run/kvm-swan-hostfs
TESTRESULTSTARGET=/var/run/kvm-swan-testresults

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

check_commands virsh

for net in $NETWORKS
do
	log_action "Network $net"
	execute "virsh net-destroy $net"
done

for host in $STRONGSWANHOSTS
do
	log_action "Guest $host"
	execute "virsh shutdown $host"
	rm -f $VIRTIMGSTORE/$host.$IMGEXT
done

log_action "Removing kernel $KERNEL"
execute "rm $KNLTARGET"

log_action "Removing link to hostfs"
execute "rm $HOSTFSTARGET"

log_action "Removing link to testresults"
execute "rm $TESTRESULTSTARGET"