Index: /package_tags/invirt-remote-server/0.0.11/debian/changelog
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/changelog	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/changelog	(revision 1412)
@@ -0,0 +1,171 @@
+invirt-remote-server (0.0.11) unstable; urgency=low
+
+  * Don't proxy requests for the VNC cert if the requested hostname isn't
+    an Invirt host
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 23:17:10 -0400
+
+invirt-remote-server (0.0.10) unstable; urgency=low
+
+  * All remctls of type 'web' have the same ACL - glob them together
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 23:05:42 -0400
+
+invirt-remote-server (0.0.9) unstable; urgency=low
+
+  * Add support for a `web vnccert` remctl call
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 22:45:29 -0400
+
+invirt-remote-server (0.0.8) unstable; urgency=low
+
+  * sipb-xen-base -> invirt-base
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 04:23:32 -0400
+
+invirt-remote-server (0.0.7) unstable; urgency=low
+
+  * sipb-xen-database-common -> invirt-database
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 21:03:13 -0400
+
+invirt-remote-server (0.0.6) unstable; urgency=low
+
+  * Remove dependency on sipb-xen-chrony-config - we need to take care of
+    the clock, but chrony isn't the right answer
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 19:16:08 -0400
+
+invirt-remote-server (0.0.5) unstable; urgency=low
+
+  * Rename a remaining sipb-xen file to invirt
+
+ -- Evan Broder <broder@mit.edu>  Fri, 24 Oct 2008 22:21:30 -0400
+
+invirt-remote-server (0.0.4) unstable; urgency=low
+
+  * Kill DEB_AUTO_UPDATE_DEBIAN_CONTROL
+
+ -- Evan Broder <broder@mit.edu>  Fri, 24 Oct 2008 13:49:45 -0400
+
+invirt-remote-server (0.0.3) unstable; urgency=low
+
+  * Standardize on "Invirt project"
+
+ -- Evan Broder <broder@mit.edu>  Fri, 24 Oct 2008 13:33:25 -0400
+
+invirt-remote-server (0.0.2) unstable; urgency=low
+
+  * oops, update control from control.in
+  * configurize web acl
+
+ -- Greg Price <price@mit.edu>  Fri, 24 Oct 2008 00:28:08 -0400
+
+invirt-remote-server (0.0.1) unstable; urgency=low
+
+  * sipb-xen -> invirt
+
+ -- Greg Price <price@mit.edu>  Thu, 23 Oct 2008 23:58:36 -0400
+
+sipb-xen-remote-server (0.10.2) unstable; urgency=low
+
+  * There's a race condition for if the VM gets powered off between the
+    listvms and the actual request. Solve the problem correctly by using a
+    non-conflicting error code to indicate an invalid command
+
+ -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:46:38 -0400
+
+sipb-xen-remote-server (0.10.1) unstable; urgency=low
+
+  * Make both list-host and listhost valid commands, and for parity with
+    list-long, document list-host
+
+ -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:36:32 -0400
+
+sipb-xen-remote-server (0.10) unstable; urgency=low
+
+  * If a command is invalid, but the machine's on, give an actually useful
+    error message
+
+ -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:29:50 -0400
+
+sipb-xen-remote-server (0.9.2) unstable; urgency=low
+
+  * Expose an interface to the autoinstaller over remctl
+  * Validate options to be passed to the autoinstaller on the remctl
+    server
+
+ -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 02:06:00 -0400
+
+sipb-xen-remote-server (0.9.1) unstable; urgency=low
+
+  * Fix a bug in the database handling code
+
+ -- Evan Broder <broder@mit.edu>  Fri, 03 Oct 2008 18:42:48 -0400
+
+sipb-xen-remote-server (0.9) unstable; urgency=low
+
+  [Evan Broder]
+  * Make the acl/ subdir of RemConfFS listable
+  
+  [Greg Price]
+  * Update RemConfFS for new SQLAlchemy code
+
+ -- Evan Broder <broder@mit.edu>  Wed, 01 Oct 2008 19:28:23 -0400
+
+sipb-xen-remote-server (0.8) unstable; urgency=low
+
+  * Use RouteFS for RemConfFS
+
+ -- Evan Broder <broder@mit.edu>  Wed, 01 Oct 2008 02:21:00 -0400
+
+sipb-xen-remote-server (0.7) unstable; urgency=low
+
+  * depend on sipb-xen-base
+
+ -- Greg Price <price@mit.edu>  Tue, 30 Sep 2008 20:47:05 -0400
+
+sipb-xen-remote-server (0.6) unstable; urgency=low
+
+  * sipb_xen_database -> invirt.config
+
+ -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 00:54:59 -0400
+
+sipb-xen-remote-server (0.5) unstable; urgency=low
+
+  * use invirt config in sipb-xen-remconffs, sipb-xen-remctl-help,
+    sipb-xen-remote-proxy
+
+ -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 00:32:59 -0400
+
+sipb-xen-remote-server (0.4) unstable; urgency=low
+
+  * use invirt.config to get hostnames
+  * refactoring: extracted bcast() function into invirt.remote package
+
+ -- Yang Zhang <y_z@mit.edu>  Sat,  2 Aug 2008 20:34:50 -0400
+
+sipb-xen-remote-server (0.3) unstable; urgency=low
+
+  * Fill in all the code to make the package work (mostly weeks ago.)
+  * sipb-xen-remote-listvms aggregates listvms across hosts (with
+    y_z, broder, andersk)
+  * sipb-xen-remctl-help gives help
+  * sipb-xen-remote-control proxies to where a machine is running
+  * sipb-xen-remote-create chooses where to boot by load-balancing
+
+ -- Greg Price <price@mit.edu>  Thu, 24 Jul 2008 21:34:20 -0400
+
+sipb-xen-remote-server (0.2) unstable; urgency=low
+
+  * FUSE filesystem for remctl configuration.
+  * Remove *register calls, since the FUSE keeps things up to date.
+  * An init script to keep the FUSE fs up.
+
+ -- Greg Price <price@mit.edu>  Sat, 10 May 2008 22:04:32 -0400
+
+sipb-xen-remote-server (0.1) unstable; urgency=low
+
+  * First draft.
+
+ -- Greg Price <price@mit.edu>  Sun, 30 Mar 2008 01:08:50 -0400
Index: /package_tags/invirt-remote-server/0.0.11/debian/compat
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/compat	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/compat	(revision 1412)
@@ -0,0 +1,1 @@
+5
Index: /package_tags/invirt-remote-server/0.0.11/debian/control
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/control	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/control	(revision 1412)
@@ -0,0 +1,14 @@
+Source: invirt-remote-server
+Section: servers
+Priority: important
+Maintainer: invirt@mit.edu
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: invirt-remote-server
+Architecture: all
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Depends: ${shlibs:Depends}, ${misc:Depends}, daemon, debathena-kerberos-config, fuse-utils, openssh-server, python-routefs, invirt-database, invirt-base, remctl-server, remctl-client
+Description: Invirt remote-control server
+ This package should be installed to set up the remote-control server.
Index: /package_tags/invirt-remote-server/0.0.11/debian/copyright
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/copyright	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/copyright	(revision 1412)
@@ -0,0 +1,16 @@
+This software was written as part of the Invirt project <invirt@mit.edu>.
+
+Copyright :
+
+  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.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in the file /usr/share/common-licenses/GPL.
Index: /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.init
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.init	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.init	(revision 1412)
@@ -0,0 +1,134 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          invirt-remote-server
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Invirt remctl configuration filesystem
+# Description:       
+### END INIT INFO
+
+# Author: Invirt project <invirt@mit.edu>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="the Invirt remctl configuration filesystem"
+NAME=invirt-remconffs
+DAEMON=/usr/sbin/invirt-remconffs
+DAEMON_ARGS="/etc/remctl/remconffs"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+gen_config()
+{
+	for i in /etc/remctl/acl/web; do
+		mako-render $i.mako > $i
+	done
+}
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	gen_config
+	modprobe fuse
+	daemon --running -n $NAME && return 1
+	daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+	daemon --stop -n $NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	# Many daemons don't delete their pidfiles when they exit.
+	rm -f $PIDFILE
+	umount "$DAEMON_ARGS"
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  #reload|force-reload)
+	#
+	# If do_reload() is not implemented then leave this commented out
+	# and leave 'force-reload' as an alias for 'restart'.
+	#
+	#log_daemon_msg "Reloading $DESC" "$NAME"
+	#do_reload
+	#log_end_msg $?
+	#;;
+  restart|force-reload)
+	#
+	# If the "reload" option is implemented then remove the
+	# 'force-reload' alias
+	#
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:
Index: /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.install
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.install	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/invirt-remote-server.install	(revision 1412)
@@ -0,0 +1,1 @@
+files/* .
Index: /package_tags/invirt-remote-server/0.0.11/debian/rules
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/debian/rules	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/debian/rules	(revision 1412)
@@ -0,0 +1,3 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Index: /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/acl/web.mako
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/acl/web.mako	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/acl/web.mako	(revision 1412)
@@ -0,0 +1,2 @@
+<% from invirt.config import structs as cfg %>\
+daemon/${cfg.web.hostname}@${cfg.authn[0].realm}\
Index: /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/invirt-web
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/invirt-web	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/invirt-web	(revision 1412)
@@ -0,0 +1,3 @@
+web ALL          /usr/sbin/invirt-remote-proxy-web /etc/remctl/acl/web
+control help	 /usr/sbin/invirt-remctl-help	ANYUSER
+help ALL	 /usr/sbin/invirt-remctl-help	ANYUSER
Index: /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/remconffs
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/remconffs	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/etc/remctl/conf.d/remconffs	(revision 1412)
@@ -0,0 +1,1 @@
+include /etc/remctl/remconffs/conf
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remconffs
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remconffs	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remconffs	(revision 1412)
@@ -0,0 +1,87 @@
+#!/usr/bin/python
+
+import routefs
+from routes import Mapper
+
+from syslog import *
+from time import time
+
+from invirt import database
+from invirt.config import structs as config
+
+class RemConfFS(routefs.RouteFS):
+	"""
+	RemConfFS creates a filesytem for configuring remctl, like this:
+	/
+	|-- acl
+	|   |-- machine1
+	|   ...
+	|   `-- machinen
+	`-- conf
+        
+	The machine list and the acls are drawn from a database.
+	"""
+	
+	def __init__(self, *args, **kw):
+		"""Initialize the filesystem and set it to allow_other access besides
+		the user who mounts the filesystem (i.e. root)
+		"""
+		super(RemConfFS, self).__init__(*args, **kw)
+		self.lasttime = time()
+		self.fuse_args.add("allow_other", True)
+		
+		openlog('invirt-remconffs ', LOG_PID, LOG_DAEMON)
+		
+		syslog(LOG_DEBUG, 'Init complete.')
+        
+        def make_map(self):
+                m = Mapper()
+                m.connect('', controller='getroot')
+                m.connect('acl', controller='getmachines')
+                m.connect('acl/:machine', controller='getacl')
+                m.connect('conf', controller='getconf')
+                return m
+        
+        def getroot(self, **kw):
+                return ['acl', 'conf']
+        
+	def getacl(self, machine, **kw):
+		"""Build the ACL file for a machine
+		"""
+		machine = database.Machine.query().filter_by(name=machine).one()
+		users = [acl.user for acl in machine.acl]
+		return "\n".join(map(self.userToPrinc, users)
+				 + ['include /etc/remctl/acl/web',
+				    ''])
+        
+	def getconf(self, **kw):
+		"""Build the master conf file, with all machines
+		"""
+		return '\n'.join("control %s /usr/sbin/invirt-remote-proxy-control"
+				 " /etc/remctl/remconffs/acl/%s"
+				 % (machine_name, machine_name)
+				 for machine_name in self.getmachines())+'\n'
+	
+	def getmachines(self, **kw):
+		"""Get the list of VMs in the database, clearing the cache if it's 
+		older than 15 seconds"""
+		if time() - self.lasttime > 15:
+			self.lasttime = time()
+			database.clear_cache()
+		return [machine.name for machine in database.session.query(database.Machine).all()]
+        
+	def userToPrinc(self, user):
+		"""Convert Kerberos v4-style names to v5-style and append a default
+		realm if none is specified
+		"""
+		if '@' in user:
+			(princ, realm) = user.split('@')
+		else:
+			princ = user
+			realm = config.authn[0].realm
+		
+		return princ.replace('.', '/') + '@' + realm
+
+if __name__ == '__main__':
+	database.connect()
+        routefs.main(RemConfFS)
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remctl-help
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remctl-help	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remctl-help	(revision 1412)
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+"""
+Help on using the Invirt remctl functions.
+"""
+import sys
+from invirt.config import structs as config
+
+help = [
+    ('list',      'show your VM\'s state (with xm list)'),
+    ('list-host',  'show on what host, if any, your VM is running'),
+    ('list-long', 'show your VM\'s state as an sexp (with xm list --long)'),
+    ('vcpu-list', 'show your VM\'s state (with xm vcpu-list)'),
+    ('uptime',    'show your VM\'s state (with xm uptime)'),
+    ('destroy',   'shut down your VM, hard (with xm destroy)'),
+    ('shutdown',  'shut down your VM, softly if paravm (with xm shutdown)'),
+    ('create',    'start up your VM (with xm create)'),
+    ('reboot',    'reboot your VM (with xm destroy and xm create)'),
+    ('install',   'autoinstall your VM (takes a series of key=value pairs; \n\t\tvalid arguments include mirror, dist, arch, imagesize,\n\t\tand noinstall)'),
+    #also CD images on create/reboot
+]
+helpdict = dict(help)
+
+
+def print_help(name, text):
+    print '  %-9s : %s' % (name, text)
+
+def main(args):
+    args = [n for n in args if n in helpdict]
+    print 'remctl %s control <machine> <command>' % config.remote.hostname
+    if args:
+        for name in args:
+            print_help(name, helpdict[name])
+    else:
+        for name, text in help:
+            print_help(name, text)
+        
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv[1:]))
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-control
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-control	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-control	(revision 1412)
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+"""
+Sends remctl commands about a running VM to the host it's running on.
+"""
+
+from subprocess import PIPE, Popen, call
+import sys
+import yaml
+
+def main(argv):
+    if len(argv) < 3:
+        print >>sys.stderr, "usage: invirt-remote-control <machine> <command>"
+        return 2
+    machine_name = argv[1]
+    command = argv[2]
+
+    p = Popen(['/usr/sbin/invirt-remote-proxy-web', 'listvms'], stdout=PIPE)
+    output = p.communicate()[0]
+    if p.returncode != 0:
+        raise RuntimeError("Command '%s' returned non-zero exit status %d"
+                           % ('invirt-remote-proxy-web', p.returncode)) 
+    vms = yaml.load(output, yaml.CSafeLoader)
+
+    if machine_name not in vms:
+        print >>sys.stderr, "machine '%s' is not on" % machine_name
+        return 1
+    host = vms[machine_name]['host']
+
+    p = Popen(['remctl', host, 'remote', 'control'] + argv[1:],
+              stdout=PIPE, stderr=PIPE)
+    (out, err) = p.communicate()
+    if p.returncode == 1:
+        print >>sys.stderr, "machine '%s' is not on" % machine_name
+        return 1
+    elif p.returncode == 34:
+        print >>sys.stderr, "ERROR: invalid command"
+        return 34
+    sys.stderr.write(err)
+    sys.stdout.write(out)
+    return p.returncode
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-create
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-create	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-create	(revision 1412)
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+
+"""
+Picks a host to "create" (boot) a VM on, and does so.
+
+Current load-balancing algorithm: wherever there's more free RAM.
+
+TODO: use a lock to avoid creating the same VM twice in a race
+"""
+
+from invirt.remote import bcast
+from subprocess import PIPE, Popen, call
+import sys
+import yaml
+
+def choose_host():
+    # Query each of the hosts.
+    # XXX will the output of 'xm info' always be parseable YAML?
+    results = bcast('info')
+    return max((int(o['free_memory']), s) for (s, o) in results)[1]
+
+def main(argv):
+    if len(argv) < 3:
+        print >> sys.stderr, "usage: invirt-remote-create <operation> <machine> [<other args...>]"
+        return 2
+    operation = argv[1]
+    machine_name = argv[2]
+    args = argv[3:]
+    
+    if operation == 'install':
+        options = dict(arg.split('=', 1) for arg in args)
+        valid_keys = set(('mirror', 'dist', 'arch', 'imagesize', 'noinstall'))
+        if not set(options.keys()).issubset(valid_keys):
+            print >> sys.stderr, "Invalid argument. Use the help command to see valid arguments to install"
+            return 1
+        if any(' ' in val for val in options.values()):
+            print >> sys.stderr, "Arguments to the autoinstaller cannot contain spaces"
+            return 1
+
+    p = Popen(['/usr/sbin/invirt-remote-proxy-web', 'listvms'], stdout=PIPE)
+    output = p.communicate()[0]
+    if p.returncode != 0:
+        raise RuntimeError("Command '%s' returned non-zero exit status %d"
+                           % ('invirt-remote-proxy-web', p.returncode)) 
+    vms = yaml.load(output, yaml.CSafeLoader)
+
+    if machine_name in vms:
+        host = vms[machine_name]['host']
+        print >> sys.stderr, ("machine '%s' is already running on host %s"
+                              % (machine_name, host))
+        return 1
+
+    host = choose_host()
+    print 'Creating on host %s...' % host
+    sys.stdout.flush()
+    return call(['remctl', host, 'remote', 'control',
+                 machine_name, operation] + args)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listhost
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listhost	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listhost	(revision 1412)
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+"""
+Say what host a running VM is on.
+"""
+
+from subprocess import PIPE, Popen, call
+import sys
+import yaml
+
+def main(argv):
+    if len(argv) < 2:
+        print >>sys.stderr, "usage: invirt-remote-listhost <machine>"
+        return 2
+    machine_name = argv[1]
+
+    p = Popen(['/usr/sbin/invirt-remote-proxy-web', 'listvms'], stdout=PIPE)
+    output = p.communicate()[0]
+    if p.returncode != 0:
+        raise RuntimeError("Command '%s' returned non-zero exit status %d"
+                           % ('invirt-remote-proxy-web', p.returncode)) 
+    vms = yaml.load(output, yaml.CSafeLoader)
+
+    if machine_name not in vms:
+        print >>sys.stderr, "machine '%s' is not on" % machine_name
+        return 2
+
+    print vms[machine_name]['host']
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvms
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvms	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvms	(revision 1412)
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+"""
+Collates the results of listvms from multiple VM servers.  Part of the xvm
+suite.
+"""
+
+from invirt.remote import bcast
+import sys
+import yaml
+
+def main(argv):
+    # Query each of the hosts.
+    results = filter(lambda (_, x): x is not None, bcast('listvms'))
+
+    # Merge the results and print.
+    merged = {}
+    for server, result in results:
+        for data in result.itervalues():
+            data['host'] = server
+        merged.update(result)
+
+    print yaml.dump(merged, Dumper=yaml.CSafeDumper, default_flow_style=False)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvmsd
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvmsd	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-listvmsd	(revision 1412)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+
+# NOTE: In development; not actually used yet.
+
+#Collates the results of listvms from multiple VM servers.  Part of the xvm
+#suite.
+
+use Net::Remctl ();
+use JSON;
+
+our @servers = qw/black-mesa.mit.edu sx-blade-2.mit.edu/;
+
+our %connections;
+
+sub openConnections() {
+    foreach (@servers) { openConnection($_); }
+}
+
+sub openConnection($) {
+    my ($server) = @_;
+    my $remctl = Net::Remctl->new;
+    $remctl->open($server)
+        or die "Cannot connect to $server: ", $remctl->error, "\n";
+    $connections{$server} = $remctl;
+}
+
+sub doListVMs() {
+    foreach my $remctl (values %connections) {
+	$remctl->command("remote", "web", "listvms", "--json");
+    }
+    my %vmstate;
+    foreach my $server (keys %connections) {
+	my $remctl = $connections{$server};
+	my $jsonData = '';
+	do {
+	    $output = $remctl->output;
+	    if ($output->type eq 'output') {
+		if ($output->stream == 1) {
+		    $jsonData .= $output->data;
+		} elsif ($output->stream == 2) {
+		    print STDERR $output->data;
+		}
+	    } elsif ($output->type eq 'error') {
+		warn $output->error, "\n";
+	    } elsif ($output->type eq 'status') {
+		if ($output->status != 0) {
+		    warn "Exit status was ".$output->status;
+		}
+	    } elsif ($output->type eq 'done') {
+		#next;
+	    } else {
+		die "Unknown output token from library: ", $output->type, "\n";
+	    }
+	} while ($output->type ne 'done');
+	my $vmlist = jsonToObj($jsonData);
+	foreach my $key (keys %$vmlist) {
+	    $vmstate{$key} = $vmlist->{$key};
+	    $vmstate{$key}{"host"} = $server;
+	}
+    }
+    return %vmstate;
+}
+
+openConnections();
+
+use Data::Dumper;
+use Benchmark;
+print Dumper({doListVMs()});
+timethis(100, sub {doListVMs()});
+
+# vim:et:sw=4:ts=4
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy	(revision 1412)
@@ -0,0 +1,28 @@
+#!/bin/bash
+# invoke as invirt-remote-proxy-$TYPE, with "TYPE" in the remctl sense.
+
+klist -s || kinit -k
+
+TYPE="${0##*-}"
+case "$TYPE" in
+    control )
+	MACHINE="$1"; SERVICE="$2"; shift; shift ;;
+    * )
+	SERVICE="$1"; shift ;;
+esac
+
+case "$TYPE/$SERVICE" in
+    web/listvms )
+	invirt-remote-listvms "$@" ;;
+    web/vnccert )
+        invirt-remote-vnccert "$@" ;;
+    control/create|control/install )
+	invirt-remote-create "$SERVICE" "$MACHINE" "$@" ;;
+    control/listhost|control/list-host )
+	invirt-remote-listhost "$MACHINE" "$@" ;;
+    control/* )
+	# Everything but create must go where the VM is already running.
+	invirt-remote-control "$MACHINE" "$SERVICE" "$@" ;;
+    * )
+	remctl "$(invirt-getconf hosts.0.hostname)" remote "$TYPE" "$SERVICE" "$@" ;;
+esac
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-control
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-control	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-control	(revision 1412)
@@ -0,0 +1,1 @@
+link invirt-remote-proxy
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-web
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-web	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-proxy-web	(revision 1412)
@@ -0,0 +1,1 @@
+link invirt-remote-proxy
Index: /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-vnccert
===================================================================
--- /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-vnccert	(revision 1412)
+++ /package_tags/invirt-remote-server/0.0.11/files/usr/sbin/invirt-remote-vnccert	(revision 1412)
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+"""
+Retrieves the VNC certificate from an Invirt host
+"""
+
+from invirt.config import structs as config
+from subprocess import Popen, call, PIPE
+import sys
+
+
+def main(argv):
+    if len(argv) < 2:
+        print >> sys.stderr, "usage: invirt-remote-vnccert <host>"
+        return 2
+    
+    host = argv[1]
+    
+    if host not in list(i.hostname for i in config.hosts):
+        print >> sys.stderr, "Invalid hostname specified"
+        return 1
+    
+    return call(['remctl', host, 'remote', 'web', 'vnccert'])
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
