Index: /trunk/packages/invirt-remote-host/debian/changelog
===================================================================
--- /trunk/packages/invirt-remote-host/debian/changelog	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/changelog	(revision 1239)
@@ -0,0 +1,198 @@
+invirt-remote-host (0.0.1) unstable; urgency=low
+
+  * sipb-xen-remctl-auto -> invirt-remote-host
+
+ -- Evan Broder <broder@mit.edu>  Fri, 24 Oct 2008 21:54:35 -0400
+
+sipb-xen-remctl-auto (1.5.2) unstable; urgency=low
+
+  * sipb-xen-console-server -> invirt-console-host
+
+ -- Greg Price <price@mit.edu>  Fri, 24 Oct 2008 01:43:15 -0400
+
+sipb-xen-remctl-auto (1.5.1) unstable; urgency=low
+
+  * Return the new invalid-command error code in sipb-xen-vmcontrol
+
+ -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:51:34 -0400
+
+sipb-xen-remctl-auto (1.5) unstable; urgency=low
+
+  * Distinguish between Xen errors and invalid commands by returning a
+    completely outlandish error code that's not likely to conflict with
+    anything
+
+ -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:47:50 -0400
+
+sipb-xen-remctl-auto (1.4) unstable; urgency=low
+
+  * Correctly extract the CDROM image from the remctl arguments
+
+ -- Evan Broder <broder@mit.edu>  Sat, 18 Oct 2008 17:19:57 -0400
+
+sipb-xen-remctl-auto (1.3.1) unstable; urgency=low
+
+  * Quote the installer arguments correctly
+
+ -- Evan Broder <broder@mit.edu>  Fri, 10 Oct 2008 01:47:54 -0400
+
+sipb-xen-remctl-auto (1.3) unstable; urgency=low
+
+  * Respond to remctl install requests by passing the options onto Xen
+
+ -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 01:57:30 -0400
+
+sipb-xen-remctl-auto (1.2) unstable; urgency=low
+
+  * Exit successfully if inetd is already running; package fails to
+    install otherwise
+
+ -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 05:03:18 -0400
+
+sipb-xen-remctl-auto (1.1) unstable; urgency=low
+
+  * Explicitly lock a volume before deleting it
+
+ -- Evan Broder <broder@mit.edu>  Sun, 05 Oct 2008 18:01:34 -0400
+
+sipb-xen-remctl-auto (1.0.21) unstable; urgency=low
+
+  * start inetd too in init script
+
+ -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 20:43:29 -0400
+
+sipb-xen-remctl-auto (1.0.20) unstable; urgency=low
+
+  * generate config files using mako
+
+ -- Yang Zhang <y_z@mit.edu>  Thu, 14 Aug 2008 15:18:46 -0400
+
+sipb-xen-remctl-auto (1.0.19) unstable; urgency=low
+
+  * simplify the init script a la sipb-xen-dev
+
+ -- Yang Zhang <y_z@mit.edu>  Thu,  7 Aug 2008 22:09:28 -0400
+
+sipb-xen-remctl-auto (1.0.18) unstable; urgency=low
+
+  * use invirt config in sipb-xen-lvm
+  * added .init script to generate /etc/remctl/acl/remote
+  * sipb_xen_database -> invirt.database
+
+ -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 00:46:28 -0400
+
+sipb-xen-remctl-auto (1.0.17) unstable; urgency=low
+
+  * catch another version of the xenstore error in the listvms race
+
+ -- Greg Price <price@mit.edu>  Wed, 23 Jul 2008 01:12:01 -0400
+
+sipb-xen-remctl-auto (1.0.16) unstable; urgency=low
+
+  * support YAML as well as JSON (broder, quentin, andersk, long ago)
+  * fix a race in listvms when a machine is shutting down
+
+ -- Greg Price <price@mit.edu>  Tue, 22 Jul 2008 23:46:49 -0400
+
+sipb-xen-remctl-auto (1.0.15) unstable; urgency=low
+
+  * Compute time differences on server to avoid drift
+
+ -- Quentin Smith <quentin@mit.edu>  Thu, 15 May 2008 20:58:04 -0400
+
+sipb-xen-remctl-auto (1.0.14) unstable; urgency=low
+
+  * Use more efficient python API to get VM information, and return it
+    in a Python dict structure.
+
+ -- Quentin Smith <quentin@mit.edu>  Thu, 15 May 2008 20:29:03 -0400
+
+sipb-xen-remctl-auto (1.0.13) unstable; urgency=low
+
+  * Switch to just using the remote server.
+
+ -- Greg Price <price@mit.edu>  Sat, 10 May 2008 21:26:42 -0400
+
+sipb-xen-remctl-auto (1.0.12) unstable; urgency=low
+
+  * Remove an obsolete line from the remctl config.
+
+ -- Greg Price <price@mit.edu>  Sun,  4 May 2008 22:36:07 -0400
+
+sipb-xen-remctl-auto (1.0.11) unstable; urgency=low
+
+  * Close file descriptors for update-conserver on destroy/shutdown.
+
+ -- Eric Price <ecprice@pseudomyrmex.mit.edu>  Mon, 21 Apr 2008 21:28:12 -0400
+
+sipb-xen-remctl-auto (1.0.10) unstable; urgency=low
+
+  * Delay running sipb-xen-update-conserver
+
+ -- Evan Broder <broder@mit.edu>  Mon, 21 Apr 2008 20:26:28 -0400
+
+sipb-xen-remctl-auto (1.0.9) unstable; urgency=low
+
+  * Change the way that conserver is updated
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 04:36:04 -0400
+
+sipb-xen-remctl-auto (1.0.8) unstable; urgency=low
+
+  * Add support for updating conserver when VMs are turned on and off
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 00:40:23 -0400
+
+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/invirt-remote-host/debian/compat
===================================================================
--- /trunk/packages/invirt-remote-host/debian/compat	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/compat	(revision 1239)
@@ -0,0 +1,1 @@
+4
Index: /trunk/packages/invirt-remote-host/debian/control
===================================================================
--- /trunk/packages/invirt-remote-host/debian/control	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/control	(revision 1239)
@@ -0,0 +1,13 @@
+Source: invirt-remote-host
+Section: net
+Priority: extra
+Maintainer: SIPB Xen Project <sipb-xen@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.2.0)
+Standards-Version: 3.8.0
+
+Package: invirt-remote-host
+Architecture: all
+Depends: ${misc:Depends}, remctl-server, invirt-console-host, python-cjson, python-yaml
+Description: Installs the Invirt host remctl configuration
+ This is the remctl configuration for an Invirt host. It allows any
+ commands to be run from the Invirt remote server
Index: /trunk/packages/invirt-remote-host/debian/copyright
===================================================================
--- /trunk/packages/invirt-remote-host/debian/copyright	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/copyright	(revision 1239)
@@ -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: /trunk/packages/invirt-remote-host/debian/invirt-remote-host.init
===================================================================
--- /trunk/packages/invirt-remote-host/debian/invirt-remote-host.init	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/invirt-remote-host.init	(revision 1239)
@@ -0,0 +1,36 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          invirt-remote-host
+# 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: remctl configuration for an Invirt host
+# Description:
+### END INIT INFO 
+
+PACKAGE=invirt-remote-host
+
+. /lib/lsb/init-functions
+
+gen_config()
+{
+    for i in /etc/remctl/acl/remote
+    do mako-render $i.mako > $i
+    done
+}
+
+case "$1" in
+  start|reload|force-reload|restart)
+    log_begin_msg "Reloading config for $PACKAGE"
+    gen_config
+    log_end_msg $?
+    /etc/init.d/openbsd-inetd start # returns 1 if inetd is running
+    [ $? -eq 1 ] && exit 0
+    ;;
+  stop)
+    ;;
+  *)
+    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
+    ;;
+esac
Index: /trunk/packages/invirt-remote-host/debian/invirt-remote-host.install
===================================================================
--- /trunk/packages/invirt-remote-host/debian/invirt-remote-host.install	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/invirt-remote-host.install	(revision 1239)
@@ -0,0 +1,1 @@
+files/* .
Index: /trunk/packages/invirt-remote-host/debian/rules
===================================================================
--- /trunk/packages/invirt-remote-host/debian/rules	(revision 1239)
+++ /trunk/packages/invirt-remote-host/debian/rules	(revision 1239)
@@ -0,0 +1,3 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Index: /trunk/packages/invirt-remote-host/files/etc/remctl/acl/remote.mako
===================================================================
--- /trunk/packages/invirt-remote-host/files/etc/remctl/acl/remote.mako	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/etc/remctl/acl/remote.mako	(revision 1239)
@@ -0,0 +1,2 @@
+<% from invirt.config import structs as cfg %>\
+host/${cfg.remote.hostname}@${cfg.authn[0].realm}
Index: /trunk/packages/invirt-remote-host/files/etc/remctl/conf.d/invirt-remote-host
===================================================================
--- /trunk/packages/invirt-remote-host/files/etc/remctl/conf.d/invirt-remote-host	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/etc/remctl/conf.d/invirt-remote-host	(revision 1239)
@@ -0,0 +1,2 @@
+remote web     /usr/sbin/invirt-remote /etc/remctl/acl/remote
+remote control /usr/sbin/invirt-remote /etc/remctl/acl/remote
Index: /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-listvms
===================================================================
--- /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-listvms	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-listvms	(revision 1239)
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import sys
+import time
+from xen.lowlevel import xs
+
+xsc = xs.xs()
+
+def live_vms():
+    domids = set(xsc.ls('', '/local/domain'))
+    domids.discard('0')
+
+    vms = dict()
+
+    for domid in domids:
+        try:
+            name, data = get_dom(int(domid))
+        except (xs.Error, TypeError):
+            continue # went down since we started
+        if name.startswith('d_'):
+            name = name[2:]
+            vms[name] = data
+    return vms
+
+def get_dom(domid):
+    name = xsc.read('', '/local/domain/%d/name' % domid)
+    data = dict()
+    data['domid'] = domid
+    # presence of a graphical console
+    data['console'] = xsc.read('', '/local/domain/%d/device/vfb/0/state' % domid)
+    # uptime
+    data['vm'] = xsc.read('', '/local/domain/%d/vm' % domid)
+    data['start_time'] = float(xsc.read('', '%s/start_time' % data['vm']))
+    data['uptime'] = time.time()-data['start_time']
+    
+    return name, data
+
+if __name__ == '__main__':
+    vms = live_vms()
+    if '--json' in sys.argv[1:]:
+        import cjson
+        print cjson.encode(vms)
+    elif '--pickle' in sys.argv[1:]:
+        import cPickle
+        cPickle.dump(vms, sys.stdout, cPickle.HIGHEST_PROTOCOL)
+    else:
+        import yaml
+        print yaml.dump(vms, Dumper=yaml.CSafeDumper, default_flow_style=False)
Index: /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-lvm
===================================================================
--- /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-lvm	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-lvm	(revision 1239)
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+from subprocess import call, PIPE, Popen
+from invirt.config import structs as config
+
+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 invirt import database
+    import re
+    database.connect()
+    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":
+    def error():
+        print >>sys.stderr, "Error removing LV %s\n" % lvname
+        sys.exit(1)
+    rv = call(["/sbin/lvchange", "-a", "n", lvpath])
+    if rv != 0:
+        error()
+    rv = call(["/sbin/lvchange", "-a", "ey", lvpath])
+    if rv != 0:
+        error()
+    rv = call(["/sbin/lvremove", "--force", lvpath])
+    if rv != 0:
+        error()
+    ensureoff(machine)
+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/invirt-remote-host/files/usr/sbin/invirt-remote
===================================================================
--- /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-remote	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-remote	(revision 1239)
@@ -0,0 +1,41 @@
+#!/bin/sh
+# invirt-remote TYPE SERVICE [ARGS...]
+#
+# We carry out the remctl command proxied to us by the remote-control server.
+
+TYPE="$1"
+SERVICE="$2"
+shift; shift;
+
+case "$TYPE" in
+    control)
+        # $SERVICE is hostname
+        COMMAND=/usr/sbin/invirt-vmcontrol
+	;;
+    web)
+        case "$SERVICE" in
+            lvcreate|lvremove|lvrename|lvresize)
+                COMMAND=/usr/sbin/invirt-lvm
+	        ;;
+            vmboot)
+                COMMAND=/usr/sbin/invirt-vmcontrol
+	        ;;
+            listvms)
+                COMMAND=/usr/sbin/invirt-listvms
+	        ;;
+	    info)
+		COMMAND=/usr/sbin/xm
+		;;
+            *)
+                echo "ERROR: invalid subcommand"
+                exit 34
+                ;;
+        esac
+	;;
+    *)
+        echo "ERROR: invalid command"
+        exit 34
+        ;;
+esac
+
+$COMMAND "$SERVICE" "$@"
Index: /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-vmcontrol
===================================================================
--- /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-vmcontrol	(revision 1239)
+++ /trunk/packages/invirt-remote-host/files/usr/sbin/invirt-vmcontrol	(revision 1239)
@@ -0,0 +1,47 @@
+#!/bin/bash
+# invirt-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|uptime)
+        xm "$ACTION" "$MACHINE"
+	;;
+    destroy|shutdown)
+	xm "$ACTION" "$MACHINE"
+	/usr/sbin/invirt-update-conserver </dev/null >/dev/null 2>&1 &
+	;;
+    install|create|reboot)
+	shift; shift;
+	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_options="$(printf '%q ' "$@")"
+	elif [ -n "$1" ]; then
+	    xm create sipb-database machine_name="$ORIGMACHINE" cdrom_image="$1"
+	else
+	    xm create sipb-database machine_name="$ORIGMACHINE"
+	fi
+	(sleep 4; /usr/sbin/invirt-update-conserver) </dev/null >/dev/null 2>&1 &
+	;;
+    list-long)
+	xm list --long "$MACHINE"
+	;;
+    *)
+        echo "ERROR: Invalid Command"
+        exit 34
+        ;;
+esac
Index: unk/packages/sipb-xen-remctl-auto/debian/changelog
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/changelog	(revision 1238)
+++ 	(revision )
@@ -1,192 +1,0 @@
-sipb-xen-remctl-auto (1.5.2) unstable; urgency=low
-
-  * sipb-xen-console-server -> invirt-console-host
-
- -- Greg Price <price@mit.edu>  Fri, 24 Oct 2008 01:43:15 -0400
-
-sipb-xen-remctl-auto (1.5.1) unstable; urgency=low
-
-  * Return the new invalid-command error code in sipb-xen-vmcontrol
-
- -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:51:34 -0400
-
-sipb-xen-remctl-auto (1.5) unstable; urgency=low
-
-  * Distinguish between Xen errors and invalid commands by returning a
-    completely outlandish error code that's not likely to conflict with
-    anything
-
- -- Evan Broder <broder@mit.edu>  Wed, 22 Oct 2008 00:47:50 -0400
-
-sipb-xen-remctl-auto (1.4) unstable; urgency=low
-
-  * Correctly extract the CDROM image from the remctl arguments
-
- -- Evan Broder <broder@mit.edu>  Sat, 18 Oct 2008 17:19:57 -0400
-
-sipb-xen-remctl-auto (1.3.1) unstable; urgency=low
-
-  * Quote the installer arguments correctly
-
- -- Evan Broder <broder@mit.edu>  Fri, 10 Oct 2008 01:47:54 -0400
-
-sipb-xen-remctl-auto (1.3) unstable; urgency=low
-
-  * Respond to remctl install requests by passing the options onto Xen
-
- -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 01:57:30 -0400
-
-sipb-xen-remctl-auto (1.2) unstable; urgency=low
-
-  * Exit successfully if inetd is already running; package fails to
-    install otherwise
-
- -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 05:03:18 -0400
-
-sipb-xen-remctl-auto (1.1) unstable; urgency=low
-
-  * Explicitly lock a volume before deleting it
-
- -- Evan Broder <broder@mit.edu>  Sun, 05 Oct 2008 18:01:34 -0400
-
-sipb-xen-remctl-auto (1.0.21) unstable; urgency=low
-
-  * start inetd too in init script
-
- -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 20:43:29 -0400
-
-sipb-xen-remctl-auto (1.0.20) unstable; urgency=low
-
-  * generate config files using mako
-
- -- Yang Zhang <y_z@mit.edu>  Thu, 14 Aug 2008 15:18:46 -0400
-
-sipb-xen-remctl-auto (1.0.19) unstable; urgency=low
-
-  * simplify the init script a la sipb-xen-dev
-
- -- Yang Zhang <y_z@mit.edu>  Thu,  7 Aug 2008 22:09:28 -0400
-
-sipb-xen-remctl-auto (1.0.18) unstable; urgency=low
-
-  * use invirt config in sipb-xen-lvm
-  * added .init script to generate /etc/remctl/acl/remote
-  * sipb_xen_database -> invirt.database
-
- -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 00:46:28 -0400
-
-sipb-xen-remctl-auto (1.0.17) unstable; urgency=low
-
-  * catch another version of the xenstore error in the listvms race
-
- -- Greg Price <price@mit.edu>  Wed, 23 Jul 2008 01:12:01 -0400
-
-sipb-xen-remctl-auto (1.0.16) unstable; urgency=low
-
-  * support YAML as well as JSON (broder, quentin, andersk, long ago)
-  * fix a race in listvms when a machine is shutting down
-
- -- Greg Price <price@mit.edu>  Tue, 22 Jul 2008 23:46:49 -0400
-
-sipb-xen-remctl-auto (1.0.15) unstable; urgency=low
-
-  * Compute time differences on server to avoid drift
-
- -- Quentin Smith <quentin@mit.edu>  Thu, 15 May 2008 20:58:04 -0400
-
-sipb-xen-remctl-auto (1.0.14) unstable; urgency=low
-
-  * Use more efficient python API to get VM information, and return it
-    in a Python dict structure.
-
- -- Quentin Smith <quentin@mit.edu>  Thu, 15 May 2008 20:29:03 -0400
-
-sipb-xen-remctl-auto (1.0.13) unstable; urgency=low
-
-  * Switch to just using the remote server.
-
- -- Greg Price <price@mit.edu>  Sat, 10 May 2008 21:26:42 -0400
-
-sipb-xen-remctl-auto (1.0.12) unstable; urgency=low
-
-  * Remove an obsolete line from the remctl config.
-
- -- Greg Price <price@mit.edu>  Sun,  4 May 2008 22:36:07 -0400
-
-sipb-xen-remctl-auto (1.0.11) unstable; urgency=low
-
-  * Close file descriptors for update-conserver on destroy/shutdown.
-
- -- Eric Price <ecprice@pseudomyrmex.mit.edu>  Mon, 21 Apr 2008 21:28:12 -0400
-
-sipb-xen-remctl-auto (1.0.10) unstable; urgency=low
-
-  * Delay running sipb-xen-update-conserver
-
- -- Evan Broder <broder@mit.edu>  Mon, 21 Apr 2008 20:26:28 -0400
-
-sipb-xen-remctl-auto (1.0.9) unstable; urgency=low
-
-  * Change the way that conserver is updated
-
- -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 04:36:04 -0400
-
-sipb-xen-remctl-auto (1.0.8) unstable; urgency=low
-
-  * Add support for updating conserver when VMs are turned on and off
-
- -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 00:40:23 -0400
-
-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: unk/packages/sipb-xen-remctl-auto/debian/compat
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/compat	(revision 1238)
+++ 	(revision )
@@ -1,1 +1,0 @@
-4
Index: unk/packages/sipb-xen-remctl-auto/debian/control
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/control	(revision 1238)
+++ 	(revision )
@@ -1,12 +1,0 @@
-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.2.0)
-Standards-Version: 3.7.2
-
-Package: sipb-xen-remctl-auto
-Architecture: all
-Depends: ${misc:Depends}, remctl-server, invirt-console-host, python-cjson, python-yaml
-Description: Installs the SIPB Xen automatic remctl management system
- This is our automatic remctl configuration management system.
Index: unk/packages/sipb-xen-remctl-auto/debian/control.in
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/control.in	(revision 1238)
+++ 	(revision )
@@ -1,12 +1,0 @@
-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, invirt-console-host, python-cjson, python-yaml
-Description: Installs the SIPB Xen automatic remctl management system
- This is our automatic remctl configuration management system.
Index: unk/packages/sipb-xen-remctl-auto/debian/copyright
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/copyright	(revision 1238)
+++ 	(revision )
@@ -1,16 +1,0 @@
-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: unk/packages/sipb-xen-remctl-auto/debian/rules
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/rules	(revision 1238)
+++ 	(revision )
@@ -1,4 +1,0 @@
-#!/usr/bin/make -f
-
-DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1
-include /usr/share/cdbs/1/rules/debhelper.mk
Index: unk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.init
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.init	(revision 1238)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          sipb-xen-remctl-auto
-# 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: conserver config from invirt config for invirt host
-# Description:
-### END INIT INFO 
-
-PACKAGE=sipb-xen-remctl-auto
-
-. /lib/lsb/init-functions
-
-gen_config()
-{
-    for i in /etc/remctl/acl/remote
-    do mako-render $i.mako > $i
-    done
-}
-
-case "$1" in
-  start|reload|force-reload|restart)
-    log_begin_msg "Reloading config for $PACKAGE"
-    gen_config
-    log_end_msg $?
-    /etc/init.d/openbsd-inetd start # returns 1 if inetd is running
-    [ $? -eq 1 ] && exit 0
-    ;;
-  stop)
-    ;;
-  *)
-    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
-    ;;
-esac
Index: unk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.install
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.install	(revision 1238)
+++ 	(revision )
@@ -1,1 +1,0 @@
-files/* .
Index: unk/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 1238)
+++ 	(revision )
@@ -1,10 +1,0 @@
-# /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: unk/packages/sipb-xen-remctl-auto/files/etc/remctl/acl/remote.mako
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/acl/remote.mako	(revision 1238)
+++ 	(revision )
@@ -1,2 +1,0 @@
-<% from invirt.config import structs as cfg %>\
-host/${cfg.remote.hostname}@${cfg.authn[0].realm}
Index: unk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-remote
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-remote	(revision 1238)
+++ 	(revision )
@@ -1,2 +1,0 @@
-remote web     /usr/sbin/sipb-xen-remote /etc/remctl/acl/remote
-remote control /usr/sbin/sipb-xen-remote /etc/remctl/acl/remote
Index: unk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot	(revision 1238)
+++ 	(revision )
@@ -1,9 +1,0 @@
-#!/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: unk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms	(revision 1238)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#!/usr/bin/python
-
-import sys
-import time
-sys.path.insert(0, '/usr/lib/xen-3.1-1/lib/python')
-from xen.lowlevel import xs
-
-xsc = xs.xs()
-
-def live_vms():
-    domids = set(xsc.ls('', '/local/domain'))
-    domids.discard('0')
-
-    vms = dict()
-
-    for domid in domids:
-        try:
-            name, data = get_dom(int(domid))
-        except (xs.Error, TypeError):
-            continue # went down since we started
-        if name.startswith('d_'):
-            name = name[2:]
-            vms[name] = data
-    return vms
-
-def get_dom(domid):
-    name = xsc.read('', '/local/domain/%d/name' % domid)
-    data = dict()
-    data['domid'] = domid
-    # presence of a graphical console
-    data['console'] = xsc.read('', '/local/domain/%d/device/vfb/0/state' % domid)
-    # uptime
-    data['vm'] = xsc.read('', '/local/domain/%d/vm' % domid)
-    data['start_time'] = float(xsc.read('', '%s/start_time' % data['vm']))
-    data['uptime'] = time.time()-data['start_time']
-    
-    return name, data
-
-if __name__ == '__main__':
-    vms = live_vms()
-    if '--json' in sys.argv[1:]:
-        import cjson
-        print cjson.encode(vms)
-    elif '--pickle' in sys.argv[1:]:
-        import cPickle
-        cPickle.dump(vms, sys.stdout, cPickle.HIGHEST_PROTOCOL)
-    else:
-        import yaml
-        print yaml.dump(vms, Dumper=yaml.CSafeDumper, default_flow_style=False)
Index: unk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm	(revision 1238)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#!/usr/bin/env python
-
-import sys
-import os.path
-from subprocess import call, PIPE, Popen
-from invirt.config import structs as config
-
-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 invirt import database
-    import re
-    database.connect()
-    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":
-    def error():
-        print >>sys.stderr, "Error removing LV %s\n" % lvname
-        sys.exit(1)
-    rv = call(["/sbin/lvchange", "-a", "n", lvpath])
-    if rv != 0:
-        error()
-    rv = call(["/sbin/lvchange", "-a", "ey", lvpath])
-    if rv != 0:
-        error()
-    rv = call(["/sbin/lvremove", "--force", lvpath])
-    if rv != 0:
-        error()
-    ensureoff(machine)
-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: unk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-remote
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-remote	(revision 1238)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#!/bin/sh
-# sipb-xen-remote TYPE SERVICE [ARGS...]
-#
-# We carry out the remctl command proxied to us by the remote-control server.
-
-TYPE="$1"
-SERVICE="$2"
-shift; shift;
-
-case "$TYPE" in
-    control)
-        # $SERVICE is hostname
-        COMMAND=/usr/sbin/sipb-xen-vmcontrol
-	;;
-    web)
-        case "$SERVICE" in
-            lvcreate|lvremove|lvrename|lvresize)
-                COMMAND=/usr/sbin/sipb-xen-lvm
-	        ;;
-            vmboot)
-                COMMAND=/usr/sbin/sipb-xen-vmcontrol
-	        ;;
-            listvms)
-                COMMAND=/usr/sbin/sipb-xen-listvms
-	        ;;
-	    info)
-		COMMAND=/usr/sbin/xm
-		;;
-            *)
-                echo "ERROR: invalid subcommand"
-                exit 34
-                ;;
-        esac
-	;;
-    *)
-        echo "ERROR: invalid command"
-        exit 34
-        ;;
-esac
-
-#echo $COMMAND "$SERVICE" "$@"
-$COMMAND "$SERVICE" "$@"
Index: unk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-vmcontrol
===================================================================
--- /trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-vmcontrol	(revision 1238)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#!/bin/bash
-# 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|uptime)
-        xm "$ACTION" "$MACHINE"
-	;;
-    destroy|shutdown)
-	xm "$ACTION" "$MACHINE"
-	/usr/sbin/sipb-xen-update-conserver </dev/null >/dev/null 2>&1 &
-	;;
-    install|create|reboot)
-	shift; shift;
-	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_options="$(printf '%q ' "$@")"
-	elif [ -n "$1" ]; then
-	    xm create sipb-database machine_name="$ORIGMACHINE" cdrom_image="$1"
-	else
-	    xm create sipb-database machine_name="$ORIGMACHINE"
-	fi
-	(sleep 4; /usr/sbin/sipb-xen-update-conserver) </dev/null >/dev/null 2>&1 &
-	;;
-    list-long)
-	xm list --long "$MACHINE"
-	;;
-    *)
-        echo "ERROR: Invalid Command"
-        exit 34
-        ;;
-esac
