+autopkgtest (0.6.0~0iwj-wip0) edgy; urgency=low
+
+ * Work-in-progress for Xen support.
+
+ -- Ian Jackson <iwj@ubuntu.com> Tue, 26 Sep 2006 18:05:50 +0100
+
autopkgtest (0.5.3) dapper; urgency=low
* Rename package autodebtest => autopkgtest.
--- /dev/null
+#!/bin/bash
+set -e
+. ./config
+
+mkdir -p $play $snap
+
+try () { "$@" >/dev/null 2>&1 ||:; }
+
+try xm destroy $xmname
+try umount $lvbase
+try dmsetup remove $nsnap
+rm -f $lvfsptr
--- /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
+#----------
+
+#kernel=/boot/boot/vmlinuz-2.6-xen
+kernel=/boot/xen0-linux-2.6.16-1-686
+ramdisk=/boot/xen-initrd
+
+tbmem=256
+frzmem=32
+fssize=1G
+snapsize=100M
+cowchunk=8
+
+vg=glalonde
+#distro=dapper
+distro=edgy
+pbuilderopts='--mirror http://mirror.relativity.greenend.org.uk/mirror/ubuntu.early'
+domain=adt.relativity.greenend.org.uk
+sshkey=/root/.ssh/id_dsa_adt
+
+pfx=adt
+guesthname=$distro.$domain
+playbase=/var/lib/autopkgtest/xenlvm-play
+#hosthname=`hostname -f`
+hosthname=samual.relativity.greenend.org.uk
+xmname=${pfx}_${distro}
+
+play=${playbase}/${distro}
+
+nbase=${pfx}_${distro}_base
+lvbaserhs=$vg/$nbase
+lvbase=/dev/$lvbaserhs
+
+nsnap=${pfx}_${distro}_snap
+lvsnap=/dev/mapper/$nsnap
+
+ncowdata=${pfx}_${distro}_cowdata
+lvcowdatarhs=$vg/$ncowdata
+lvcowdata=/dev/$lvcowdatarhs
+
+lvfsptrrhs=${pfx}_fs/${distro}
+lvfsptr=/dev/$lvfsptrrhs
+xmdomain=$play/xmdomain
+
+guestaddr=`adnshost -t a +Do +Dt +Dc $guesthname`
--- /dev/null
+#!/bin/sh
+set -ex
+
+dest=$1
+hosthname=$2
+guesthname=$3; shift
+
+hostaddr=`adnshost -t a +Do +Dt +Dc $hosthname`
+guestaddr=`adnshost -t a +Do +Dt +Dc $guesthname`
+
+echo '---fixups:'
+
+cp xen-divert-tls-libc \
+ fixups-inside \
+ $dest/root/
+
+mkdir -p $dest/lib/modules
+cp -a /lib/modules/`uname -r`/ $dest/lib/modules/.
+
+mkdir -p /root/.ssh
+id_dsa=/root/.ssh/id_dsa_adt
+test -f $id_dsa || ssh-keygen -t dsa -N '' -f $id_dsa
+mkdir -m 02700 -p $dest/root/.ssh
+cp $id_dsa.pub $dest/root/.ssh/authorized_keys
+
+cat <<END >$dest/etc/init.d/xenethtoolk
+#!/bin/sh
+case "$1" in
+start)
+ ethtool -K eth0 tx off
+ ethtool -K eth0 rx off
+ ;;
+esac
+END
+chmod +x $dest/etc/init.d/xenethtoolk
+ln -s ../init.d/xenethtoolk $dest/etc/rc2.d/S21xenethtoolk
+
+chroot $dest root/fixups-inside "$@" "$hostaddr" "$guestaddr"
+
+kh=/etc/ssh/ssh_known_hosts
+test ! -f $kh || cp $kh $kh.new
+exec 3>$kh.new
+pfx="$guesthname,$guestaddr"
+test ! -f $kh || perl -pe '$_="" if m/^(\S+)\s/ && $1 eq "'$pfx'";' $kh >&3
+for f in $dest/etc/ssh/ssh_host_*_key.pub; do
+ perl -pe '$_= "'$pfx' ".$_;' $f >&3
+done
+exec 3>&-
+mv $kh.new $kh
+
+echo '
+=== adt xen fixups done.
+'
--- /dev/null
+#!/bin/sh
+set -ex
+
+hosthname=$1
+guesthname=$2
+hostaddr=$3
+guestaddr=$4
+
+echo '(---'
+
+cd /root
+
+perl -i~ -pe 's/ main$/ main universe/ if m/^deb http/' /etc/apt/sources.list
+apt-get update
+
+apt-get -y --force-yes install libc6-xen || ./xen-divert-tls-libc do
+
+ldconfig
+
+cat >/etc/fstab <<END
+proc /proc proc defaults 0 0
+/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
+END
+
+mkdir -p /etc/network
+cat >/etc/network/interfaces <<END
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+ address $guestaddr
+ broadcast $guestaddr
+ netmask 255.255.255.255
+ pointopoint $hostaddr
+ gateway $hostaddr
+END
+
+echo $guesthname >/etc/hostname
+
+apt-get -y --force-yes install \
+ openssh-server ed build-essential
+
+perl -i~ -wne '
+ BEGIN {
+ $pep= PermitEmptyPasswords;
+ $want= "$pep no\n";
+ $done= 0;
+ }
+ if (m/^\s*$pep/oi) {
+ $_= $want;
+ $done= 1;
+ }
+ $o .= $_;
+ END {
+ print $want or die $! unless $done;
+ print $o or die $!;
+ }
+' /etc/ssh/sshd_config
+
+echo '---)'
--- /dev/null
+#!/bin/sh
+set -e
+. ./config
+ssh -i $sshkey $guestaddr "$@"
--- /dev/null
+# this is your configuration file for pbuilder.
+# the file in /usr/share/pbuilder/pbuilderrc is the default template.
+# /etc/pbuilderrc is the one meant for editing.
+#
+# read pbuilderrc.5 document for notes on specific options.
+
+BASETGZ=/var/cache/pbuilder/base.tgz
+#EXTRAPACKAGES=gcc3.0-athlon-builder
+#export DEBIAN_BUILDARCH=athlon
+BUILDPLACE=/var/cache/pbuilder/build/
+MIRRORSITE=http://ftp.jp.debian.org/debian
+#NONUSMIRRORSITE="http://ftp.jp.debian.org/debian-non-US"
+#OTHERMIRROR="deb http://www.home.com/updates/ ./"
+#export http_proxy=http://your-proxy:8080/
+USEPROC=yes
+USEDEVPTS=yes
+USEDEVFS=no
+BUILDRESULT=/var/cache/pbuilder/result/
+
+# specifying the distribution forces the distribution on "pbuilder update"
+#DISTRIBUTION=sarge
+#specify the cache for APT
+APTCACHE="/var/cache/pbuilder/aptcache/"
+APTCACHEHARDLINK="no"
+REMOVEPACKAGES="lilo"
+#HOOKDIR="/usr/lib/pbuilder/hooks"
+HOOKDIR=""
+
+# make debconf not interact with user
+export DEBIAN_FRONTEND="noninteractive"
+
+DEBEMAIL=""
+
+#for pbuilder debuild
+BUILDSOURCEROOTCMD="fakeroot"
+PBUILDERROOTCMD="sudo"
+
+#default is to build everything. Passed on to dpkg-buildpackage
+#DEBBUILDOPTS="-b"
+DEBBUILDOPTS=""
+
+#APT configuration files directory
+APTCONFDIR=""
+
+# the username and ID used by pbuilder, inside chroot. Needs fakeroot, really
+BUILDUSERID=1234
+BUILDUSERNAME=pbuilder
+
+# BINDMOUNTS is a space separated list of things to mount
+# inside the chroot.
+BINDMOUNTS=""
+
+# Set the debootstrap variant to 'buildd' type.
+# DEBOOTSTRAPOPTS[0]='--variant=buildd'
+# or work around bug in debootstrap 3.0.0 (314858)
+unset DEBOOTSTRAPOPTS
+
+# Set the PATH I am going to use inside pbuilder: default is "/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
+export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
+
+# SHELL variable is used inside pbuilder by commands like 'su'; and they need sane values
+export SHELL=/bin/bash
+
+# The name of debootstrap command.
+DEBOOTSTRAP="debootstrap"
--- /dev/null
+#!/bin/bash
+set -e
+. ./config
+./cleanup
+lvchange -a n $lvcowdata ||:
+lvremove $lvbase ||:
+lvremove $lvcowdata ||:
+
+lvcreate -L $fssize -n $lvbase $vg
+lvcreate -L $snapsize -n $ncowdata $vg
+#dd if=/dev/zero of=$lvbase
+mkfs -t ext3 $lvbase
+
+mkdir -p $play/base
+mount $lvbase $play/base
+
+#--basetgz $play/base.tgz --buildplace
+
+pbuilder create --configfile ./pbuilderrc --distribution $distro \
+ --no-targz --buildplace $play/base \
+ $pbuilderopts --debootstrapopts --variant=''
+
+./fixups $play/base $hosthname $guesthname
+
+echo "
+--- writing $xmdomain ---
+"
+
+hostaddr=`adnshost -t a +Do +Dt +Dc $hosthname`
+
+cat <<END >$xmdomain
+kernel = "$kernel"
+memory = $tbmem
+root = "/dev/hda1"
+extra = "ro console=tty0"
+disk = [ "phy:$lvfsptrrhs,hda1,w" ]
+vif = [ "bridge=none,mac=00:16:3e:7c:aa:7f,ip=$guestaddr,script=/etc/xen/scripts/vif-route-adt" ]
+on_crash = "preserve"
+on_reboot = "preserve"
+on_shutdown = "preserve"
+END
+
+if [ "x$ramdisk" != x ]; then
+cat <<END >>$xmdomain
+ramdisk = "$ramdisk"
+END
+fi
+
+umount $lvbase
+
+mkdir -p /dev/${pfx}_fs
+ln -sf ../$lvbaserhs $lvfsptr
+xm create $xmdomain name=$xmname
+retries=10
+
+while true; do
+ if ping -c 1 $guestaddr && ./on-testbed id; then break; fi
+ if [ $retries -le 0 ]; then
+ echo >&2 'no response from guest'
+ xm console $xmname
+ exit 1
+ fi
+ retries=$(($retries-1))
+ sleep 2
+done
+
+xm mem-set $xmname $frzmem
+retries=10
+while sleep 1; do
+ if xm mem-max $xmname $frzmem; then break; fi
+ if [ $retries -le 0 ]; then echo >&2 'cannot reduce memory'; exit 1; fi
+ retries=$(($retries-1))
+done
+
+xm save $xmname $play/xen-save
+rm $lvfsptr
--- /dev/null
+/etc/xen/scripts/vif-common.sh
\ No newline at end of file
--- /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
--- /dev/null
+#!/bin/bash
+set -e
+
+trap 'exit 127' 0
+
+. ./config
+./cleanup
+
+modprobe dm-snapshot ||:
+
+#dd if=/dev/zero of=/dev/$lvcowdata bs=512 count=$cowchunk status=noxfer
+
+bdsize=$(blockdev --getsize $lvbase)
+dmsetup create $nsnap <<END
+0 $bdsize snapshot $lvbase $lvcowdata n $cowchunk
+END
+
+mkdir -p /dev/${pfx}_fs
+ln -s $lvsnap $lvfsptr
+
+xm restore $play/xen-save
+xm mem-set $xmname $tbmem
+udevsettle
+
+set +e
+"$@"
+rc=$?
+set -e
+
+xm destroy $xmname
+dmsetup remove $nsnap
+
+trap '' 0
+exit $rc
--- /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"