Use qemu/KVM virtualization instead of UML

Guest and network configuration is setup using the libvirt
virtualization API. The [start|stop]_testing scripts have been updated
accordingly.

qemu/KVM does not currently support a hostfs, so the shared build tree
mount has been dropped for now.
This commit is contained in:
Reto Buerki
2013-01-17 16:54:52 +01:00
committed by Tobias Brunner
parent f9df3d06b5
commit 9b3316ed27
21 changed files with 568 additions and 408 deletions
+59
View File
@@ -0,0 +1,59 @@
<domain type='kvm'>
<name>alice</name>
<uuid>1f35c25d-6a7b-4ee1-2461-d7e530e7b2a9</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/alice.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<interface type='network'>
<mac address='52:54:00:9a:e2:de'/>
<source network='vnet2'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+62
View File
@@ -0,0 +1,62 @@
<domain type='kvm'>
<name>bob</name>
<uuid>72728516-377f-f5be-ea1d-b1f1e851538f</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/bob.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:40:85:6b'/>
<source network='vnet3'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+62
View File
@@ -0,0 +1,62 @@
<domain type='kvm'>
<name>carol</name>
<uuid>6bc2eef5-7faf-cde0-5f27-6fc29f93bc3d</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/carol.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:ae:f1:f8'/>
<source network='vnet1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+62
View File
@@ -0,0 +1,62 @@
<domain type='kvm'>
<name>dave</name>
<uuid>05f1debe-4e38-4f3d-10a0-c07fbb70d816</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/dave.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:b9:15:a9'/>
<source network='vnet1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+65
View File
@@ -0,0 +1,65 @@
<domain type='kvm'>
<name>moon</name>
<uuid>b5e00ad3-1c81-3b2a-7f66-cdf8727b3c65</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/moon.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<interface type='network'>
<mac address='52:54:00:43:e3:35'/>
<source network='vnet2'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<interface type='network'>
<mac address='52:54:00:c7:b8:b0'/>
<source network='vnet1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+65
View File
@@ -0,0 +1,65 @@
<domain type='kvm'>
<name>sun</name>
<uuid>35341843-346c-a63a-786b-9df0fd5e6264</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/sun.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<interface type='network'>
<mac address='52:54:00:77:43:ea'/>
<source network='vnet1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<interface type='network'>
<mac address='52:54:00:0f:97:db'/>
<source network='vnet3'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+59
View File
@@ -0,0 +1,59 @@
<domain type='kvm'>
<name>venus</name>
<uuid>f0838df9-7cc0-84f5-6c14-2d16ab002e8d</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/venus.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<interface type='network'>
<mac address='52:54:00:69:d3:80'/>
<source network='vnet2'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
+11
View File
@@ -0,0 +1,11 @@
<network>
<name>vnet1</name>
<uuid>1d6ac7c7-60d9-56c1-a7df-210d3d0cc6d1</uuid>
<forward dev='lo' mode='route'>
<interface dev='lo'/>
</forward>
<bridge name='virbr1' stp='on' delay='0' />
<mac address='52:54:00:97:F9:FD'/>
<ip address='192.168.0.254' netmask='255.255.255.0'>
</ip>
</network>
+11
View File
@@ -0,0 +1,11 @@
<network>
<name>vnet2</name>
<uuid>b5147a7d-e184-5c9e-3838-4621796ba95c</uuid>
<forward dev='lo' mode='route'>
<interface dev='lo'/>
</forward>
<bridge name='virbr2' stp='on' delay='0' />
<mac address='52:54:00:05:F3:34'/>
<ip address='10.1.0.254' netmask='255.255.0.0'>
</ip>
</network>
+11
View File
@@ -0,0 +1,11 @@
<network>
<name>vnet3</name>
<uuid>5c537abc-c116-90e9-a0ef-886340d4c356</uuid>
<forward dev='lo' mode='route'>
<interface dev='lo'/>
</forward>
<bridge name='virbr3' stp='on' delay='0' />
<mac address='52:54:00:62:4C:69'/>
<ip address='10.2.0.254' netmask='255.255.0.0'>
</ip>
</network>
+59
View File
@@ -0,0 +1,59 @@
<domain type='kvm'>
<name>winnetou</name>
<uuid>b1d3d2f7-e20b-ab95-277e-66d4cac33cc3</uuid>
<memory unit='KiB'>131072</memory>
<currentMemory unit='KiB'>131072</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.1'>hvm</type>
<kernel>/var/run/kvm-swan-kernel</kernel>
<cmdline>root=/dev/vda loglevel=1</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writethrough'/>
<source file='/var/lib/libvirt/images/winnetou.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<interface type='network'>
<mac address='52:54:00:4b:23:fa'/>
<source network='vnet1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
-14
View File
@@ -1,18 +1,4 @@
#!/bin/bash
# Create the strongSwan UML testing environment
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
. $PWD/scripts/function.sh
-5
View File
@@ -55,10 +55,5 @@ do
execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r"
done
log_action "Setting up shared build tree at /root/compile"
echo "" >> $LOOPDIR/etc/fstab
echo "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab
log_status 0
log_action "Removing /etc/resolv.conf"
execute "rm -f $LOOPDIR/etc/resolv.conf"
-32
View File
@@ -1,32 +0,0 @@
#!/bin/bash
# Install strongSwan from mounted strongswan-shared tree
#
# Copyright (C) 2006 Martin Willi
# Hochschule fuer Technik Rapperswil
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
. $PWD/scripts/function.sh
cecho "installing strongSwan from shared tree"
cecho-n " on: "
for host in $STRONGSWANHOSTS
do
eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
cecho-n "$host... "
ssh $HOSTLOGIN 'cd ~/strongswan-shared && make install' > /dev/null
done
cecho
-32
View File
@@ -1,32 +0,0 @@
#!/bin/bash
# Install strongSwan from mounted strongswan-shared tree
#
# Copyright (C) 2006 Martin Willi
# Hochschule fuer Technik Rapperswil
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
. $PWD/scripts/function.sh
cecho "shutting down"
cecho-n " "
for host in $STRONGSWANHOSTS
do
eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
cecho-n "$host... "
ssh $HOSTLOGIN 'shutdown now -h' > /dev/null
done
cecho
-64
View File
@@ -1,64 +0,0 @@
#!/bin/bash
# start the UML bridges in the kernel using the brctl command
#
# Copyright (C) 2009 Andreas Steffen
# HSR Hochschule fuer Technik Rapperswil
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
source $DIR/function.sh
# create umlbr1 and its taps
#
if [ `brctl show | grep umlbr1 | wc -l` -eq 1 ]
then
cecho " * Great, umlbr1 is already running!"
else
cecho-n " * Starting umlbr1 with taps.."
umlbr_add 1 10.1.0.254 255.255.0.0
umlbr_add_tap 1 alice
umlbr_add_tap 1 venus
umlbr_add_tap 1 moon
cgecho "done"
fi
# create umlbr0 and its taps
#
if [ `brctl show | grep umlbr0 | wc -l` -eq 1 ]
then
cecho " * Great, umlbr0 is already running!"
else
cecho-n " * Starting umlbr0 with taps.."
umlbr_add 0 192.168.0.254 255.255.255.0
umlbr_add_tap 0 alice
umlbr_add_tap 0 moon
umlbr_add_tap 0 carol
umlbr_add_tap 0 winnetou
umlbr_add_tap 0 dave
umlbr_add_tap 0 sun
cgecho "done"
fi
# create umlbr2 and its taps
#
if [ `brctl show | grep umlbr2 | wc -l` -eq 1 ]
then
cecho " * Great, umlbr2 is already running!"
else
cecho-n " * Starting umlbr2 with taps.."
umlbr_add 2 10.2.0.254 255.255.0.0
umlbr_add_tap 2 sun
umlbr_add_tap 2 bob
cgecho "done"
fi
-101
View File
@@ -1,101 +0,0 @@
#!/bin/bash
# starts the UML instances with a hidden screen
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
. $PWD/scripts/function.sh
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
BOOTING_HOSTS=""
count_max=12
count=0
for host in $HOSTS
do
up=0
if [ -d ~/.uml/${host} ]
then
pid=`cat ~/.uml/${host}/pid`
up=`ps up $pid | wc -l`
fi
if [ $up -eq 2 ]
then
cecho " * Great, ${host} is already running!"
else
rm -rf ~/.uml/${host}
BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
let "count_max += 12"
UMLHOSTFS=$BUILDDIR/root-fs/${host}.img
[ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found"
cecho-n " * Starting ${host}.."
eval setsid $UMLKERNEL umid=${host} ubda=$UMLHOSTFS \$SWITCH_${host} mem=${MEM}M con=null con1=xterm >>$LOGFILE 2>&1 &
cgecho "done"
fi
done
if [ -z "$BOOTING_HOSTS" ]
then
exit 0
fi
cecho " * Waiting for the uml instances to finish booting"
for host in $BOOTING_HOSTS
do
cecho-n " * Checking on $host.."
while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ]
do
cecho-n "."
sleep 5
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
fi
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
while [ $count -lt $count_max ] && [ $up -eq 0 ]
do
cecho-n "."
sleep 5
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
else
cgecho "up"
fi
done
cecho " * All uml instances are up now"
-49
View File
@@ -1,49 +0,0 @@
#!/bin/bash
# stop the UML bridges in the kernel using the brctl command
#
# Copyright (C) 2009 Andreas Steffen
# HSR Hochschule fuer Technik Rapperswil
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
source $DIR/function.sh
# stop umlbr1 and its taps
#
cecho-n " * Stopping umlbr1 with taps.."
umlbr_del_tap 1 alice
umlbr_del_tap 1 venus
umlbr_del_tap 1 moon
umlbr_del 1
cgecho "done"
# stop umlbr0 and its taps
#
cecho-n " * Stopping umlbr0 with taps.."
umlbr_del_tap 0 alice
umlbr_del_tap 0 moon
umlbr_del_tap 0 carol
umlbr_del_tap 0 winnetou
umlbr_del_tap 0 dave
umlbr_del_tap 0 sun
umlbr_del 0
cgecho "done"
# stop umlbr2 and its taps
#
cecho-n " * Stopping umlbr2 with taps.."
umlbr_del_tap 2 sun
umlbr_del_tap 2 bob
umlbr_del 2
cgecho "done"
+20 -36
View File
@@ -1,44 +1,28 @@
#!/bin/bash
# Start up the specified UML instances and wait for them to finish booting
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
. $PWD/scripts/function.sh
source $DIR/scripts/function.sh
NETWORKS="vnet1 vnet2 vnet3"
CONFDIR=$PWD/config/kvm
KNLSRC=$BUILDDIR/$KERNEL/arch/x86/boot/bzImage
KNLTARGET=/var/run/kvm-swan-kernel
[ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found"
[ -d $DIR/hosts ] || die "Directory hosts cannot be found."
echo "Starting test environment"
source $DIR/testing.conf
[ `id -u` -eq 0 ] || die "You must be root to run $0"
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
log_action "Deploying kernel $KERNEL"
execute "ln -fs $KNLSRC $KNLTARGET"
#####################################################
# start the uml bridges
#
cecho "Start the uml bridges (scripts/start-bridges)"
$DIR/scripts/start-bridges
for net in $NETWORKS
do
log_action "Network $net"
execute "virsh net-create $CONFDIR/$net.xml"
done
#####################################################
# start the uml instances
#
cecho "Start the uml instances (scripts/start-umls)"
$DIR/scripts/start-umls $HOSTS
for host in $STRONGSWANHOSTS
do
ln -fs $ROOTFSDIR/$host.img $VIRTIMGSTORE/$host.img
log_action "Guest $host"
execute "virsh create $CONFDIR/$host.xml"
done
+17 -37
View File
@@ -1,46 +1,26 @@
#!/bin/bash
# Stop all UML instances and UML switches
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
. $PWD/scripts/function.sh
source $DIR/scripts/function.sh
echo "Stopping test environment"
[ -f $DIR/testing.conf ] || die "No configuration file testing.conf found."
NETWORKS="vnet1 vnet2 vnet3"
KNLTARGET=/var/run/kvm-swan-kernel
source $DIR/testing.conf
[ `id -u` -eq 0 ] || die "You must be root to run $0"
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
#####################################################
# Shutting down the uml instances
#
cecho-n " * Halting all UML instances.."
for host in $HOSTS
for net in $NETWORKS
do
uml_mconsole $host halt &> /dev/null
log_action "Network $net"
execute "virsh net-destroy $net"
done
cgecho "done"
#####################################################
# Shutting down the uml bridhges
#
cecho "Stop the uml bridges (scripts/stop-bridges)"
$DIR/scripts/stop-bridges
for host in $STRONGSWANHOSTS
do
log_action "Guest $host"
execute "virsh destroy $host"
rm -f $VIRTIMGSTORE/$host.img
done
log_action "Removing kernel $KERNEL"
execute "rm $KNLTARGET"
+5 -38
View File
@@ -27,11 +27,6 @@ KERNELPATCH=ha-3.0.patch.bz2
# strongSwan version used in tests
SWANVERSION=5.0.2dr4
# Amount of Memory to use per UML [MB].
# If "auto" is stated 1/12 of total host ram will be used.
# Examples: MEM=64, MEM="128", MEM="auto"
MEM=96
# Directory where the UML kernels and file system will be built
BUILDDIR=$UMLTESTDIR/umlbuild
@@ -52,6 +47,9 @@ ROOTFSCOMPILEDIR=$BUILDDIR/compile
# Path to guest images
ROOTFSDIR=$BUILDDIR/root-fs
# libvirt config
VIRTIMGSTORE=/var/lib/libvirt/images
# Filename of the built UML Kernel
UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION
@@ -65,8 +63,7 @@ SSHCONF="-F $UMLTESTDIR/testing/ssh_config"
TZUML="Europe/Zurich"
##############################################################
# Enable particular steps in the make-testing and
# start-testing scripts
# Enable particular steps in the make-testing
#
ENABLE_BUILD_BASEIMAGE="yes"
ENABLE_BUILD_GUESTKERNEL="yes"
@@ -113,35 +110,5 @@ bob,fec2::10"
# VPN gateways / clients
# The hosts stated here will be created. Possible values
# are sun, moon, dave, carol, alice, venus, bob, winnetou.
# It's fine to make them all unless you don't have much
# resources. In this case we assume you know what you do!
#
STRONGSWANHOSTS="sun moon dave carol alice venus bob winnetou"
##############################################################
# Needed programs, do not change!
#
PROGRAMS="uml_switch uml_mconsole ssh ssh-keygen iptables \
chroot screen mkreiserfs"
##############################################################
# IP parameters of the UML switches
#
IFCONFIG_0="192.168.0.254 netmask 255.255.255.0"
IFCONFIG_1="10.1.0.254 netmask 255.255.0.0"
IFCONFIG_2="10.2.0.254 netmask 255.255.0.0"
##############################################################
# Network interfaces of the UML instances
#
SWITCH_alice="eth0=tuntap,tap1_alice,fe:fd:0a:01:00:0a \
eth1=tuntap,tap0_alice,fe:fd:c0:a8:00:32"
SWITCH_venus="eth0=tuntap,tap1_venus,fe:fd:0a:01:00:14"
SWITCH_moon="eth0=tuntap,tap0_moon,fe:fd:c0:a8:00:01 \
eth1=tuntap,tap1_moon,fe:fd:0a:01:00:01"
SWITCH_carol="eth0=tuntap,tap0_carol,fe:fd:c0:a8:00:64"
SWITCH_winnetou="eth0=tuntap,tap0_winnetou,fe:fd:c0:a8:00:96"
SWITCH_dave="eth0=tuntap,tap0_dave,fe:fd:c0:a8:00:c8"
SWITCH_sun="eth0=tuntap,tap0_sun,fe:fd:c0:a8:00:02 \
eth1=tuntap,tap2_sun,fe:fd:0a:02:00:01"
SWITCH_bob="eth0=tuntap,tap2_bob,fe:fd:0a:02:00:0a"
STRONGSWANHOSTS="alice bob carol dave moon sun venus winnetou"