From 2e5ee4da3e69e85dadcfe64ee64d314721825074 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 2 Jul 2007 17:35:39 +0100 Subject: [PATCH] userv service seems to work now --- debian/changelog | 4 +++- doc/README.userv | 31 +++++++++++++++++++++++++------ xen/on-testbed | 10 ++++++---- xen/userv-target | 16 +++++++++------- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2cf9dee..f34aabc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ autopkgtest (0.9.0~iwj) unstable; urgency=low - * WIP userv service. + * WIP userv service use by adt-virt-xenlvm. + * userv service for testbed invocation now provided and + at least somewhat tested. * New print-execute-command command for virtualisation servers. * Do not demand vg or distro information for initscript to work. * autopkgtest-xenlvm now Recommends: lvm2 and debootstrap. diff --git a/doc/README.userv b/doc/README.userv index 9db81e3..5d98580 100644 --- a/doc/README.userv +++ b/doc/README.userv @@ -11,11 +11,30 @@ adt-xenlvm-with-testbed and adt-xenlvm-on-testbed) but not the ability to create new testbeds. To make this feature available: - * Install userv + * Install userv. * Create a group named AdtXenUs containing the users which should - be able to manipulate and use the testbed. (This group can start - out empty but should exist before setting up the testbed for - the first time.) - * + be able to manipulate and use the testbed. + * Run adt-xenlvm-setup. NB that the group can be empty at this + point but should exist before setting up the testbed, or the + testbed setup will not be correct. -The configuration as supplied does not make it +Typically adt-xenlvm-setup ought to be run periodically anyway to +make sure that the snapshot doesn't get too out of date. + + +Client interface +---------------- + +The service is as invoked as + userv [-Ddistro= -Dnominum=] root adt-xenlvm-testbed +where is either + with + Starts adt-xenlvm-with-testbed, prints `y', waits for + eof on stdin, and then exits adt-xenlvm-with-testbed. + pon0 + Prints the command that ought to be run to execute + commands on the testbed. The output is a command and + arguments, each followed by a null byte. These should + be put into an array of strings and passed to exec, + with the actual command to be run added as a final + argument (in sh syntax). diff --git a/xen/on-testbed b/xen/on-testbed index 60eabd5..24611fd 100755 --- a/xen/on-testbed +++ b/xen/on-testbed @@ -3,11 +3,13 @@ set -e . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/justconfig while test $# -gt $nonoptargs; do shift; done +: "$1" + case "$1" in -x--print-command) ppfx=echo; shift ;; -x--print0-command) ppfx=ppfx0; shift ;; -x--) shift ;; -x-*) fail "invalid instead-of-command options \`$1'" ;; +--print-command) ppfx=echo; shift ;; +--print0-command) ppfx=ppfx0; shift ;; +--) shift ;; +-*) fail "invalid instead-of-command options \`$1'" ;; esac ppfx0 () { for x in "$@"; do printf '%s\0' "$x"; done; } diff --git a/xen/userv-target b/xen/userv-target index 9c9ec02..8ba9d1a 100755 --- a/xen/userv-target +++ b/xen/userv-target @@ -2,19 +2,21 @@ set -e fail () { printf >&2 "%s: %s\n" "$0" "$*"; exit 127; } -. /etc/lsb-release +if test -f /etc/lsb-release; then . /etc/lsb-release; fi -d="${USERV_U_distro-$DISTRIB_CODENAME}" -n="${USERV_U_nominum-adt}" +d="${USERV_U_distro:-$DISTRIB_CODENAME}" +n="${USERV_U_nominum:-adt}" -case "$dn" in +nd="${n}_${d}" + +case "$nd" in */*|.*|*.*|*_*_*) fail 'dangerous format in distro or nominum' ;; adt*) ;; *) fail 'userv adtxenlvm only supports nominums starting with adt' ;; esac -dndir=/var/lib/autopkgtest/xenlvm/"$dn" -test -d "$dndir" || fail 'unknown distro or nominum' +nddir=/var/lib/autopkgtest/xenlvm/"$nd" +test -d "$nddir" || fail 'unknown distro or nominum' run () { base="$1"; shift @@ -22,7 +24,7 @@ run () { } case "$1" in -with) adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;; +with) run adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;; pon0) run adt-xenlvm-on-testbed -- --print0-command ;; *) fail 'unknown mode' esac -- 2.30.2