debian/autodebtest
debian/tmp
debian/files
+xen/sed-readconfig
+xen/readconfig
programs = virt-chroot/adt-virt-chroot \
runner/adt-run
-install:
+all:
+ cd xen && $(MAKE)
+
+install-here:
$(INSTALL_DIRS) -d $(bindir) $(docdir) $(man1dir)
set -e; for f in $(programs); do \
$(INSTALL_PROGRAM) $$f $(bindir); \
test ! -f $$f.1 || $(INSTALL_DOC) $$f.1 $(man1dir); \
done
- cd xen && $(MAKE) install
$(INSTALL_DOC) CREDITS debian/changelog $(docdir)
+
+install: install-here
+ cd xen && $(MAKE) install
Depends: python2.4
Conflicts: autodebtest (<< 0.5.3)
Replaces: autodebtest (<< 0.5.3)
+Suggest: autopkgtest-xenlvm
Description: automatic as-installed testing for Debian packages
autopkgtest runs tests on binary packages. The tests are run on the
package as installed on a testbed system (which may be found via a
virtualisation or containment system). The tests are expected to be
supplied in the corresponding Debian source package. See adt-run(1)
and /usr/share/doc/autopkgtest.
- .
- Status: this release is still pretty much a proof of concept.
-Package: autopkgtest-xen
+Package: autopkgtest-xenlvm
Architecture: all
Depends: pbuilder, libadns1-bin, chiark-utils-bin, iproute
+Suggest: autopkgtest
+Description: Xen/LVM2 based testbed snapshot system
+ Machinery for setting up a Xen domain which can be resumed over and
+ over again, discarding changes made each time. This can be useful
+ for automated testing and other advanced techniques; autopkgtest is
+ able to make use of this machinery for its virtualisation needs.
+ .
+ You will need a working Xen setup to make use of this software. Your
+ network administrator will need to provide support for the testbeds'
+ networking requirements. See the README for details
# installed as /usr/share/doc/autopkgtest/CREDITS).
p=autopkgtest
+px=autopkgtext-xenlvm
-build build-arch build-indep:
+build build-indep:
+ $(MAKE)
+
+build-arch:
binary-arch:
binary binary-indep: checkdir
dh_clean
dh_installdirs usr
- $(MAKE) install prefix=debian/$p/usr
+ $(MAKE) install-here prefix=debian/$p/usr
+ $(MAKE) -C xen install \
+ prefix=debian/$(px)/usr \
+ etc=debian/$(px)/etc cfg_suffix=''
cat CREDITS debian/copyright.suffix \
>debian/$p/usr/share/doc/$p/copyright
mandir = $(share)/man
man1dir = $(mandir)/man1
docdir = $(share)/doc/autopkgtest
+sharedir = $(share)/autopkgtest
+etcdir = /etc
+etcinitddir = $(etcdir)/init.d
+xenscripts = $(etcdir)/xen/scripts
+cfg_suffix = .dist
INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
INSTALL_PROGRAM = $(INSTALL) -m 0755
INSTALL_DOC = $(INSTALL)
-
include ../settings.make
-install:
-
+programs = cleanup setup on-testbed with-testbed
+shareprograms = fixups fixups-inside
+sharefiles = readconfig
- $(INSTALL_DIRS) -d $(bindir) $(docdir) $(man1dir)
+exec_prefix = adt-xenlvm-
+
+install: all
+ $(INSTALL_DIRS) -d $(bindir) $(docdir) $(man1dir) \
+ $(sharedir) $(etcinitdddir) $(xenscripts)
+ set -e; for f in $(programs) $(shareprograms); do \
+ $(INSTALL_PROGRAM) $$f $(sharedir); \
+ done
set -e; for f in $(programs); do \
- $(INSTALL_PROGRAM) $$f $(bindir); \
- test ! -f $$f.1 || $(INSTALL_DOC) $$f.1 $(man1dir); \
+ ln -s $(sharedir)/$$f $(bindir)/$(exec_prefix)$$f; \
+ test ! -f $$f.1 || $(INSTALL_DOC) $$f.1 \
+ $(man1dir)/$(exec_prefix)$$f; \
+ done
+ set -e; for f in $(sharefiles); do \
+ $(INSTALL_DATA) $$f $(sharedir); \
done
- cd xen && $(MAKE) install
- $(INSTALL_DOC) CREDITS debian/changelog $(docdir)
+ $(INSTALL_DATA) initscript $(etcinitddir)/adtxenlvm$(cfg_suffix)
+ $(INSTALL_DATA) vif-route-adt $(xenscripts)/vif-route-adt$(cfg_suffix)
+
+all: readconfig
+
+readconfig: sed-readconfig readconfig.in
+ sed -f $^ >$@.new && mv -f $@.new $@
+
+sed-readconfig: README Makefile
+ echo '/@@varlist@@/{h' >$@.new
+ sed -n 's,^adt_\([_0-9a-z]*\)[ ].*,s/\\*/\1/p;g,p' <$< >>$@.new
+ echo 'd}' >>$@.new && mv -f $@.new $@
not possible to use DHCP for IP address allocation for the
testbed.
+---------- Firewall policy items ----------
+
+adt_fw_localmirrors <none>
+ List of IP addresses of local mirrors, to which the
+ testbed should allowed to make HTTP requests.
+
+adt_fw_testbedclients <host_ipaddr>
+ List of IP addresses of hosts which will be allowed to make
+ connections into the testbed system.
+
+adt_fw_prohibnets 192.168.0.0/24 172.16.0.0/12 10.0.0.0/8
+ List of network ranges with which the testbed will be
+ prohibited from communicating, notwithstanding
+ allowglobalports.
+
+adt_fw_allowglobalports 80
+ List of ports to which the testbed will be allowed to make
+ outgoing connections.
+
---------- Items that are likely to need attention ----------
adt_kernel the booted kernel file /boot/xen*`uname -r`
adt_lvm_vg the system's LVM volume group if there is only one
LVM volume group to create base filesystem image in.
+adt_pbuilder_args <none>
+ Extra arguments to pass to pbuilder.
+
+---------- Tuning parameters ----------
+
adt_fs_type ext3
adt_fs_mkfs_args <none>
Filesystem type and any additional arguments to mkfs. If
it is not possible to pass whitespace-containing arguments to
mkfs.
-adt_pbuilder_args <none>
- Extra arguments to pass to pbuilder.
-
----------- Tuning parameters ----------
-
adt_testbed_ram 256 [Mby]
Physical RAM allocated for each testbed instance while
creating and running.
it will be separated by other parts by underscores `_', so
they should be avoided.
+adt_guest_macaddr 00:16:3e:7c:aa:7f
+adt_net_vifscript /etc/xen/scripts/vif-route-adt
---------- Items which should not usually need to be changed ----------
#!/bin/bash
set -e
-. ./config
+. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
mkdir -p $adt_play $snap
+++ /dev/null
-#----------
-# must install
-# autopkgtest pbuilder libadns1-bin chiark-utils-bin
-#
-# /etc/xen/scripts/vif-route-adt
-# /etc/default/adt-xen
-# /etc/init.d/adt-xen and links
-#----------
+++ /dev/null
-adt_nominum=${adt_nominum}
-adt_testbed_ram=256
-adt_freeze_ram=32
-adt_fs_size=1G
-adt_fs_snapsize=100M
-adt_fs_cowchunk=8
-adt_playbase=/var/lib/autopkgtest/xenlvm
-adt_fs_type=ext3
-adt_fs_mkfs_args=''
-adt_vm_reduce_retries=10
-adt_ssh_keytype=dsa
+++ /dev/null
-LOCAL_MIRROR_IPS='172.18.45.6'
-LOCAL_CLIENT_IPS='172.18.45.97 172.18.45.6'
-LOCAL_NETWORKS='192.168.0.0/24 172.16.0.0/12 10.0.0.0/8'
-ALLOW_GLOBAL_HTTP=y
\ No newline at end of file
adt_pbuilder_args='--mirror http://mirror.relativity.greenend.org.uk/mirror/ubuntu.early'
adt_guests_domain=.relativity.greenend.org.uk
adt_host_hostname=samual.relativity.greenend.org.uk
+
+adt_fw_localmirrors=172.18.45.6
+adt_fw_testbedclients='172.18.45.97 172.18.45.6'
#!/bin/sh
-
set -e
-
+. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
default=/etc/default/adt-xen
main=AdtXenFwd
-for i in $LOCAL_MIRROR_IPS; do
+for i in $adt_fw_localmirrors; do
iptables -A $main -d $i -j ACCEPT -p tcp --dport 80
iptables -A $main -d $i -j AdtXenIcmp -p icmp
done
fi
done
-for i in $LOCAL_CLIENT_IPS; do
+for i in $adt_fw_testbedclients; do
iptables -A $main -d $i -j ACCEPT -p tcp ! --syn
iptables -A $main -d $i -j AdtXenIcmp -p icmp
done
-for i in $LOCAL_NETWORKS; do
+for i in $adt_fw_prohibnets; do
iptables -A $main -d $i -j REJECT --reject-with icmp-net-prohibited
done
-case "$ALLOW_GLOBAL_HTTP" in
-y*|1*|t*)
- iptables -A $main -p tcp --dport 80 -j ACCEPT
+if [ x"$adt_fw_allowglobalports" != x ]; then
iptables -A $main -p icmp -j AdtXenIcmp
- ;;
-esac
+fi
+for port in $adt_fw_allowglobalports; do
+ iptables -A $main -p tcp --dport $port -j ACCEPT
+done
if test -f $default-rules; then
. $default-rules
#!/bin/sh
set -e
-. ./config
+. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
ssh -i $adt_sshkey $adt_guest_ipaddr "$@"
+++ /dev/null
-# This bash script is sourced by the various tools to set the
-# adt_... variables.
-
-fail () {
- echo >&2 "xenlvm: ${0##*/}: error: $*"
- exit 16
-}
-
-cmdline_args () {
- while [ $# -gt 0 ]; do
- arg="$1"
- case "$arg" in
- --*=*)
- value="${arg#*=}"
-
- var=${arg%%=*}
- var=${var#--}
- case "$var" in
- *-*) var="$(printf "%s" "$var" | tr -- - _)" ;;
- esac
- var=${var#adt_}
-
- case $var in
- *) ;; # @@varlist@@
- *) fail "unknown configuration variable \`$var'" ;;
- esac
-
- eval "$var=\"\$value\""
- shift ;;
-
- --) break ;;
- -*) fail "unknown option \`$arg'" ;;
- *) shift; break ;;
- esac
- done
- test $# = 0 || fail "non-option arguments not allowed"
-}
-
-. $ADT_XENLVM_SHARE/config-default
-cmdline_args
-. ${adt_config}
-
-.
-
-
-lvm_baselv_namerhs=${adt_vg}/${adt_lvm_baselv}
-lvm_baselv_namepath=/dev/${adt_lvbaserhs}
-
-lvm_cowdata_namerhs:=${adt_vg}/${adt_lvm_cowdatalv}
-adt_cowdata_namepath:=/dev/${lvm_cowdata_namerhs}
-
-lvm_snapdev=/dev/mapper/${adt_devmapper_cowdev}
-
-lvm_fslink_ptrrhs=${adt_fslink_dir}/${adt_fslink_name}
-lvm_fslink_dirpath=/dev/${adt_fslink_dir}
-lvm_fslink_ptr=/dev/${lvm_fslink_dir}/${adt_fslink_name}
+# This bash script is sourced by the various tools to set the
+# adt_... variables and some other useful ones.
+
+#---------- useful general functions ----------
+
+fail () {
+ echo >&2 "xenlvm: ${0##*/}: error: $*"
+ exit 16
+}
+
+#---------- default values for simple settings ----------
+
+adt_nominum=adt
+adt_testbed_ram=256
+adt_freeze_ram=32
+adt_fs_size=1G
+adt_fs_snapsize=100M
+adt_fs_cowchunk=8
+adt_playbase=/var/lib/autopkgtest/xenlvm
+adt_fs_type=ext3
+adt_fs_mkfs_args=''
+adt_vm_reduce_retries=10
+adt_ssh_keytype=dsa
+
+adt_fw_localmirrors=''
+adt_fw_prohibnets='192.168.0.0/24 172.16.0.0/12 10.0.0.0/8'
+adt_fw_allowglobalports='80'
+
+adt_guest_macaddr=00:16:3e:7c:aa:7f
+adt_net_vifscript=/etc/xen/scripts/vif-route-adt
+
+#---------- arguments and config file ----------
+
+cmdline_args () {
+ while [ $# -gt 0 ]; do
+ arg="$1"
+ case "$arg" in
+ --*=*)
+ value="${arg#*=}"
+
+ var=${arg%%=*}
+ var=${var#--}
+ case "$var" in
+ *-*) var="$(printf "%s" "$var" | tr -- - _)" ;;
+ esac
+ var=${var#adt_}
+
+ case $var in
+ *) ;; # @@varlist@@
+ *) fail "unknown configuration variable \`$var'" ;;
+ esac
+
+ eval "$var=\"\$value\""
+ shift ;;
+
+ --) break ;;
+ -*) fail "unknown option \`$arg'" ;;
+ *) shift; break ;;
+ esac
+ done
+ test $# = 0 || fail "non-option arguments not allowed"
+}
+
+cmdline_args
+. ${adt_config}
+cmdline_args
+
+#---------- calculated defaults for complex settings ----------
+
case "$adt_lvm_vg" in
'')
echo "searching for default volume group ..."
: ${adt_fslink_dir:=adt-xenlvm}
: ${adt_fslink_name:=${adt_nominum}_${adt_distro}_fs}
+
+# Firewall
+: ${adt_fw_testbedclients:=${adt_host_ipaddr}}
+
+lvm_baselv_namerhs=${adt_vg}/${adt_lvm_baselv}
+lvm_baselv_namepath=/dev/${adt_lvbaserhs}
+
+lvm_cowdata_namerhs:=${adt_vg}/${adt_lvm_cowdatalv}
+lvm_cowdata_namepath:=/dev/${lvm_cowdata_namerhs}
+
+lvm_snapdev=/dev/mapper/${adt_devmapper_cowdev}
+
+lvm_fslink_ptrrhs=${adt_fslink_dir}/${adt_fslink_name}
+lvm_fslink_dirpath=/dev/${adt_fslink_dir}
+lvm_fslink_ptr=/dev/${lvm_fslink_dir}/${adt_fslink_name}
root = "/dev/hda1"
extra = "ro console=tty0"
disk = [ "phy:$lvm_fslink_ptrrhs,hda1,w" ]
-vif = [ "bridge=none,mac=00:16:3e:7c:aa:7f,ip=$adt_guest_ipaddr,script=/etc/xen/scripts/vif-route-adt" ]
+vif = [ "bridge=none,mac=$adt_guest_macaddr,ip=${adt_guest_ipaddr},script=${adt_net_vifscript}" ]
on_crash = "preserve"
on_reboot = "preserve"
on_shutdown = "preserve"
# this script).
#============================================================================
-exec 2>>/var/log/xen-hotplug.log
-set -x
case $0 in */*) dir=${0%/*};; *) dir=.;; esac
. "$dir/vif-common.sh"
main_ip=$(dom0_ip)
+mac=$(xenstore_read "$XENBUS_PATH/mac")
case "$command" in
online)
ifconfig ${vif} ${main_ip} netmask 255.255.255.255 \
broadcast ${main_ip} up
ip -f inet6 addr delete dev ${vif} local fe80::fcff:ffff:feff:ffff/64
- ip -f inet neigh add \
- to 172.18.45.66 \
- dev ${vif} \
- lladdr 00:16:3e:7c:aa:7f \
- nud permanent
- arp -i ${vif} -s 172.18.45.66 00:16:3e:7c:aa:7f pub
- ipcmd='a'
+ ipcmd='add'
iptcmd='-A'
+ cmdprefix=''
+ add_only=''
;;
offline)
ifdown ${vif}
- ipcmd='d'
+ ipcmd='del'
iptcmd='-D'
+ cmdprefix='do_without_error'
+ add_only=:
;;
esac
-iptables "$iptcmd" INPUT -i "$vif" -j AdtXenIn
-iptables "$iptcmd" FORWARD -i "$vif" -j AdtXenFwd
-
if [ "${ip}" ] ; then
# If we've been given a list of IP addresses, then add routes from dom0 to
# the guest using those addresses.
for addr in ${ip} ; do
- ip r ${ipcmd} ${addr} dev ${vif} src ${main_ip}
+ ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
+ ${add_only} ip -f inet neigh add to ${addr} dev ${vif} lladdr ${mac} nud permanent
+ ${add_only} arp -i ${vif} -s ${addr} ${mac} pub
done
fi
-#S log debug "Successful vif-route $command for $vif."
+iptables "$iptcmd" INPUT -i "$vif" -j AdtXenIn
+iptables "$iptcmd" FORWARD -i "$vif" -j AdtXenFwd
+
+log debug "Successful vif-route $command for $vif."
if [ "$command" == "online" ]
then
success
+++ /dev/null
-#!/bin/sh
-#============================================================================
-# /etc/xen/vif-route
-#
-# Script for configuring a vif in routed mode.
-# The hotplugging system will call this script if it is specified either in
-# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then vif-bridge is the default.
-#
-# Usage:
-# vif-route (add|remove|online|offline)
-#
-# Environment vars:
-# vif vif interface name (required).
-# XENBUS_PATH path to this device's details in the XenStore (required).
-#
-# Read from the store:
-# ip list of IP networks for the vif, space-separated (default given in
-# this script).
-#============================================================================
-
-exec >/root/u 2>&1
-set -x
-date
-
-dir=$(dirname "$0")
-. "$dir/vif-common.sh"
-
-main_ip=$(dom0_ip)
-
-case "$command" in
- online)
- ifconfig ${vif} ${main_ip} netmask 255.255.255.255 \
- broadcast ${main_ip} up
- ipcmd='a'
- ;;
- offline)
- ifdown ${vif}
- ipcmd='d'
- ;;
-esac
-
-if [ "${ip}" ] ; then
- # If we've been given a list of IP addresses, then add routes from dom0 to
- # the guest using those addresses.
- for addr in ${ip} ; do
- ip r ${ipcmd} ${addr} dev ${vif} src ${main_ip}
- done
-fi
-
-handle_iptable
-
-date >/root/t
-
-iptable
-
-log debug "Successful vif-route $command for $vif."
-if [ "$command" == "online" ]
-then
- success
-fi
trap 'exit 127' 0
-. ./config
-./cleanup
+. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
+${ADT_XENLVM_SHARE}/cleanup
modprobe dm-snapshot ||:
-#dd if=/dev/zero of=/dev/$lvm_cowdata_namepath bs=512 count=$adt_fs_cowchunk status=noxfer
-
bdsize=$(blockdev --getsize $adt_lvm_baselv)
dmsetup create $adt_devmapper_cowdev <<END
0 $bdsize snapshot $adt_lvm_baselv $lvm_cowdata_namepath n $adt_fs_cowchunk
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-cd /lib
-
-eachfile () {
- find -type f | sh -ec "while read f; do
- $1
- done"
-}
-
-case "$#.$1" in
-1.'do')
- mkdir -p tls-aside
- cd tls
- find -type d -exec sh -c 'mkdir -p /lib/tls-aside/$1' x '{}' \;
- eachfile 'dpkg-divert --add --divert "/lib/tls-aside/$f" "/lib/tls/$f"'
- eachfile 'mv "/lib/tls/$f" "/lib/tls-aside/$f"'
- chattr +i .
- echo 'xen libc workaround enabled, diversions installed:
- tls disabled, libc upgrade may be troubled'
- ;;
-1.'undo')
- chattr -i tls
- if test -d tls-aside; then
- cd tls-aside
- eachfile 'mv "/lib/tls-aside/$f" "/lib/tls/$f"'
- cd ..
- rmdir tls-aside
- fi
- dpkg-divert --list | perl -ne '
- next unless
- s,^local diversion of (/lib/tls/),dpkg-divert --remove $1,;
- next unless s, to /lib/tls-aside/\S+$,,;
- print or die $!;
- ' | sh -e
- echo 'xen libc workaround disabled, normal status restored:
- tls enabled, libc upgrade definitely possible'
- ;;
-*)
- echo >&1 "usage: $0 do|undo"
-esac
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-cd /lib
-
-eachfile () {
- find -type f | sh -ec "while read f; do
- $1
- done"
-}
-
-case "$#.$1" in
-1.'do')
- mkdir -p tls-aside
- cd tls
- find -type d -exec sh -c 'mkdir -p /lib/tls-aside/$1' x '{}' \;
- eachfile 'dpkg-divert --add --divert "/lib/tls-aside/$f" "/lib/tls/$f"'
- eachfile 'mv "/lib/tls/$f" "/lib/tls-aside/$f"'
- chattr +i .
- echo 'xen libc workaround enabled, diversions installed:
- tls disabled, libc upgrade may be troubled'
- ;;
-1.'undo')
- chattr -i tls
- if test -d tls-aside; then
- cd tls-aside
- eachfile 'mv "/lib/tls-aside/$f" "/lib/tls/$f"'
- cd ..
- rmdir tls-aside
- fi
- dpkg-divert --list | perl -ne '
- next unless
- s,^local diversion of (/lib/tls/),dpkg-divert --remove $1,;
- next unless s, to /lib/tls-aside/\S+$,,;
- print or die $!;
- ' | sh -e
- echo 'xen libc workaround disabled, normal status restored:
- tls enabled, libc upgrade definitely possible'
- ;;
-*)
- echo >&1 "usage: $0 do|undo"
-esac
-
-exit 0
+++ /dev/null
-kernel = "/boot/boot/vmlinuz-2.6-xen"
-memory = 128
-root = "/dev/hda1"
-extra = "ro console=tty0"
-disk = [ "phy:glalonde/adt_dapper_base,hda1,w" ]
-vif = [ "bridge=none,mac=00:16:3e:7c:aa:7f,ip=172.18.45.65,script=/etc/xen/scripts/vif-route-adt" ]
-on_crash = "preserve"
-on_reboot = "preserve"
-on_shutdown = "preserve"