Index: trunk/packages/sipb-xen-base/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-base/debian/changelog	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/changelog	(revision 315)
@@ -0,0 +1,24 @@
+sipb-xen-base (4) unstable; urgency=low
+
+  * sipb-vm-1 becomes sipb-xen-dev
+
+ -- Sam Hartman <hartmans@debian.org>  Tue,  4 Sep 2007 15:48:50 -0400
+
+sipb-xen-base (3) unstable; urgency=low
+
+  * We want security updates too
+
+ -- Sam Hartman <hartmans@debian.org>  Fri, 10 Aug 2007 20:39:14 -0400
+
+sipb-xen-base (2) unstable; urgency=low
+
+  * Update sources.list to include our debian mirror
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 19:11:18 -0400
+
+sipb-xen-base (1) unstable; urgency=low
+
+  * New upstream version
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 18:44:21 -0400
+
Index: trunk/packages/sipb-xen-base/debian/compat
===================================================================
--- trunk/packages/sipb-xen-base/debian/compat	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/compat	(revision 315)
@@ -0,0 +1,1 @@
+4
Index: trunk/packages/sipb-xen-base/debian/control
===================================================================
--- trunk/packages/sipb-xen-base/debian/control	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/control	(revision 315)
@@ -0,0 +1,14 @@
+Source: sipb-xen-base
+Section: base
+Priority: extra
+Maintainer: SIPB Xen Project <sipb-xen@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0)
+Standards-Version: 3.7.2
+
+Package: sipb-xen-base
+Architecture: all
+Depends: ${misc:Depends}, 
+Description: Base configuration required for all SIPB xen servers
+ This package includes apt configuration, .k5login and other files that
+ should be synchronized among all our servers.
+ Installing this on a non-sipb-xen machine would be very anti-social.
Index: trunk/packages/sipb-xen-base/debian/copyright
===================================================================
--- trunk/packages/sipb-xen-base/debian/copyright	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/copyright	(revision 315)
@@ -0,0 +1,3 @@
+This package was created for internal use of the SIPB Xen Project of
+the MIT Student Information Processing Board.  Ask tabbott@mit.edu if
+you have questions about redistribution.
Index: trunk/packages/sipb-xen-base/debian/rules
===================================================================
--- trunk/packages/sipb-xen-base/debian/rules	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/rules	(revision 315)
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Index: trunk/packages/sipb-xen-base/debian/sipb-xen-base.install
===================================================================
--- trunk/packages/sipb-xen-base/debian/sipb-xen-base.install	(revision 315)
+++ trunk/packages/sipb-xen-base/debian/sipb-xen-base.install	(revision 315)
@@ -0,0 +1,1 @@
+files/* .
Index: trunk/packages/sipb-xen-base/files/etc/apt/sources.list
===================================================================
--- trunk/packages/sipb-xen-base/files/etc/apt/sources.list	(revision 315)
+++ trunk/packages/sipb-xen-base/files/etc/apt/sources.list	(revision 315)
@@ -0,0 +1,7 @@
+deb http://sipb-xen-dev.mit.edu/debian stable main
+
+deb http://sipb-xen-dev.mit.edu/sipb-xen stable main
+
+deb-src http://debian.lcs.mit.edu/debian  etch main
+deb http://debian.lcs.mit.edu/debian etch main
+deb http://security.debian.org/debian-security etch/updates main
Index: trunk/packages/sipb-xen-base/files/root/.k5login
===================================================================
--- trunk/packages/sipb-xen-base/files/root/.k5login	(revision 315)
+++ trunk/packages/sipb-xen-base/files/root/.k5login	(revision 315)
@@ -0,0 +1,22 @@
+hartmans@ATHENA.MIT.EDU
+hartmans/root@ATHENA.MIT.EDU
+jbarnold@ATHENA.MIT.EDU
+jbarnold/root@ATHENA.MIT.EDU
+andersk@ATHENA.MIT.EDU
+andersk/root@ATHENA.MIT.EDU
+nelhage@ATHENA.MIT.EDU
+nelhage/root@ATHENA.MIT.EDU
+tabbott@ATHENA.MIT.EDU
+tabbott/root@ATHENA.MIT.EDU
+asedeno@ATHENA.MIT.EDU
+asedeno/root@ATHENA.MIT.EDU
+quentin@ATHENA.MIT.EDU
+quentin/root@ATHENA.MIT.EDU
+danjared@ATHENA.MIT.EDU
+danjared/root@ATHENA.MIT.EDU
+ecprice@ATHENA.MIT.EDU
+ecprice/root@ATHENA.MIT.EDU
+zev@ATHENA.MIT.EDU
+zev/root@ATHENA.MIT.EDU
+mclamb@ATHENA.MIT.EDU
+mclamb/root@ATHENA.MIT.EDU
Index: trunk/packages/sipb-xen-dev/debian/README
===================================================================
--- trunk/packages/sipb-xen-dev/debian/README	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/README	(revision 315)
@@ -0,0 +1,6 @@
+The Debian Package sipb-xen-dev
+----------------------------
+
+Comments regarding the Package
+
+ -- unknown <hartmans@debian.org>  Fri,  6 Jul 2007 00:52:28 -0400
Index: trunk/packages/sipb-xen-dev/debian/README.Debian
===================================================================
--- trunk/packages/sipb-xen-dev/debian/README.Debian	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/README.Debian	(revision 315)
@@ -0,0 +1,6 @@
+sipb-xen-dev for Debian
+-----------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- unknown <hartmans@debian.org>  Fri,  6 Jul 2007 00:52:28 -0400
Index: trunk/packages/sipb-xen-dev/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-dev/debian/changelog	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/changelog	(revision 315)
@@ -0,0 +1,85 @@
+sipb-xen-dev (13) unstable; urgency=low
+
+  * Update the svn uri automatically.
+
+ -- Eric Price <ecprice@sipb-xen-dev.mit.edu>  Fri, 28 Mar 2008 21:38:37 -0400
+
+sipb-xen-dev (12) unstable; urgency=low
+
+  * Update the svn uri to point to the new repository
+
+ -- Nelson Elhage <nelhage@mit.edu>  Wed, 15 Aug 2007 22:58:49 -0400
+
+sipb-xen-dev (11) unstable; urgency=low
+
+  * Use svn export not co to avoid installing .svn directories
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 19:15:58 -0400
+
+sipb-xen-dev (10) unstable; urgency=low
+
+  * Use svn export not svn co so we don't get .svn directories installed
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 19:14:51 -0400
+
+sipb-xen-dev (9) unstable; urgency=low
+
+  * Add /debian to apache config
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 18:54:43 -0400
+
+sipb-xen-dev (8) unstable; urgency=low
+
+  * Can't use ..
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 17:29:54 -0400
+
+sipb-xen-dev (7) unstable; urgency=low
+
+  * Can't use ..
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 17:27:59 -0400
+
+sipb-xen-dev (6) unstable; urgency=low
+
+  * Can't use ..
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 17:26:17 -0400
+
+sipb-xen-dev (5) unstable; urgency=low
+
+  * Bug fix
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 17:25:00 -0400
+
+sipb-xen-dev (4) unstable; urgency=low
+
+  * Blah
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 17:21:28 -0400
+
+sipb-xen-dev (3) unstable; urgency=low
+
+  * Working sx-build-release
+  
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 16:58:46 -0400
+
+sipb-xen-dev (2) unstable; urgency=low
+
+  * Add sipb-xen-repository apache config
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 14:04:03 -0400
+
+sipb-xen-dev (1) unstable; urgency=low
+
+  * Add repository config
+  * update dependencies
+
+ --  Sam Hartman <hartmans@debian.org>  Sun, 15 Jul 2007 13:43:08 -0400
+
+sipb-xen-dev (0) unstable; urgency=low
+
+  * Initial Release.
+
+ -- unknown <hartmans@debian.org>  Fri,  6 Jul 2007 00:52:28 -0400
Index: trunk/packages/sipb-xen-dev/debian/compat
===================================================================
--- trunk/packages/sipb-xen-dev/debian/compat	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/compat	(revision 315)
@@ -0,0 +1,1 @@
+5
Index: trunk/packages/sipb-xen-dev/debian/control
===================================================================
--- trunk/packages/sipb-xen-dev/debian/control	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/control	(revision 315)
@@ -0,0 +1,13 @@
+Source: sipb-xen-dev
+Section: servers
+Priority: important
+Maintainer: sipb-xen@mit.edu
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: sipb-xen-dev
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg-dev-el, emacs21, reprepro, apache2, postfix, screen, dh-make, screen, , fakeroot, pbuilder
+Description: SIPB Xen development server 
+ This package  should be installed on sipb-xen-dev
+ It makes sure that necessary tools are available.
Index: trunk/packages/sipb-xen-dev/debian/copyright
===================================================================
--- trunk/packages/sipb-xen-dev/debian/copyright	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/copyright	(revision 315)
@@ -0,0 +1,25 @@
+This is sipb-xen-dev, written and maintained by sipb-xen@mit.edu
+on Fri,  6 Jul 2007 00:52:28 -0400.
+
+The original source can always be found at:
+
+Copyright Holder:  unknown
+
+License:
+
+  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.
+
+  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.
+
+  You should have received a copy of the GNU General Public License
+  along with this package; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
Index: trunk/packages/sipb-xen-dev/debian/dirs
===================================================================
--- trunk/packages/sipb-xen-dev/debian/dirs	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/dirs	(revision 315)
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
Index: trunk/packages/sipb-xen-dev/debian/rules
===================================================================
--- trunk/packages/sipb-xen-dev/debian/rules	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/rules	(revision 315)
@@ -0,0 +1,97 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+
+
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/sipb-xen-dev.
+
+
+
+# Build architecture-independent files here.
+binary-arch: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples
+	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_python
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Index: trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.dirs
===================================================================
--- trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.dirs	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.dirs	(revision 315)
@@ -0,0 +1,1 @@
+srv/repository/conf
Index: trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.install
===================================================================
--- trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.install	(revision 315)
+++ trunk/packages/sipb-xen-dev/debian/sipb-xen-dev.install	(revision 315)
@@ -0,0 +1,4 @@
+reprepro-env /usr/bin
+repository-config/* srv/repository/conf
+sipb-xen-repository etc/apache2/conf.d
+sx-build-release /usr/bin
Index: trunk/packages/sipb-xen-dev/repository-config/distributions
===================================================================
--- trunk/packages/sipb-xen-dev/repository-config/distributions	(revision 315)
+++ trunk/packages/sipb-xen-dev/repository-config/distributions	(revision 315)
@@ -0,0 +1,15 @@
+CodeName: unstable
+Components: main
+Uploaders: unsigned
+Architectures: amd64 source
+Origin: sipb
+Notautomatic: yes
+Description: Unreleased sipb-xen software
+
+
+Codename: stable
+Components: main
+Architectures: amd64 source 
+Origin: sipb
+Description: Released sipb-xen  code
+Contents: 1
Index: trunk/packages/sipb-xen-dev/repository-config/unsigned
===================================================================
--- trunk/packages/sipb-xen-dev/repository-config/unsigned	(revision 315)
+++ trunk/packages/sipb-xen-dev/repository-config/unsigned	(revision 315)
@@ -0,0 +1,2 @@
+allow  * by unsigned
+
Index: trunk/packages/sipb-xen-dev/reprepro-env
===================================================================
--- trunk/packages/sipb-xen-dev/reprepro-env	(revision 315)
+++ trunk/packages/sipb-xen-dev/reprepro-env	(revision 315)
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+export HOME=/home/repository
+exec sudo -u repository  /usr/bin/reprepro -b /srv/repository "$@"
+
Index: trunk/packages/sipb-xen-dev/sipb-xen-repository
===================================================================
--- trunk/packages/sipb-xen-dev/sipb-xen-repository	(revision 315)
+++ trunk/packages/sipb-xen-dev/sipb-xen-repository	(revision 315)
@@ -0,0 +1,17 @@
+Alias /sipb-xen /srv/repository
+
+Alias /debian/ /debian/
+
+<Directory /srv/repository>
+		Options Indexes FollowSymLinks MultiViews
+		AllowOverride None
+		Order allow,deny
+		allow from all
+</Directory>
+
+<Directory /debian>
+		Options Indexes FollowSymLinks MultiViews
+		AllowOverride None
+		Order allow,deny
+		allow from all
+</Directory>
Index: trunk/packages/sipb-xen-dev/sx-build-release
===================================================================
--- trunk/packages/sipb-xen-dev/sx-build-release	(revision 315)
+++ trunk/packages/sipb-xen-dev/sx-build-release	(revision 315)
@@ -0,0 +1,30 @@
+#!/bin/bash
+svnuri=`svn info | sed -n 's/^Repository Root: //p'`
+
+set -e
+if  [ $# -ne 1 ] ; then
+	echo " usage: sx-build-release trunk/packages/package_name"
+	exit 1
+fi
+
+if [ -d build-release ] ; then
+    echo "a previous build release directory exists; please clean up"
+    exit 1
+    fi
+
+package=$1
+svn export $svnuri/$package build-release
+olddir=`pwd`
+cd build-release/`basename $package`
+eval  `perl '-F:\s+' -lane 'print  $F[0]."=".$F[1] if /^Version|^Source|^Distribution/' \
+    <(dpkg-parsechangelog)`
+
+
+dpkg-buildpackage -us -uc -rfakeroot
+svn mkdir $svnuri/package_tags/$Source -m "Create package tags directory" ||true
+svn cp  $svnuri/$package $svnuri/package_tags/$Source/$Version -m "Tag $Version of $Source"
+cd ..
+ reprepro-env include $Distribution  `pwd`/${Source}_*${Version}*.changes
+
+cd $olddir
+rm -rf build-release
Index: trunk/packages/sipb-xen-dom0/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/changelog	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/changelog	(revision 315)
@@ -0,0 +1,44 @@
+sipb-xen-dom0 (2.3) unstable; urgency=low
+
+  * Depend on generic metapackages/provides instead of particular 
+    versions.
+
+ -- Anders Kaseorg <andersk@sipb-xen.mit.edu>  Sat, 27 Oct 2007 21:23:00 -0400
+
+sipb-xen-dom0 (2.2) unstable; urgency=low
+
+  * Add qemu-ifup script that depends on the device model script and
+    invokes vif-sipbroute.    As a consequence, we don't really support
+    bridged hvms any more.  It's not clear how to get enough information
+    out of qemu to do this.
+  * Call arpspoof with 18.181.0.1's address.  This is unfortunate in two
+    ways.  First, if we renumber we'll need to update the script.  Second,
+    it is possible that someone on 18.181 besides the router may have an
+    address cached.  Unfortunately, it doesn't work right if we don't
+    send the spoofed arp directly to the router.
+
+ -- Sam Hartman <hartmans@debian.org>  Sun, 26 Aug 2007 18:57:17 -0400
+
+sipb-xen-dom0 (2.1) unstable; urgency=low
+
+  * Fix typo in init script 
+  * depend  on dsniff for arpspoof
+
+ -- Sam Hartman <hartmans@debian.org>  Fri, 24 Aug 2007 17:22:20 -0400
+
+sipb-xen-dom0 (2) unstable; urgency=low
+
+  * Add qemu-dm-sipb written by andersk to get us the  domain ID in qemu-ifup 
+  * Add vif-sipbroute, a version of vif-route that does better netwwork
+    isolation and has initial but useless ipv6 support.  This version also
+    uses arpspoof to take over an address for domain migrations.   
+  * Add init script to enable rp_filter, proxy_arp and forwarding for the network config.
+
+ -- Sam Hartman <hartmans@debian.org>  Fri, 24 Aug 2007 17:17:23 -0400
+
+sipb-xen-dom0 (1) unstable; urgency=low
+
+  *  First version
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 20:20:32 -0400
+
Index: trunk/packages/sipb-xen-dom0/debian/compat
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/compat	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/compat	(revision 315)
@@ -0,0 +1,1 @@
+4
Index: trunk/packages/sipb-xen-dom0/debian/control
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/control	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/control	(revision 315)
@@ -0,0 +1,13 @@
+Source: sipb-xen-dom0
+Section: base
+Priority: extra
+Maintainer: SIPB Xen Project <sipb-xen@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0)
+Standards-Version: 3.7.2
+
+Package: sipb-xen-dom0
+Architecture: all
+Depends: ${misc:Depends}, emacs, nullmailer, dsniff, xen-hypervisor, xen-utils, lvm2, grub, linux-image-xen-amd64
+Description: SIPB Xen domain 0 configuration
+ This package includes the dependencies and configuration for 
+ a domain 0 sipb-xen server.
Index: trunk/packages/sipb-xen-dom0/debian/copyright
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/copyright	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/copyright	(revision 315)
@@ -0,0 +1,3 @@
+This package was created for internal use of the SIPB Xen Project of
+the MIT Student Information Processing Board.  Ask tabbott@mit.edu if
+you have questions about redistribution.
Index: trunk/packages/sipb-xen-dom0/debian/rules
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/rules	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/rules	(revision 315)
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Index: trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.dirs
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.dirs	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.dirs	(revision 315)
@@ -0,0 +1,1 @@
+usr/share/sipb-xen-dom0
Index: trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.init
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.init	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.init	(revision 315)
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+case $1 in
+    start)
+    echo 1 >/proc/sys/net/ipv4/ip_forward
+    for foo in all default; do
+    echo 1 >/proc/sys/net/ipv4/conf/$foo/rp_filter 
+    echo 1 >/proc/sys/net/ipv4/conf/$foo/proxy_arp
+    done
+    ;;
+    esac
Index: trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.install
===================================================================
--- trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.install	(revision 315)
+++ trunk/packages/sipb-xen-dom0/debian/sipb-xen-dom0.install	(revision 315)
@@ -0,0 +1,2 @@
+files/* .
+xend-config.sxp usr/share/sipb-xen-dom0
Index: trunk/packages/sipb-xen-dom0/files/etc/modprobe.d/loop-maxloop
===================================================================
--- trunk/packages/sipb-xen-dom0/files/etc/modprobe.d/loop-maxloop	(revision 315)
+++ trunk/packages/sipb-xen-dom0/files/etc/modprobe.d/loop-maxloop	(revision 315)
@@ -0,0 +1,1 @@
+options loop max_loop=64
Index: trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/qemu-ifup
===================================================================
--- trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/qemu-ifup	(revision 315)
+++ trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/qemu-ifup	(revision 315)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo "config qemu network with xen bridge for $@"
+
+if [ -z "$domid" ]; then
+    echo "domid is not set!!!" >&2
+    exit 1
+fi
+
+dev=$1
+qemu_online=yes
+XENBUS_PATH=/local/domain/0/backend/vif/${domid}/0
+vif=vif${domid}.0
+export vif qemu_online XENBUS_PATH dev 
+
+exec /etc/xen/scripts/vif-sipbroute online
Index: trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/vif-sipbroute
===================================================================
--- trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/vif-sipbroute	(revision 315)
+++ trunk/packages/sipb-xen-dom0/files/etc/xen/scripts/vif-sipbroute	(revision 315)
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+
+
+
+
+#============================================================================
+# /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).
+# V6PREFIX  prefix of v6 address to use
+# Note that the v6 support is kind of broken because there's not really a way to populate the v6 prefix
+# This script will set up proxy arp  for any ip addresses that are being routed
+# type read to determine if the device is ioemu
+
+#============================================================================
+
+dir=$(dirname "$0")
+. "$dir/vif-common.sh"
+
+main_ip=$(dom0_ip)
+dev=${dev:-${vif}}
+
+case "$command" in
+    online)
+        ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up
+        echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp
+	echo 1 >/proc/sys/net/ipv4/conf/${dev}/rp_filter 
+        ipcmd='add'
+        cmdprefix=''
+        ;;
+    offline)
+        do_without_error ifdown ${vif}
+	if [ -f /var/run/radvd/radvd.pid.${vif} ] ; then
+	    do_without_error kill `cat /var/run/radvd/radvd.pid.${vif}`
+	    fi
+        ipcmd='del'
+        cmdprefix='do_without_error'
+        ;;
+esac
+
+v6prefix=${v6prefix:-}
+v6prefix=$(xenstore_read_default "$XENBUS_PATH/v6prefix" "$v6prefix")
+vif_type=$(xenstore_read_default "$XENBUS_PATH/type" "viffront")
+if [  ${vif_type} != "ioemu"  -o  x${qemu_online} = xyes ] ; then
+    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
+	    ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip}
+	    arpspoof -i eth0 -t 18.181.0.1 ${addr}&
+	    sleep 5
+	    kill %arpspoof
+	done 
+    fi
+
+    if [ x${v6prefix} != x ] ; then
+	sed -e "s/@interface@/${dev}/" -e "s+@prefix@+${v6prefix}+" /etc/xen/radvd.conf.template >/var/run/radvd.conf.${vif}
+	${cmdprefix} ip -6 addr  ${ipcmd}  fe80::/64 scope link  dev ${dev} 
+	if [ $1 = online ] ; then
+	    radvd  -u radvd -C /var/run/radvd.conf.${vif} -p /var/run/radvd/radvd.pid.${vif}
+	fi
+	${cmdprefix} ip -6 route ${ipcmd} ${v6prefix} dev ${dev} 
+    fi
+fi
+
+handle_iptable
+
+log debug "Successful vif-route $command for $vif."
+if [ "$command" == "online" ]
+then
+  success
+fi
Index: trunk/packages/sipb-xen-dom0/files/usr/sbin/qemu-dm-sipb
===================================================================
--- trunk/packages/sipb-xen-dom0/files/usr/sbin/qemu-dm-sipb	(revision 315)
+++ trunk/packages/sipb-xen-dom0/files/usr/sbin/qemu-dm-sipb	(revision 315)
@@ -0,0 +1,16 @@
+#!/bin/sh
+domid=
+for i; do
+    if [ "$domid" = "_NEXT_" ]; then
+	domid=$i
+	break
+    elif [ "$i" = "-d" ]; then
+	domid=_NEXT_
+    fi
+done
+export domid
+echo 'BEGIN qemu-dm-sipb LOG' >> /tmp/log
+echo "$0 $@" >> /tmp/log
+env >> /tmp/log
+echo 'END qemu-dm-sipb LOG' >> /tmp/log
+exec "$ROOT/bin/qemu-dm" "$@"
Index: trunk/packages/sipb-xen-dom0/xend-config.sxp
===================================================================
--- trunk/packages/sipb-xen-dom0/xend-config.sxp	(revision 315)
+++ trunk/packages/sipb-xen-dom0/xend-config.sxp	(revision 315)
@@ -0,0 +1,135 @@
+# -*- sh -*-
+
+#
+# Xend configuration file.
+#
+
+# This example configuration is appropriate for an installation that 
+# utilizes a bridged network configuration. Access to xend via http
+# is disabled.  
+
+# Commented out entries show the default for that entry, unless otherwise
+# specified.
+
+#(logfile /var/log/xen/xend.log)
+#(loglevel DEBUG)
+
+#(xend-http-server no)
+#(xend-unix-server no)
+#(xend-tcp-xmlrpc-server no)
+#(xend-unix-xmlrpc-server yes)
+#(xend-relocation-server no)
+
+#(xend-unix-path /var/lib/xend/xend-socket)
+
+# Port xend should use for the HTTP interface, if xend-http-server is set.
+#(xend-port            8000)
+
+# Port xend should use for the relocation interface, if xend-relocation-server
+# is set.
+#(xend-relocation-port 8002)
+
+# Address xend should listen on for HTTP connections, if xend-http-server is
+# set.
+# Specifying 'localhost' prevents remote connections.
+# Specifying the empty string '' (the default) allows all connections.
+#(xend-address '')
+#(xend-address localhost)
+
+# Address xend should listen on for relocation-socket connections, if
+# xend-relocation-server is set.
+# Meaning and default as for xend-address above.
+#(xend-relocation-address '')
+
+# The hosts allowed to talk to the relocation port.  If this is empty (the
+# default), then all connections are allowed (assuming that the connection
+# arrives on a port and interface on which we are listening; see
+# xend-relocation-port and xend-relocation-address above).  Otherwise, this
+# should be a space-separated sequence of regular expressions.  Any host with
+# a fully-qualified domain name or an IP address that matches one of these
+# regular expressions will be accepted.
+#
+# For example:
+#  (xend-relocation-hosts-allow '^localhost$ ^.*\.example\.org$')
+#
+#(xend-relocation-hosts-allow '')
+
+# The limit (in kilobytes) on the size of the console buffer
+#(console-limit 1024)
+
+##
+# To bridge network traffic, like this:
+#
+# dom0: fake eth0 -> vif0.0 -+
+#                            |
+#                          bridge -> real eth0 -> the network
+#                            |
+# domU: fake eth0 -> vifN.0 -+
+#
+# use
+#
+# (network-script network-bridge)
+#
+# Your default ethernet device is used as the outgoing interface, by default. 
+# To use a different one (e.g. eth1) use
+#
+# (network-script 'network-bridge netdev=eth1')
+#
+# The bridge is named xenbr0, by default.  To rename the bridge, use
+#
+# (network-script 'network-bridge bridge=<name>')
+#
+# It is possible to use the network-bridge script in more complicated
+# scenarios, such as having two outgoing interfaces, with two bridges, and
+# two fake interfaces per guest domain.  To do things like this, write
+# yourself a wrapper script, and call network-bridge from it, as appropriate.
+#
+(network-script network-bridge)
+
+# The script used to control virtual interfaces.  This can be overridden on a
+# per-vif basis when creating a domain or a configuring a new vif.  The
+# vif-bridge script is designed for use with the network-bridge script, or
+# similar configurations.
+#
+# If you have overridden the bridge name using
+# (network-script 'network-bridge bridge=<name>') then you may wish to do the
+# same here.  The bridge name can also be set when creating a domain or
+# configuring a new vif, but a value specified here would act as a default.
+#
+# If you are using only one bridge, the vif-bridge script will discover that,
+# so there is no need to specify it explicitly.
+#
+(vif-script vif-bridge)
+
+
+## Use the following if network traffic is routed, as an alternative to the
+# settings for bridged networking given above.
+#(network-script network-route)
+#(vif-script     vif-route)
+
+
+## Use the following if network traffic is routed with NAT, as an alternative
+# to the settings for bridged networking given above.
+#(network-script network-nat)
+#(vif-script     vif-nat)
+
+
+# Dom0 will balloon out when needed to free memory for domU.
+# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to.
+# If dom0-min-mem=0, dom0 will never balloon out.
+(dom0-min-mem 196)
+
+# In SMP system, dom0 will use dom0-cpus # of CPUS
+# If dom0-cpus = 0, dom0 will take all cpus available
+(dom0-cpus 0)
+
+# Whether to enable core-dumps when domains crash.
+#(enable-dump no)
+
+# The tool used for initiating virtual TPM migration
+#(external-migration-tool '')
+
+# The interface for VNC servers to listen on. Defaults
+# to 127.0.0.1  To restore old 'listen everywhere' behaviour
+# set this to 0.0.0.0
+#(vnc-listen '127.0.0.1')
Index: trunk/packages/sipb-xen-remctl-auto/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/changelog	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/changelog	(revision 315)
@@ -0,0 +1,53 @@
+sipb-xen-remctl-auto (1.0.7) unstable; urgency=low
+
+  * changes for installer system
+
+ -- Tim Abbott <tabbott@sipb-xen-dev.mit.edu>  Sun, 28 Oct 2007 22:47:59 -0400
+
+sipb-xen-remctl-auto (1.0.6) unstable; urgency=low
+
+  * get rid of old "vmboot" call
+  * make "create" not destroy running machines.
+
+ -- Tim Abbott <tabbott@sipb-xen-dev.mit.edu>  Sat, 27 Oct 2007 16:54:26 -0400
+
+sipb-xen-remctl-auto (1.0.5) unstable; urgency=low
+
+  * move to common /usr/sbin/sipb-xen-* naming
+  * get rid of dispatch.sh hack
+  * fix "reboot" to "destroy then create" always, since that's what users will expect
+  * change remctl calls interface in various ways
+
+ -- Tim Abbott <tabbott@mit.edu>  Tue, 16 Oct 2007 00:28:36 -0400
+
+sipb-xen-remctl-auto (1.0.4) unstable; urgency=low
+
+  * Fix typos.
+
+ -- Anders Kaseorg <andersk@sipb-xen-dev.mit.edu>  Tue,  9 Oct 2007 04:47:37 -0400
+
+sipb-xen-remctl-auto (1.0.3) unstable; urgency=low
+
+  * Prepend d_ to database VMs.
+
+ -- Eric Price <ecprice@sipb-xen-dev.mit.edu>  Tue,  9 Oct 2007 02:34:56 -0400
+
+sipb-xen-remctl-auto (1.0.2) unstable; urgency=low
+
+  * Added web interface support code.
+  * Move things from /etc/remctl/sipb-xen-auto/bin to /usr/sbin
+  * Quoted lots of variables
+
+ -- Tim Abbott <tabbott@sipb-xen-dev.mit.edu>  Sun,  7 Oct 2007 17:23:40 -0400
+
+sipb-xen-remctl-auto (1.0.1) unstable; urgency=low
+
+  * Stop scaring me with unquoted variables.
+
+ -- Anders Kaseorg <andersk@mit.edu>  Sun, 05 Aug 2007 22:11:02 -0400
+
+sipb-xen-remctl-auto (1.0) unstable; urgency=low
+
+  * Initial release.
+
+ -- Tim Abbott <tabbott@mit.edu>  Sun, 15 Jul 2007 19:37:05 -0400
Index: trunk/packages/sipb-xen-remctl-auto/debian/compat
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/compat	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/compat	(revision 315)
@@ -0,0 +1,1 @@
+4
Index: trunk/packages/sipb-xen-remctl-auto/debian/control
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/control	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/control	(revision 315)
@@ -0,0 +1,12 @@
+Source: sipb-xen-remctl-auto
+Section: net
+Priority: extra
+Maintainer: SIPB Xen Project <sipb-xen@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0)
+Standards-Version: 3.7.2
+
+Package: sipb-xen-remctl-auto
+Architecture: all
+Depends: ${misc:Depends}, remctl-server
+Description: Installs the SIPB Xen automatic remctl management system
+ This is our automatic remctl configuration management system.
Index: trunk/packages/sipb-xen-remctl-auto/debian/control.in
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/control.in	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/control.in	(revision 315)
@@ -0,0 +1,12 @@
+Source: sipb-xen-remctl-auto
+Section: net
+Priority: extra
+Maintainer: SIPB Xen Project <sipb-xen@mit.edu>
+Build-Depends: @cdbs@
+Standards-Version: 3.7.2
+
+Package: sipb-xen-remctl-auto
+Architecture: all
+Depends: ${misc:Depends}, remctl-server
+Description: Installs the SIPB Xen automatic remctl management system
+ This is our automatic remctl configuration management system.
Index: trunk/packages/sipb-xen-remctl-auto/debian/copyright
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/copyright	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/copyright	(revision 315)
@@ -0,0 +1,3 @@
+This package was created for internal use of the SIPB Xen Project of
+the MIT Student Information Processing Board.  Ask tabbott@mit.edu if
+you have questions about redistribution.
Index: trunk/packages/sipb-xen-remctl-auto/debian/rules
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/rules	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/rules	(revision 315)
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1
+include /usr/share/cdbs/1/rules/debhelper.mk
Index: trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.install
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.install	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.install	(revision 315)
@@ -0,0 +1,1 @@
+files/* .
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto	(revision 315)
@@ -0,0 +1,10 @@
+# /etc/cron.d/sipb-xen-remctl-auto: crontab entries for the sipb-xen-remctl-auto package
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+UPDATE=/usr/sbin/remctl-update.sh
+
+@reboot         root    if [ -x "$UPDATE" ]; then nice -n10 "$UPDATE" all; fi
+* * * * */15       root    if [ -x "$UPDATE" ]; then nice -n10 "$UPDATE" all; fi
+
+# EOF
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/acl/web
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/acl/web	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/acl/web	(revision 315)
@@ -0,0 +1,1 @@
+daemon/sipb-xen.mit.edu@ATHENA.MIT.EDU
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto	(revision 315)
@@ -0,0 +1,1 @@
+include /etc/remctl/sipb-xen-auto/machine.d
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web	(revision 315)
@@ -0,0 +1,10 @@
+web lvcreate /usr/sbin/sipb-xen-lvm /etc/remctl/acl/web
+web lvremove /usr/sbin/sipb-xen-lvm /etc/remctl/acl/web
+web lvrename /usr/sbin/sipb-xen-lvm /etc/remctl/acl/web
+web lvresize /usr/sbin/sipb-xen-lvm /etc/remctl/acl/web
+web vmboot /usr/sbin/sipb-xen-vmcontrol /etc/remctl/acl/web
+web register /usr/sbin/sipb-xen-remctl-update /etc/remctl/acl/web
+web moveregister /usr/sbin/sipb-xen-remctl-update /etc/remctl/acl/web
+web unregister /usr/sbin/sipb-xen-remctl-update /etc/remctl/acl/web
+web remctl-moira-update /usr/sbin/sipb-xen-remctl-update /etc/remctl/acl/web
+web listvms /usr/sbin/sipb-xen-listvms /etc/remctl/acl/web
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README	(revision 315)
@@ -0,0 +1,66 @@
+This is Tim Abbott's initial draft at our automatic remctl
+configuration.
+
+/usr/sbin/sipb-xen-remctl-update is the magic script.  Run
+it with "all" as an argument, and it will update everything.
+
+The inputs to this system are as follows:
+
+/etc/remctl/sipb-xen-auto/acl/MACHINENAME
+
+  This directory contains files named MACHINENAME for each machine.
+These ACL files specify who is allowed to administer the machine.  You
+can use entries that are Kerberos principles, or entries of the form
+
+include /etc/remctl/sipb-xen-auto/moira-acl/sipb-xen
+
+to include AFS groups in ACLs.  To add a new machine to the system,
+you simply need to create /etc/remctl/sipb-xen-auto/acl/MACHINENAME
+and then run
+
+/usr/sbin/sipb-xen-remctl-update all
+
+Everything else is autogenerated from that information.
+
+
+Other files of interest:
+
+/etc/remctl/sipb-xen-auto/auto-machine-list
+
+  The list of machines that should have their remctl configuration
+files generated from the template.  This is generated from
+listing /etc/remctl/sipb-xen-auto/acl/*.
+ 
+/etc/remctl/sipb-xen-auto/auto-moira-list
+
+  The list of Athena AFS groups from which acl files should be
+generated.  The ACL files are placed in
+/etc/remctl/sipb-xen-auto/moira-acl/, and named GROUPNAME.  Ths list
+is generated by parsing the ACL files in /etc/remctl/sipb-xen-auto/acl/.
+
+
+This package also includes a crontab to run
+
+/usr/sbin/sipb-xen-remctl-update all
+
+every 15 minutes or so to keep our Moira mapping up to date.  One can
+request an update of our Moira mapping for group X by running
+
+/usr/sbin/sipb-xen-remctl-update moiragroup X
+
+The web interface should probably run this when it adds a group.  We
+may want to make this also available to users, but I've been lame.
+
+This package includes a remctl interface available to anyone to invoke
+the command:
+
+/usr/sbin/sipb-xen-remctl-update all
+
+using the following command from your favorite machine with remctl:
+
+remctl black-mesa.mit.edu remctl-auto-update all
+
+It requires no special permission to run; there is a potential DOS
+issue here, but I don't think it is serious.
+
+Thought should be put into how to ensure that the servers stay in sync.  
Index: trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template	(revision 315)
@@ -0,0 +1,1 @@
+control #MACHINENAME# #BINDIR#/sipb-xen-vmcontrol /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
Index: trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot	(revision 315)
@@ -0,0 +1,9 @@
+#!/bin/sh
+machine="$2"
+cdrom="$3"
+
+if [ -n "$cdrom" ]; then
+        xm create sipb-database machine_name="$machine" cdrom_image="$cdrom"
+else
+        xm create sipb-database machine_name="$machine"
+fi
Index: trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms	(revision 315)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+xm uptime | sed -n 's/^d_// p'
Index: trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm	(revision 315)
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+from subprocess import call, PIPE, Popen
+
+def check(b):
+    if not b:
+        exit(1)
+
+vg = "xenvg"
+prefix = "d_"
+
+subcommand = sys.argv[1]
+
+def ensureoff(machine):
+    # Make sure the machine is off, but we don't care about errors if it is already off.
+    rv = call(["/usr/sbin/xm", "destroy", prefix + machine],
+              stderr=PIPE)
+
+if subcommand == "lvcreate-all":
+    from sipb_xen_database import *
+    import re
+    connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
+    for d in Disk.select():
+        check(re.match('^[A-Za-z0-9]+$', d.guest_device_name))
+        machine = Machine.get(d.machine_id)
+        check(re.match('^[A-Za-z0-9][A-Za-z0-9._-]*$', machine.name))
+        lvname = prefix + machine.name + "_" + d.guest_device_name
+        if not os.path.exists("/dev/%s/%s" % (vg, lvname)):
+            # LV doesn't exist
+            print >>sys.stderr, "Creating LV %s..." % (lvname,)
+            rv = call(["/sbin/lvcreate", "-L", str(d.size) + "M", "-n", lvname, vg])
+            if rv != 0:
+                print >>sys.stderr, "Error creating LV %s\n" %(lvname,)
+                sys.exit(1)
+else:
+    machine = sys.argv[2]
+    disk = sys.argv[3]
+    lvname = prefix + machine + "_" + disk
+    lvpath = "/dev/" + vg + "/" + lvname
+if subcommand == "lvremove":
+    rv = call(["/sbin/lvremove", "--force", lvpath])
+    ensureoff(machine)
+    if rv != 0:
+        print >>sys.stderr, "Error removing LV %s\n" %(lvname,)
+        sys.exit(1)
+elif subcommand == "lvresize":
+    size = sys.argv[4]
+    ensureoff(machine)
+    p = Popen(["/sbin/lvresize", "-L", size + "M", lvpath],
+              stdin=PIPE, stderr=PIPE)
+    print >> p.stdin, 'y'
+    err = p.stderr.read()
+    if p.wait() != 0 and 'matches existing size' not in err:
+        print >> sys.stderr, "Error resizing LV %s:\n" %(lvname,)
+        print >> sys.stderr, err
+        sys.exit(1)
+    print >> sys.stderr, err
+elif subcommand == "lvrename":
+    newmachine = sys.argv[4]
+    newlvname = prefix + newmachine + "_" + disk
+    ensureoff(machine)
+    ensureoff(newmachine)    
+    rv = call(["/sbin/lvrename", vg, lvname, newlvname])
+    if rv != 0:
+        print >>sys.stderr, "Error renaming LV %s\n" %(lvname,)
+        sys.exit(1)
+elif subcommand == "lvcreate":
+    size = sys.argv[4]
+    rv = call(["/sbin/lvcreate", "-L", size + "M", "-n", lvname, vg])
+    if rv != 0:
+        print >>sys.stderr, "Error creating LV %s\n" %(lvname,)
+        sys.exit(1)
+    
+
Index: trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-remctl-update
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-remctl-update	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-remctl-update	(revision 315)
@@ -0,0 +1,124 @@
+#!/bin/sh
+DIR=/etc/remctl/sipb-xen-auto
+TEMPLATE=$DIR/conf.template
+MACHINEDIR=$DIR/machine.d
+MOIRADIR=$DIR/moira-acl
+MOIRATMP=$DIR/moira-tmp
+MACHINETMP=$DIR/machine-list-tmp
+AUTOMACHINELIST=$DIR/auto-machine-list
+AUTOMOIRALIST=$DIR/auto-moira-list
+BINDIR=/usr/sbin
+ACLDIR=$DIR/acl
+
+update_machine()
+{
+    machine="$1"
+    sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \
+	sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP"
+    if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then
+	mv "$MACHINETMP" "$MACHINEDIR/$machine"
+    else
+	rm -f "$MACHINETMP"
+    fi
+}
+
+update_moiragroup()
+{
+    group="$1"
+    # Should perhaps replace with LDAP, but fine for now.
+
+    # We should do more careful error checking so we don't take away
+    # all bits and delete the moira-acl files whenever there's an AFS
+    # outage.
+    pts membership system:"$group" -noauth | tail -n+2 | \
+	sed 's/\./\//' | \
+	sed 's/^  //' | \
+	sed 's/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP"
+    if test -s "$MOIRATMP"; then
+	if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then
+	    mv "$MOIRATMP" "$MOIRADIR/$group"
+	fi
+    else
+	if test -e "$MOIRADIR/$group"; then
+	    rm "$MOIRADIR/$group"
+	fi
+    fi
+    rm -f "$MOIRATMP"
+}
+
+check_machine_name()
+{
+    machinename="$1"
+    if ! perl -0e 'exit($ARGV[0] !~ /^[A-Za-z0-9][A-Za-z0-9._-]*$/)' -- "$machinename"; then
+	echo "Bad machine name"
+	exit 1
+    fi
+}
+
+case "$1" in
+    moiragroup)
+	update_moiragroup "$2"
+	;;
+
+    all_machines)
+        # update the remctl.conf definitions
+	for machine in `cat "$AUTOMACHINELIST"`; do
+	    update_machine "$machine"
+	done
+	;;
+    all_moira)
+        # update our moira ACL lists
+	for group in `cat "$AUTOMOIRALIST"`; do
+	    update_moiragroup "$group"
+	done
+	;;
+    auto_machine_list)
+        # update the list of maintained machines
+	/bin/ls "$ACLDIR" >| "$AUTOMACHINELIST"
+	;;
+    auto_moira_list)
+        # update the moira list-of-lists
+        # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage
+
+	# This extracts the list of all moira lists we care about, and updates those.
+	grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST"
+	;;
+    unregister)
+	machine="$2"
+	check_machine_name "$machine"
+	rm -f "$ACLDIR"/"$machine"
+	rm -f "$MACHINEDIR"/"$machine"
+	"$0" web
+	;;
+    moveregister)
+        oldmachine="$2"
+        newmachine="$3"
+	check_machine_name "$oldmachine"
+	check_machine_name "$newmachine"
+        mv "$ACLDIR"/"$oldmachine" "$ACLDIR"/"$newmachine"
+        rm -f "$MACHINEDIR"/"$oldmachine"
+        "$0" web
+	;;
+    register)
+	machine="$2"
+	check_machine_name "$machine"
+	if [ -e "$ACLDIR"/"$machine" ]; then
+	    echo "Machine already registered"
+	    exit 1
+	fi
+	echo "include /etc/remctl/acl/web" > "$ACLDIR/$machine"
+	"$0" web
+	;;
+    web)
+	"$0" auto_machine_list
+	"$0" all_machines
+	;;	
+    remctl-moira-update|all)
+    	"$0" auto_machine_list
+	"$0" all_machines
+	"$0" auto_moira_list
+	"$0" all_moira
+	;;
+esac
+
+exit 0
Index: trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-vmcontrol
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-vmcontrol	(revision 315)
+++ trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-vmcontrol	(revision 315)
@@ -0,0 +1,43 @@
+#!/bin/sh
+# sipb-xen-vmcontrol MACHINE ACTION
+#
+# remctl should have already verified that the user is authorized to
+# control the machine.  So, we just need to execute the action requested.
+#
+# $0 and $1 come from the trusted remctl source.
+#
+# $2 and so on are user-provided, and thus sketchy.  I don't think we
+# need them for this script.
+
+ORIGMACHINE="$1"
+ACTION="$2"
+MACHINE="d_$ORIGMACHINE"
+
+case "$ACTION" in
+    list|vcpu-list|destroy|uptime|shutdown)
+        xm "$ACTION" "$MACHINE"
+	;;
+    install|create|reboot)
+	ARG="$3"
+	shift; shift; shift; MOREARGS="$*"
+	if [ "$ACTION" = "reboot" ]; then
+	    xm destroy "$MACHINE" 2>/dev/null
+	else
+	    xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1
+	fi
+	if [ "$ACTION" = "install" ]; then
+	    xm create sipb-database machine_name="$ORIGMACHINE" installer="$ARG" installer_options="$MOREARGS"
+	elif [ -n "$ARG" ]; then
+	    xm create sipb-database machine_name="$ORIGMACHINE" cdrom_image="$ARG"
+	else
+	    xm create sipb-database machine_name="$ORIGMACHINE"
+	fi
+	;;
+    list-long)
+	xm list --long "$MACHINE"
+	;;
+    *)
+        echo "ERROR: Invalid Command"
+        exit 1
+        ;;
+esac
