-autopkgtest (0.9.2) unstable; urgency=low
+autopkgtest (1.0.0~) unstable; urgency=low
+
+ * Locking: <play>.lock (unlinkable fcntl style) plus <play>/good
+ sentinel file. This will avoid conflicts between simultaneous calls
+ to with-testbed and setup (and others). The `with' mode of the userv
+ target is enhanced so that the caller can take out the lock and hold
+ it will starting and discarding the testbed more than once.
+
+ -- Ian Jackson <ian@davenant.greenend.org.uk> Thu, 12 Jul 2007 15:01:35 +0100
+
+autopkgtest (0.9.2~) unstable; urgency=low
* Really discard stderr from our ought-to-be-unnecessary
modprobe dm-snapshot.
- --
+ -- Ian Jackson <ian@davenant.greenend.org.uk> Thu, 12 Jul 2007 14:31:20 +0100
autopkgtest (0.9.1) gutsy; urgency=low
either hyphens or underscores.) Also, `--' may be used to indicate the
end of the config vars.
-Note that there is NO LOCKING. If you run more than one of either
-adt-xenlvm-with-testbed or adt-xenlvm-setup (or one of each)
-simultaneously, the behaviour is not defined, except that the host
-will definitely not be trashed, and just two or more copies of
-adt-xenlvm-with-testbed at once has no bad effects that
-adt-xenlvm-cleanup won't fix.
========== Configuration ==========
Playground area for this particular testbed construction and
data.
+adt_lock <playbase>.lock
+ Lockfile. Used to prevent multiple simultaneous runs of
+ setup, purge, clean, with-testbed, etc. The lock is held
+ according to the rules for with-lock-ex from chiark-utils-bin.
+ Set adt_lock to "none" to disable locking. Note that the
+ lockfile ought not to be in <playbase> because the setup
+ process erases the whole of <playbase> but ought to hold the
+ lock continuously.
+
adt_xmconfig <play>/xmconfig
Xen virtual machine creation configuration for xm create.
This file will be (over)written during testbed setup.
#!/bin/bash
set -e
+adt_readconfig_needlock=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
test $nonoptargs = 0 || fail "non-option arguments not allowed"
exec 8>&1 >/dev/null
+adt_whenlock_replumb81=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
exec >&8 8>&-
#!/bin/bash
set -e
+
+adt_readconfig_needlock=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
test $nonoptargs = 0 || fail "non-option arguments not allowed"
+rm -f $adt_play/good
$ADT_XENLVM_SHARE/cleanup
-x lvchange -a n $lvm_baselv_namepath ||:
-x lvchange -a n $lvm_cowdata_namepath ||:
-x lvremove $lvm_baselv_namepath ||:
-x lvremove $lvm_cowdata_namepath ||:
+xl lvchange -a n $lvm_baselv_namepath ||:
+xl lvchange -a n $lvm_cowdata_namepath ||:
+xl lvremove $lvm_baselv_namepath ||:
+xl lvremove $lvm_cowdata_namepath ||:
rm -rf -- "${adt_play}"
}
x () { echo "x $*"; "$@"; }
+xl () { echo "xl $*"; 3>&- "$@"; }
case "$BASH_VERSION" in
'') fail 'scripts using adtxenlvm readconfig must be bash scripts' ;;
test ! -e "${adt_config}" || . "${adt_config}"
cmdline_args "$@"
+#---------- settings needed for locking ----------
+
+# In-host-file-system playground
+: ${adt_play:=${adt_playbase}/${adt_nominum}_${adt_distro}}
+: ${adt_xmconfig:=${adt_play}/xmconfig}
+: ${adt_lock:=${adt_play}.lock}
+
+if [ ! "${adt_readconfig_initscript}" ]; then
+ case "$adt_distro" in
+ '')
+ printf "considering which distro to use ... "
+ test -e /etc/lsb-release || \
+ fail 'no /etc/lsb-version, config must specify adt_distro'
+ . /etc/lsb-release
+ adt_distro=$DISTRIB_CODENAME
+ echo "using same distro as host: $adt_distro"
+ ;;
+ esac
+fi
+
+if [ "${adt_readconfig_needlock}" ] &&
+ [ "x${adt_lock}" != xnone ] && \
+ [ "x${ADT_LOCKED}" != "x$adt_lock" ]; then
+ if [ "${adt_whenlock_replumb81}" ]; then
+ exec >&8 8>&-
+ fi
+ ADT_LOCKED="$adt_lock" exec with-lock-ex -w "$adt_lock" "$0" "$@"
+fi
+
#---------- calculated defaults for complex settings ----------
if [ ! "${adt_readconfig_initscript}" ]; then
case "$adt_lvm_vg" in
'')
printf "searching for default volume group ... "
- vgdisplay_out=`vgdisplay -c 8>&-`
+ vgdisplay_out=`vgdisplay -c 3>&- 8>&-`
case "$vgdisplay_out" in
"") fail 'no volume groups found';;
*"
*) ;;
esac
-if [ ! "${adt_readconfig_initscript}" ]; then
- case "$adt_distro" in
- '')
- printf "considering which distro to use ... "
- test -e /etc/lsb-release || \
- fail 'no /etc/lsb-version, config must specify adt_distro'
- . /etc/lsb-release
- adt_distro=$DISTRIB_CODENAME
- echo "using same distro as host: $adt_distro"
- ;;
- esac
-fi
-
hostname_from_ipaddr () {
eval '
if [ x"$adt_'$1'_hostname" = x ] && \
# Xen
: ${adt_xmname:=${adt_nominum}_${adt_distro}}
-# In-host-file-system playground
-: ${adt_play:=${adt_playbase}/${adt_nominum}_${adt_distro}}
-: ${adt_xmconfig:=${adt_play}/xmconfig}
-: ${adt_lock:=${adt_play}/lock}
-
# LVM
boolean_config lvm_erasebase true
: ${adt_lvm_baselv:=${adt_nominum}_${adt_distro}_base}
#!/bin/bash
set -e
adt_readconfig_needkernel=y
+adt_readconfig_needlock=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
test $nonoptargs = 0 || fail "non-option arguments not allowed"
$ADT_XENLVM_SHARE/purge
-x lvcreate -L $adt_fs_size -n $adt_lvm_baselv $adt_lvm_vg
-x lvcreate -L $adt_fs_snapsize -n $adt_lvm_cowdatalv $adt_lvm_vg
+xl lvcreate -L $adt_fs_size -n $adt_lvm_baselv $adt_lvm_vg
+xl lvcreate -L $adt_fs_snapsize -n $adt_lvm_cowdatalv $adt_lvm_vg
if $adt_lvm_erasebase; then
- basesize=`lvdisplay -c $lvm_baselv_namepath 8>&-`
+ basesize=`lvdisplay -c $lvm_baselv_namepath 8>&- 3>&-`
basesize="${basesize#*:*:*:*:*:*:}"
basesize="${basesize%%:*}"
x dd if=/dev/zero of=$lvm_baselv_namepath bs=512 count="$basesize"
x xm save $adt_xmname $adt_play/xen-save
rm ${lvm_fslink_ptr}
+touch "$adt_play/good"
}
case "$1" in
-with) run adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;;
pon0) run adt-xenlvm-on-testbed -- --print0-command ;;
console) xm console "$nd" ;;
+with)
+ ADT_LOCKED="$nddir/lock" with-lock-ex -w "$nddir/lock" sh -ec '
+ while adt-xenlvm-with-testbed \
+ --adt-distro="$1" --adt-nominum="$2" \
+ sh -c "echo y && read again" && \
+ echo n && read again; do
+ :
+ done
+ ' locked-fragment "$d" "$n"
+;;
*) fail 'unknown mode'
esac
set -e
trap 'exit 127' 0
+adt_readconfig_needlock=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/justconfig
while test $# -gt $nonoptargs; do shift; done
+if ! test -f "$adt_play/good"; then
+ echo >&2 'testbed not in good state'
+ exit 127
+fi
+
${ADT_XENLVM_SHARE}/cleanup >/dev/null
modprobe dm-snapshot >/dev/null 2>&1 ||:
xm mem-set $adt_xmname $adt_testbed_ram
udevsettle
+unset ADT_LOCKED
+
set +e
case $# in
0) debian_chroot="<with-adtxenlvm_$adt_nominum>$debian_chroot" $SHELL -i ;;