From ef093d282bec26c1d55bc7dc979216deb3c0615b Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Wed, 1 Oct 2008 01:56:37 -0400
Subject: [PATCH 01/16] don't specify (old) version of postgresql

svn path=/trunk/packages/sipb-xen-database/; revision=972
---
 debian/changelog |    6 ++++++
 debian/control   |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0a128ed..ffceb5c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.22) unstable; urgency=low
+
+  * depend on postgresql without specifying old version 8.1
+
+ -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 01:55:49 -0400
+
 sipb-xen-database (10.21) unstable; urgency=low
 
   * fix distribution
diff --git a/debian/control b/debian/control
index c6231e1..5a94d1e 100644
--- a/debian/control
+++ b/debian/control
@@ -14,13 +14,13 @@ Description: Installs the SIPB Xen database schema files
 
 Package: sipb-xen-database-server
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, postgresql-8.1, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, adduser
+Depends: ${misc:Depends}, ${python:Depends}, postgresql, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, adduser
 Description: Installs the SIPB Xen database server
  This tracks all the user VMs and is accessed from the VM host
 
 Package: sipb-xen-database-client
 Architecture: all
-Depends: ${misc:Depends}, postgresql-client-8.1, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, python
+Depends: ${misc:Depends}, postgresql-client, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, python
 Description: Installs the SIPB Xen database configuration file
  This is a python xen configuration script that talks to the database
  to dynamically load xen domU configuration information
-- 
1.7.9.5


From d6af243d1320e0b258a088ff33e262b41594ad44 Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Wed, 1 Oct 2008 02:10:33 -0400
Subject: [PATCH 02/16] port to postgresql 8.3

svn path=/trunk/packages/sipb-xen-database/; revision=974
---
 debian/changelog                                   |    6 ++++++
 debian/control                                     |    4 ++--
 debian/rules                                       |    2 +-
 debian/sipb-xen-database-server.init               |    2 +-
 debian/sipb-xen-database-server.postinst           |    4 ++--
 .../postgresql/{8.1 => 8.3}/main/pg_hba.conf.mako  |    0
 .../{8.1 => 8.3}/main/postgresql.conf.invirt       |    6 +++---
 7 files changed, 15 insertions(+), 9 deletions(-)
 rename server/etc/postgresql/{8.1 => 8.3}/main/pg_hba.conf.mako (100%)
 rename server/etc/postgresql/{8.1 => 8.3}/main/postgresql.conf.invirt (98%)

diff --git a/debian/changelog b/debian/changelog
index ffceb5c..24d4405 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.23) unstable; urgency=low
+
+  * switch to postgresql 8.3, as 8.1 isn't in hardy
+
+ -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 02:09:43 -0400
+
 sipb-xen-database (10.22) unstable; urgency=low
 
   * depend on postgresql without specifying old version 8.1
diff --git a/debian/control b/debian/control
index 5a94d1e..cbd3229 100644
--- a/debian/control
+++ b/debian/control
@@ -14,13 +14,13 @@ Description: Installs the SIPB Xen database schema files
 
 Package: sipb-xen-database-server
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, postgresql, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, adduser
+Depends: ${misc:Depends}, ${python:Depends}, postgresql-8.3, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, adduser
 Description: Installs the SIPB Xen database server
  This tracks all the user VMs and is accessed from the VM host
 
 Package: sipb-xen-database-client
 Architecture: all
-Depends: ${misc:Depends}, postgresql-client, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, python
+Depends: ${misc:Depends}, postgresql-client-8.3, python-sqlalchemy, python-psycopg2, sipb-xen-database-common, python
 Description: Installs the SIPB Xen database configuration file
  This is a python xen configuration script that talks to the database
  to dynamically load xen domU configuration information
diff --git a/debian/rules b/debian/rules
index 5a27b33..c797897 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 
 DEB_DIVERT_EXTENSION = .invirt
 DEB_DIVERT_FILES_sipb-xen-database-server += \
-/etc/postgresql/8.1/main/postgresql.conf.invirt
+/etc/postgresql/8.3/main/postgresql.conf.invirt
 
 
 include /usr/share/cdbs/1/rules/debhelper.mk
diff --git a/debian/sipb-xen-database-server.init b/debian/sipb-xen-database-server.init
index b4f805e..be4831b 100644
--- a/debian/sipb-xen-database-server.init
+++ b/debian/sipb-xen-database-server.init
@@ -37,7 +37,7 @@ SCRIPTNAME=/etc/init.d/$NAME
 
 gen_config()
 {
-    for i in /etc/postgresql/8.1/main/pg_hba.conf
+    for i in /etc/postgresql/8.3/main/pg_hba.conf
              ; do
         mako-render $i.mako > $i
     done
diff --git a/debian/sipb-xen-database-server.postinst b/debian/sipb-xen-database-server.postinst
index faae517..cbc1061 100644
--- a/debian/sipb-xen-database-server.postinst
+++ b/debian/sipb-xen-database-server.postinst
@@ -35,8 +35,8 @@ case "$1" in
             su postgres -c 'createdb sipb_xen -O sipb-xen'   || true
             adduser --system sipb-xen
         fi
-	mako-render /etc/postgresql/8.1/main/pg_hba.conf.mako >/etc/postgresql/8.1/main/pg_hba.conf
-	/etc/init.d/postgresql-8.1 restart
+	mako-render /etc/postgresql/8.3/main/pg_hba.conf.mako >/etc/postgresql/8.3/main/pg_hba.conf
+	/etc/init.d/postgresql-8.3 restart
         su sipb-xen -s /bin/sh -c 'sipb-xen-database-tables create'
     ;;
 
diff --git a/server/etc/postgresql/8.1/main/pg_hba.conf.mako b/server/etc/postgresql/8.3/main/pg_hba.conf.mako
similarity index 100%
rename from server/etc/postgresql/8.1/main/pg_hba.conf.mako
rename to server/etc/postgresql/8.3/main/pg_hba.conf.mako
diff --git a/server/etc/postgresql/8.1/main/postgresql.conf.invirt b/server/etc/postgresql/8.3/main/postgresql.conf.invirt
similarity index 98%
rename from server/etc/postgresql/8.1/main/postgresql.conf.invirt
rename to server/etc/postgresql/8.3/main/postgresql.conf.invirt
index 0e8b0f8..9548b91 100644
--- a/server/etc/postgresql/8.1/main/postgresql.conf.invirt
+++ b/server/etc/postgresql/8.3/main/postgresql.conf.invirt
@@ -33,11 +33,11 @@
 # switch or PGDATA environment variable, represented here as ConfigDir.
 
 #data_directory = 'ConfigDir'		# use data in another directory
-hba_file = '/etc/postgresql/8.1/main/pg_hba.conf'	# host-based authentication file
-ident_file = '/etc/postgresql/8.1/main/pg_ident.conf'	# IDENT configuration file
+hba_file = '/etc/postgresql/8.3/main/pg_hba.conf'	# host-based authentication file
+ident_file = '/etc/postgresql/8.3/main/pg_ident.conf'	# IDENT configuration file
 
 # If external_pid_file is not explicitly set, no extra pid file is written.
-external_pid_file = '/var/run/postgresql/8.1-main.pid'		# write an extra pid file
+external_pid_file = '/var/run/postgresql/8.3-main.pid'		# write an extra pid file
 
 
 #---------------------------------------------------------------------------
-- 
1.7.9.5


From dc501507fe7a624b821aeef615ec515fe7250f15 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Wed, 1 Oct 2008 03:13:42 -0400
Subject: [PATCH 03/16] Update sipb-xen-database for Postgres 8.3

svn path=/trunk/packages/sipb-xen-database/; revision=976
---
 debian/changelog                                   |    6 +
 .../etc/postgresql/8.3/main/postgresql.conf.invirt |  388 ++++++++++++--------
 2 files changed, 231 insertions(+), 163 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 24d4405..657db3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.24) unstable; urgency=low
+
+  * Update postgresql.conf for Hardy
+
+ -- Evan Broder <broder@mit.edu>  Wed, 01 Oct 2008 03:12:36 -0400
+
 sipb-xen-database (10.23) unstable; urgency=low
 
   * switch to postgresql 8.3, as 8.1 isn't in hardy
diff --git a/server/etc/postgresql/8.3/main/postgresql.conf.invirt b/server/etc/postgresql/8.3/main/postgresql.conf.invirt
index 9548b91..4883c2d 100644
--- a/server/etc/postgresql/8.3/main/postgresql.conf.invirt
+++ b/server/etc/postgresql/8.3/main/postgresql.conf.invirt
@@ -6,75 +6,89 @@
 #
 #   name = value
 #
-# (The '=' is optional.) White space may be used. Comments are introduced
-# with '#' anywhere on a line. The complete list of option names and
-# allowed values can be found in the PostgreSQL documentation. The
-# commented-out settings shown in this file represent the default values.
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
 #
-# Please note that re-commenting a setting is NOT sufficient to revert it
-# to the default value, unless you restart the postmaster.
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
 #
-# Any option can also be given as a command line switch to the
-# postmaster, e.g. 'postmaster -c log_connections=on'. Some options
-# can be changed at run-time with the 'SET' SQL command.
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
 #
-# This file is read on postmaster startup and when the postmaster
-# receives a SIGHUP. If you edit the file on a running system, you have 
-# to SIGHUP the postmaster for the changes to take effect, or use 
-# "pg_ctl reload". Some settings, such as listen_addresses, require
-# a postmaster shutdown and restart to take effect.
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some paramters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes MB = megabytes GB = gigabytes
+# Time units:    ms = milliseconds s = seconds min = minutes h = hours d = days
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # FILE LOCATIONS
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
-# The default values of these variables are driven from the -D command line
-# switch or PGDATA environment variable, represented here as ConfigDir.
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
 
-#data_directory = 'ConfigDir'		# use data in another directory
+data_directory = '/var/lib/postgresql/8.3/main'		# use data in another directory
+					# (change requires restart)
 hba_file = '/etc/postgresql/8.3/main/pg_hba.conf'	# host-based authentication file
-ident_file = '/etc/postgresql/8.3/main/pg_ident.conf'	# IDENT configuration file
+					# (change requires restart)
+ident_file = '/etc/postgresql/8.3/main/pg_ident.conf'	# ident configuration file
+					# (change requires restart)
 
-# If external_pid_file is not explicitly set, no extra pid file is written.
-external_pid_file = '/var/run/postgresql/8.3-main.pid'		# write an extra pid file
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/8.3-main.pid'		# write an extra PID file
+					# (change requires restart)
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # CONNECTIONS AND AUTHENTICATION
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Connection Settings -
 
-listen_addresses = '*'		# what IP address(es) to listen on; 
+listen_addresses = '*'			# what IP address(es) to listen on;
 					# comma-separated list of addresses;
 					# defaults to 'localhost', '*' = all
-port = 5432
-max_connections = 100
-# note: increasing max_connections costs ~400 bytes of shared memory per 
-# connection slot, plus lock space (see max_locks_per_transaction).  You
-# might also need to raise shared_buffers to support more connections.
-#superuser_reserved_connections = 2
-unix_socket_directory = '/var/run/postgresql'
-#unix_socket_group = ''
-#unix_socket_permissions = 0777		# octal
+					# (change requires restart)
+port = 5432				# (change requires restart)
+max_connections = 100			# (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
+# connection slot, plus lock space (see max_locks_per_transaction).  You might
+# also need to raise shared_buffers to support more connections.
+#superuser_reserved_connections = 3	# (change requires restart)
+unix_socket_directory = '/var/run/postgresql'		# (change requires restart)
+#unix_socket_group = ''			# (change requires restart)
+#unix_socket_permissions = 0777		# begin with 0 to use octal notation
+					# (change requires restart)
 #bonjour_name = ''			# defaults to the computer name
+					# (change requires restart)
 
-# - Security & Authentication -
+# - Security and Authentication -
 
-#authentication_timeout = 60		# 1-600, in seconds
-ssl = true
+#authentication_timeout = 1min		# 1s-600s
+ssl = true				# (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'	# allowed SSL ciphers
+					# (change requires restart)
 #password_encryption = on
 #db_user_namespace = off
 
-# Kerberos
-#krb_server_keyfile = ''
-#krb_srvname = 'postgres'
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''		# (change requires restart)
+#krb_srvname = 'postgres'		# (change requires restart, Kerberos only)
 #krb_server_hostname = ''		# empty string matches any keytab entry
-#krb_caseins_users = off
+					# (change requires restart, Kerberos only)
+#krb_caseins_users = off		# (change requires restart)
+#krb_realm = ''           		# (change requires restart)
 
 # - TCP Keepalives -
-# see 'man 7 tcp' for details
+# see "man 7 tcp" for details
 
 #tcp_keepalives_idle = 0		# TCP_KEEPIDLE, in seconds;
 					# 0 selects the system default
@@ -84,30 +98,35 @@ ssl = true
 					# 0 selects the system default
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # RESOURCE USAGE (except WAL)
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Memory -
 
-shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
-#temp_buffers = 1000			# min 100, 8KB each
+shared_buffers = 24MB			# min 128kB or max_connections*16kB
+					# (change requires restart)
+#temp_buffers = 8MB			# min 800kB
 #max_prepared_transactions = 5		# can be 0 or more
-# note: increasing max_prepared_transactions costs ~600 bytes of shared memory
+					# (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
 # per transaction slot, plus lock space (see max_locks_per_transaction).
-#work_mem = 1024			# min 64, size in KB
-#maintenance_work_mem = 16384		# min 1024, size in KB
-#max_stack_depth = 2048			# min 100, size in KB
+#work_mem = 1MB				# min 64kB
+#maintenance_work_mem = 16MB		# min 1MB
+#max_stack_depth = 2MB			# min 100kB
 
 # - Free Space Map -
 
-#max_fsm_pages = 20000			# min max_fsm_relations*16, 6 bytes each
+max_fsm_pages = 153600			# min max_fsm_relations*16, 6 bytes each
+					# (change requires restart)
 #max_fsm_relations = 1000		# min 100, ~70 bytes each
+					# (change requires restart)
 
 # - Kernel Resource Usage -
 
 #max_files_per_process = 1000		# min 25
-#preload_libraries = ''
+					# (change requires restart)
+#shared_preload_libraries = ''		# (change requires restart)
 
 # - Cost-Based Vacuum Delay -
 
@@ -115,24 +134,23 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 #vacuum_cost_page_hit = 1		# 0-10000 credits
 #vacuum_cost_page_miss = 10		# 0-10000 credits
 #vacuum_cost_page_dirty = 20		# 0-10000 credits
-#vacuum_cost_limit = 200		# 0-10000 credits
+#vacuum_cost_limit = 200		# 1-10000 credits
 
-# - Background writer -
+# - Background Writer -
 
-#bgwriter_delay = 200			# 10-10000 milliseconds between rounds
-#bgwriter_lru_percent = 1.0		# 0-100% of LRU buffers scanned/round
-#bgwriter_lru_maxpages = 5		# 0-1000 buffers max written/round
-#bgwriter_all_percent = 0.333		# 0-100% of all buffers scanned/round
-#bgwriter_all_maxpages = 5		# 0-1000 buffers max written/round
+#bgwriter_delay = 200ms			# 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100		# 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0		# 0-10.0 multipler on buffers scanned/round
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # WRITE AHEAD LOG
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Settings -
 
 #fsync = on				# turns forced synchronization on or off
+#synchronous_commit = on		# immediate fsync at commit
 #wal_sync_method = fsync		# the default is the first option 
 					# supported by the operating system:
 					#   open_datasync
@@ -141,25 +159,32 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 					#   fsync_writethrough
 					#   open_sync
 #full_page_writes = on			# recover from partial page writes
-#wal_buffers = 8			# min 4, 8KB each
+#wal_buffers = 64kB			# min 32kB
+					# (change requires restart)
+#wal_writer_delay = 200ms		# 1-10000 milliseconds
+
 #commit_delay = 0			# range 0-100000, in microseconds
 #commit_siblings = 5			# range 1-1000
 
 # - Checkpoints -
 
 #checkpoint_segments = 3		# in logfile segments, min 1, 16MB each
-#checkpoint_timeout = 300		# range 30-3600, in seconds
-#checkpoint_warning = 30		# in seconds, 0 is off
+#checkpoint_timeout = 5min		# range 30s-1h
+#checkpoint_completion_target = 0.5	# checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s		# 0 is off
 
 # - Archiving -
 
-#archive_command = ''			# command to use to archive a logfile 
-					# segment
+#archive_mode = off		# allows archiving to be done
+				# (change requires restart)
+#archive_command = ''		# command to use to archive a logfile segment
+#archive_timeout = 0		# force a logfile segment switch after this
+				# time; 0 is off
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # QUERY TUNING
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Planner Method Configuration -
 
@@ -175,12 +200,12 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 
 # - Planner Cost Constants -
 
-#effective_cache_size = 1000		# typically 8KB each
-#random_page_cost = 4			# units are one sequential page fetch 
-					# cost
-#cpu_tuple_cost = 0.01			# (same)
-#cpu_index_tuple_cost = 0.001		# (same)
-#cpu_operator_cost = 0.0025		# (same)
+#seq_page_cost = 1.0			# measured on an arbitrary scale
+#random_page_cost = 4.0			# same scale as above
+#cpu_tuple_cost = 0.01			# same scale as above
+#cpu_index_tuple_cost = 0.005		# same scale as above
+#cpu_operator_cost = 0.0025		# same scale as above
+#effective_cache_size = 128MB
 
 # - Genetic Query Optimizer -
 
@@ -197,42 +222,44 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 #constraint_exclusion = off
 #from_collapse_limit = 8
 #join_collapse_limit = 8		# 1 disables collapsing of explicit 
-					# JOINs
+					# JOIN clauses
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # ERROR REPORTING AND LOGGING
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Where to Log -
 
-#log_destination = 'stderr'		# Valid values are combinations of 
-					# stderr, syslog and eventlog, 
-					# depending on platform.
+#log_destination = 'stderr'		# Valid values are combinations of
+					# stderr, csvlog, syslog and eventlog,
+					# depending on platform.  csvlog
+					# requires logging_collector to be on.
 
 # This is used when logging to stderr:
-#redirect_stderr = off			# Enable capturing of stderr into log 
-					# files
-
-# These are only used if redirect_stderr is on:
-#log_directory = 'pg_log'		# Directory where log files are written
-					# Can be absolute or relative to PGDATA
-#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern.
-					# Can include strftime() escapes
-#log_truncate_on_rotation = off # If on, any existing log file of the same 
-					# name as the new log file will be
-					# truncated rather than appended to. But
-					# such truncation only occurs on
+#logging_collector = off		# Enable capturing of stderr and csvlog
+					# into log files. Required to be on for
+					# csvlogs.
+					# (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'		# directory where log files are written,
+					# can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'	# log file name pattern,
+					# can include strftime() escapes
+#log_truncate_on_rotation = off		# If on, an existing log file of the
+					# same name as the new log file will be
+					# truncated rather than appended to.
+					# But such truncation only occurs on
 					# time-driven rotation, not on restarts
-					# or size-driven rotation. Default is
+					# or size-driven rotation.  Default is
 					# off, meaning append to existing files
 					# in all cases.
-#log_rotation_age = 1440		# Automatic rotation of logfiles will 
-					# happen after so many minutes.  0 to 
-					# disable.
-#log_rotation_size = 10240		# Automatic rotation of logfiles will 
-					# happen after so many kilobytes of log
-					# output.  0 to disable.
+#log_rotation_age = 1d			# Automatic rotation of logfiles will
+					# happen after that time.  0 to disable.
+#log_rotation_size = 10MB		# Automatic rotation of logfiles will 
+					# happen after that much log output.
+					# 0 to disable.
 
 # These are relevant when logging to syslog:
 #syslog_facility = 'LOCAL0'
@@ -241,7 +268,7 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 
 # - When to Log -
 
-#client_min_messages = notice		# Values, in order of decreasing detail:
+#client_min_messages = notice		# values in order of decreasing detail:
 					#   debug5
 					#   debug4
 					#   debug3
@@ -252,7 +279,7 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 					#   warning
 					#   error
 
-#log_min_messages = notice		# Values, in order of decreasing detail:
+#log_min_messages = notice		# values in order of decreasing detail:
 					#   debug5
 					#   debug4
 					#   debug3
@@ -268,7 +295,7 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 
 #log_error_verbosity = default		# terse, default, or verbose messages
 
-#log_min_error_statement = panic	# Values in order of increasing severity:
+#log_min_error_statement = error	# values in order of decreasing detail:
 				 	#   debug5
 					#   debug4
 					#   debug3
@@ -278,13 +305,17 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 					#   notice
 					#   warning
 					#   error
-					#   panic(off)
-				 
+					#   log
+					#   fatal
+					#   panic (effectively off)
+
 #log_min_duration_statement = -1	# -1 is disabled, 0 logs all statements
-					# and their durations, in milliseconds.
+					# and their durations, > 0 logs only
+					# statements running at least this time.
 
-#silent_mode = off			# DO NOT USE without syslog or 
-					# redirect_stderr
+#silent_mode = off			# DO NOT USE without syslog or
+					# logging_collector
+					# (change requires restart)
 
 # - What to Log -
 
@@ -292,33 +323,48 @@ shared_buffers = 1000			# min 16 or max_connections*2, 8KB each
 #debug_print_rewritten = off
 #debug_print_plan = off
 #debug_pretty_print = off
+#log_checkpoints = off
 #log_connections = off
 #log_disconnections = off
 #log_duration = off
-log_line_prefix = '%t '			# Special values:
+#log_hostname = off
+log_line_prefix = '%t '			# special values:
 					#   %u = user name
 					#   %d = database name
 					#   %r = remote host and port
 					#   %h = remote host
-					#   %p = PID
-					#   %t = timestamp (no milliseconds)
+					#   %p = process ID
+					#   %t = timestamp without milliseconds
 					#   %m = timestamp with milliseconds
 					#   %i = command tag
-					#   %c = session id
+					#   %c = session ID
 					#   %l = session line number
 					#   %s = session start timestamp
-					#   %x = transaction id
-					#   %q = stop here in non-session 
+					#   %v = virtual transaction ID
+					#   %x = transaction ID (0 if none)
+					#   %q = stop here in non-session
 					#        processes
 					#   %% = '%'
 					# e.g. '<%u%%%d> '
-#log_statement = 'none'			# none, mod, ddl, all
-#log_hostname = off
+#log_lock_waits = off			# log lock waits >= deadlock_timeout
+#log_statement = 'none'			# none, ddl, mod, all
+#log_temp_files = -1			# log temporary files equal or larger
+					# than specified size;
+					# -1 disables, 0 logs all temp files
+#log_timezone = unknown			# actually, defaults to TZ environment
+					# setting
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # RUNTIME STATISTICS
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#update_process_title = on
+
 
 # - Statistics Monitoring -
 
@@ -327,105 +373,121 @@ log_line_prefix = '%t '			# Special values:
 #log_executor_stats = off
 #log_statement_stats = off
 
-# - Query/Index Statistics Collector -
-
-#stats_start_collector = on
-#stats_command_string = off
-#stats_block_level = off
-stats_row_level = on
-#stats_reset_on_server_start = off
-
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # AUTOVACUUM PARAMETERS
-#---------------------------------------------------------------------------
-
-autovacuum = on			# enable autovacuum subprocess?
-#autovacuum_naptime = 60		# time between autovacuum runs, in secs
-#autovacuum_vacuum_threshold = 1000	# min # of tuple updates before
-					# vacuum
-#autovacuum_analyze_threshold = 500	# min # of tuple updates before 
-					# analyze
-#autovacuum_vacuum_scale_factor = 0.4	# fraction of rel size before 
+#------------------------------------------------------------------------------
+
+#autovacuum = on			# Enable autovacuum subprocess?  'on' 
+					# requires track_counts to also be on.
+#log_autovacuum_min_duration = -1	# -1 disables, 0 logs all actions and
+					# their durations, > 0 logs only
+					# actions running at least that time.
+#autovacuum_max_workers = 3		# max number of autovacuum subprocesses
+#autovacuum_naptime = 1min		# time between autovacuum runs
+#autovacuum_vacuum_threshold = 50	# min number of row updates before
 					# vacuum
-#autovacuum_analyze_scale_factor = 0.2	# fraction of rel size before 
+#autovacuum_analyze_threshold = 50	# min number of row updates before 
 					# analyze
-#autovacuum_vacuum_cost_delay = -1	# default vacuum cost delay for 
-					# autovac, -1 means use 
+#autovacuum_vacuum_scale_factor = 0.2	# fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1	# fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000	# maximum XID age before forced vacuum
+					# (change requires restart)
+#autovacuum_vacuum_cost_delay = 20	# default vacuum cost delay for
+					# autovacuum, -1 means use
 					# vacuum_cost_delay
-#autovacuum_vacuum_cost_limit = -1	# default vacuum cost limit for 
-					# autovac, -1 means use
+#autovacuum_vacuum_cost_limit = -1	# default vacuum cost limit for
+					# autovacuum, -1 means use
 					# vacuum_cost_limit
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # CLIENT CONNECTION DEFAULTS
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # - Statement Behavior -
 
-#search_path = '$user,public'		# schema names
-#default_tablespace = ''		# a tablespace name, '' uses
-					# the default
+#search_path = '"$user",public'		# schema names
+#default_tablespace = ''		# a tablespace name, '' uses the default
+#temp_tablespaces = ''			# a list of tablespace names, '' uses
+					# only default tablespace
 #check_function_bodies = on
 #default_transaction_isolation = 'read committed'
 #default_transaction_read_only = off
-#statement_timeout = 0			# 0 is disabled, in milliseconds
+#session_replication_role = 'origin'
+#statement_timeout = 0			# 0 is disabled
+#vacuum_freeze_min_age = 100000000
+#xmlbinary = 'base64'
+#xmloption = 'content'
 
 # - Locale and Formatting -
 
-#datestyle = 'iso, mdy'
-#timezone = unknown			# actually, defaults to TZ 
-					# environment setting
-#australian_timezones = off
+datestyle = 'iso, mdy'
+#timezone = unknown			# actually, defaults to TZ environment
+					# setting
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+					# abbreviations.  Currently, there are
+					#   Default
+					#   Australia
+					#   India
+					# You can create your own file in
+					# share/timezonesets/.
 #extra_float_digits = 0			# min -15, max 2
 #client_encoding = sql_ascii		# actually, defaults to database
 					# encoding
 
-# These settings are initialized by initdb -- they might be changed
-lc_messages = 'C'			# locale for system error message 
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'C'			# locale for system error message
 					# strings
 lc_monetary = 'C'			# locale for monetary formatting
 lc_numeric = 'C'			# locale for number formatting
 lc_time = 'C'				# locale for time formatting
 
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
 # - Other Defaults -
 
 #explain_pretty_print = on
 #dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # LOCK MANAGEMENT
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
-#deadlock_timeout = 1000		# in milliseconds
+#deadlock_timeout = 1s
 #max_locks_per_transaction = 64		# min 10
-# note: each lock table slot uses ~220 bytes of shared memory, and there are
+					# (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
 # max_locks_per_transaction * (max_connections + max_prepared_transactions)
 # lock table slots.
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # VERSION/PLATFORM COMPATIBILITY
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
-# - Previous Postgres Versions -
+# - Previous PostgreSQL Versions -
 
 #add_missing_from = off
+#array_nulls = on
 #backslash_quote = safe_encoding	# on, off, or safe_encoding
 #default_with_oids = off
-#escape_string_warning = off
+#escape_string_warning = on
 #regex_flavor = advanced		# advanced, extended, or basic
 #sql_inheritance = on
+#standard_conforming_strings = off
+#synchronize_seqscans = on
 
-# - Other Platforms & Clients -
+# - Other Platforms and Clients -
 
 #transform_null_equals = off
 
 
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # CUSTOMIZED OPTIONS
-#---------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 #custom_variable_classes = ''		# list of custom variable class names
-- 
1.7.9.5


From 70a670d245ccfc6d7e5ee156e649dc4beaaf69b2 Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Wed, 1 Oct 2008 19:31:23 -0400
Subject: [PATCH 04/16] sipb-xen-database-server: fix init script, expand
 pg_hba.conf

svn path=/trunk/packages/sipb-xen-database/; revision=989
---
 debian/changelog                                |    7 +++
 debian/sipb-xen-database-server.init            |   66 +++++------------------
 server/etc/postgresql/8.3/main/pg_hba.conf.mako |    5 +-
 3 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 657db3e..abde326 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sipb-xen-database (10.25) unstable; urgency=low
+
+  * add remote and console to pg_hba.conf template
+  * fix init script so it works
+
+ -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 19:30:26 -0400
+
 sipb-xen-database (10.24) unstable; urgency=low
 
   * Update postgresql.conf for Hardy
diff --git a/debian/sipb-xen-database-server.init b/debian/sipb-xen-database-server.init
index be4831b..8c9a4b3 100644
--- a/debian/sipb-xen-database-server.init
+++ b/debian/sipb-xen-database-server.init
@@ -9,69 +9,31 @@
 # Description:       
 ### END INIT INFO
 
-# Author: SIPB Xen Project <sipb-xen@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 sipb-xen database server"
-NAME=sipb-xen-database-server
-
-
-
-SCRIPTNAME=/etc/init.d/$NAME
+PACKAGE=sipb-xen-database-tables
 
 # Exit if the package is not installed
-[ -x "/usr/bin/sipb-xen-database-tabales" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -x "/usr/bin/sipb-xen-database-tables" ] || exit 0
 
-# 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/postgresql/8.3/main/pg_hba.conf
-             ; do
-        mako-render $i.mako > $i
-    done
-}
-
-do_reload()
-{
-	gen_config
-
+  for i in /etc/postgresql/8.3/main/pg_hba.conf
+  do mako-render $i.mako > $i
+  done
 }
 
 case "$1" in
-  start)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-gen_config
-	;;
+  start|reload|force-reload|restart)
+    log_begin_msg "Reloading config for $PACKAGE"
+    gen_config
+    log_end_msg $?
+    /etc/init.d/postgresql-8.3 "$1"
+    ;;
   stop)
-	;;
-  reload|force-reload)
-	log_daemon_msg "Reloading $DESC" "$NAME"
-	do_reload
-	log_end_msg $?
-	;;
-  restart)
-	  *)
-	  	# Failed to stop
-		log_end_msg 1
-		;;
-	esac
-	;;
+    ;;
   *)
-	echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
-	exit 3
-	;;
+    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
+    ;;
 esac
-
-:
diff --git a/server/etc/postgresql/8.3/main/pg_hba.conf.mako b/server/etc/postgresql/8.3/main/pg_hba.conf.mako
index cc02053..ea5fde5 100644
--- a/server/etc/postgresql/8.3/main/pg_hba.conf.mako
+++ b/server/etc/postgresql/8.3/main/pg_hba.conf.mako
@@ -82,7 +82,6 @@ local   all         all                               ident sameuser
 host    all         all         127.0.0.1/32          md5
 # IPv6 local connections:
 host    all         all         ::1/128               md5
-host	${cfg.db.dbname}	${cfg.db.user}	${cfg.db.ip}/32	trust
-% for h in cfg.hosts:
-host	${cfg.db.dbname}	${cfg.db.user}	${h.ip}/32	trust
+% for m in cfg.hosts + [cfg.db, cfg.remote, cfg.console]:
+host	${cfg.db.dbname}	${cfg.db.user}	${m.ip}/32	trust
 % endfor
-- 
1.7.9.5


From d120007286dc6ad3b08afbfdadc5faa23108098a Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Wed, 1 Oct 2008 19:48:39 -0400
Subject: [PATCH 05/16] more sqlalchemy-0.4 changes

svn path=/trunk/packages/sipb-xen-database/; revision=991
---
 debian/changelog            |    1 +
 python/database/__init__.py |    4 +++-
 python/database/models.py   |   22 ++++++++++++----------
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index abde326..2d99c31 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ sipb-xen-database (10.25) unstable; urgency=low
 
   * add remote and console to pg_hba.conf template
   * fix init script so it works
+  * port more code to sqlalchemy 0.4
 
  -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 19:30:26 -0400
 
diff --git a/python/database/__init__.py b/python/database/__init__.py
index 5eeb3c5..258c4d4 100644
--- a/python/database/__init__.py
+++ b/python/database/__init__.py
@@ -4,4 +4,6 @@ import sqlalchemy
 
 def connect(uri = config.db.uri):
     """ Connect to a given database URI"""
-    meta.bind = sqlalchemy.create_engine(uri)
+    engine = sqlalchemy.create_engine(uri)
+    meta.bind = engine
+    session.configure(bind=engine)
diff --git a/python/database/models.py b/python/database/models.py
index 6574ff1..b91107f 100644
--- a/python/database/models.py
+++ b/python/database/models.py
@@ -1,11 +1,12 @@
 from sqlalchemy import *
+from sqlalchemy import orm
 from sqlalchemy.orm import create_session, relation
 
 from sqlalchemy.ext.sessioncontext import SessionContext
 from sqlalchemy.ext.assignmapper import assign_mapper
 
 __all__ = ['meta',
-           'ctx',
+           'session',
            'clear_cache',
            'machine_table',
            'machine_access_table',
@@ -25,7 +26,7 @@ __all__ = ['meta',
            ]
 
 meta = ThreadLocalMetaData()
-ctx = SessionContext(create_session)
+session = orm.scoped_session(orm.sessionmaker())
 
 machine_table = Table('machines', meta,
        Column('machine_id', Integer, primary_key=True, nullable=False),
@@ -105,17 +106,17 @@ class Autoinstall(object):
     def __repr__(self):
         return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id)
 
-assign_mapper(ctx, Machine, machine_table,
+session.mapper(Machine, machine_table,
               properties={'nics': relation(NIC, backref="machine", lazy=False),
                           'disks': relation(Disk, backref="machine", lazy=False),
                           'type': relation(Type, lazy=False),
                           'acl': relation(MachineAccess, backref="machine", lazy=False, passive_deletes=True, cascade="all, delete-orphan")});
-assign_mapper(ctx, MachineAccess, machine_access_table)
-assign_mapper(ctx, NIC, nic_table)
-assign_mapper(ctx, Disk, disk_table)
-assign_mapper(ctx, Type, types_table)
-assign_mapper(ctx, CDROM, cdroms_table)
-assign_mapper(ctx, Autoinstall, autoinstalls_table)
+session.mapper(MachineAccess, machine_access_table)
+session.mapper(NIC, nic_table)
+session.mapper(Disk, disk_table)
+session.mapper(Type, types_table)
+session.mapper(CDROM, cdroms_table)
+session.mapper(Autoinstall, autoinstalls_table)
 
 def clear_cache():
     """Clear sqlalchemy's cache.
@@ -123,4 +124,5 @@ def clear_cache():
     This _seems_ to be the way; it works, but the docs don't mention
     it.  Why is this so obscure?"""
 
-    ctx.registry.clear()
+    # XXX maybe we still need to do this, but it's not doc'd how.
+    #ctx.registry.clear()
-- 
1.7.9.5


From 2920145fe2531a7f64b9a718524c8bf2785f87be Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Thu, 2 Oct 2008 19:41:44 -0400
Subject: [PATCH 06/16] Update sipb-xen- Update invirt.database to not be
 transactional by default

svn path=/trunk/packages/sipb-xen-database/; revision=1008
---
 debian/changelog          |    6 ++++++
 python/database/models.py |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 2d99c31..63d7940 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.26) unstable; urgency=low
+
+  * Disable transactions by default
+
+ -- Evan Broder <broder@mit.edu>  Thu, 02 Oct 2008 19:40:34 -0400
+
 sipb-xen-database (10.25) unstable; urgency=low
 
   * add remote and console to pg_hba.conf template
diff --git a/python/database/models.py b/python/database/models.py
index b91107f..6ba0446 100644
--- a/python/database/models.py
+++ b/python/database/models.py
@@ -26,7 +26,7 @@ __all__ = ['meta',
            ]
 
 meta = ThreadLocalMetaData()
-session = orm.scoped_session(orm.sessionmaker())
+session = orm.scoped_session(orm.sessionmaker(transactional=False))
 
 machine_table = Table('machines', meta,
        Column('machine_id', Integer, primary_key=True, nullable=False),
-- 
1.7.9.5


From 95861a2faf8ff0edd2e834c70180cabf4b4a9359 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Fri, 3 Oct 2008 19:26:58 -0400
Subject: [PATCH 07/16] The database wants to be not transactional, and not
 autoflushing

svn path=/trunk/packages/sipb-xen-database/; revision=1014
---
 debian/changelog          |    6 ++++++
 python/database/models.py |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 63d7940..689b6e1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.26.1) unstable; urgency=low
+
+  * We want autoflush off, too
+
+ -- Evan Broder <broder@mit.edu>  Fri, 03 Oct 2008 19:22:12 -0400
+
 sipb-xen-database (10.26) unstable; urgency=low
 
   * Disable transactions by default
diff --git a/python/database/models.py b/python/database/models.py
index 6ba0446..67d5de8 100644
--- a/python/database/models.py
+++ b/python/database/models.py
@@ -26,7 +26,7 @@ __all__ = ['meta',
            ]
 
 meta = ThreadLocalMetaData()
-session = orm.scoped_session(orm.sessionmaker(transactional=False))
+session = orm.scoped_session(orm.sessionmaker(transactional=False, autoflush=False))
 
 machine_table = Table('machines', meta,
        Column('machine_id', Integer, primary_key=True, nullable=False),
-- 
1.7.9.5


From 7f28be2669ae1670b11e1025ede6a0aa2413886a Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Fri, 3 Oct 2008 20:09:49 -0400
Subject: [PATCH 08/16] Update /etc/xen/sipb-database to work with newer
 SQLAlchemy and Xen

svn path=/trunk/packages/sipb-xen-database/; revision=1016
---
 client/etc/xen/sipb-database |    6 +++---
 debian/changelog             |    6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index d6c8b3c..70eed41 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -16,9 +16,9 @@ def check(b):
         import sys
         sys.exit(1)
 
-machine = models.Machine.get_by(name=machine_name)
+machine = models.Machine.query().filter_by(name=machine_name).one()
 check(machine is not None)
-machine_type = models.Type.get_by(type_id=machine.type_id)
+machine_type = models.Type.query().filter_by(type_id=machine.type_id).one()
 
 memory = machine.memory
 maxmem = memory
@@ -72,7 +72,7 @@ elif 'cdrom_image' in locals():
 if codepath == 'hvm':
     ioemu = "ioemu:"
     viftype = "type=ioemu, "
-    kernel = 'hvmloader'
+    kernel = '/usr/lib/xen/boot/hvmloader'
     builder = 'hvm'
     vnc = 1
     vncpasswd = 'moocow'
diff --git a/debian/changelog b/debian/changelog
index 689b6e1..74ab33d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.27) unstable; urgency=low
+
+  * Update sipb-database to work with newer SQLAlchemy and Xen
+
+ -- Evan Broder <broder@mit.edu>  Fri, 03 Oct 2008 20:08:16 -0400
+
 sipb-xen-database (10.26.1) unstable; urgency=low
 
   * We want autoflush off, too
-- 
1.7.9.5


From 7e25fbcc4c76eb8f67341ff82b47e875f0243280 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Sat, 4 Oct 2008 23:23:10 -0400
Subject: [PATCH 09/16] Re-establish the database connection if the server
 goes AWOL

svn path=/trunk/packages/sipb-xen-database/; revision=1041
---
 debian/changelog            |    6 ++++++
 python/database/__init__.py |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 74ab33d..2af5b40 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.28) unstable; urgency=low
+
+  * Re-establish the database connection if the server goes AWOL
+
+ -- Evan Broder <broder@mit.edu>  Sat, 04 Oct 2008 23:19:59 -0400
+
 sipb-xen-database (10.27) unstable; urgency=low
 
   * Update sipb-database to work with newer SQLAlchemy and Xen
diff --git a/python/database/__init__.py b/python/database/__init__.py
index 258c4d4..b3dd61c 100644
--- a/python/database/__init__.py
+++ b/python/database/__init__.py
@@ -4,6 +4,6 @@ import sqlalchemy
 
 def connect(uri = config.db.uri):
     """ Connect to a given database URI"""
-    engine = sqlalchemy.create_engine(uri)
+    engine = sqlalchemy.create_engine(uri, pool_timeout=5)
     meta.bind = engine
     session.configure(bind=engine)
-- 
1.7.9.5


From fdac617a6d08a9554611810d953be70cb3d20d46 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Mon, 6 Oct 2008 19:03:25 -0400
Subject: [PATCH 10/16] Some fixes in the sipb-database Xen config script

svn path=/trunk/packages/sipb-xen-database/; revision=1079
---
 client/etc/xen/sipb-database |    6 +++---
 debian/changelog             |    6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index 70eed41..4bf7382 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -46,7 +46,7 @@ else:
     codepath = 'paravm'
 
 if 'mirror' in locals(): #Installer
-    disk.append('phy:/dev/xenvg/d_foobar3_hda,hdb,r')
+    disk.append('phy:/dev/xenvg/s_install_hda,hdb,r')
 
     kernel = '/boot/vmlinuz-2.6.24-19-xen' #From hardy
     ramdisk = '/boot/initrd.img-2.6.24-19-xen'
@@ -56,7 +56,7 @@ if 'mirror' in locals(): #Installer
     n = machine.nics[0]
     extra = 'ro noresume'
     extra += (' ip=%s::%s:%s:%s:eth0:off'
-         % (n.ip, config.network.gateway, config.network.netmask, machine.name))
+         % (n.ip, config.dhcp.gateway, config.dhcp.netmask, machine.name))
     extra += ' mirror=%s dist=%s' % (mirror, dist)
     extra += ' imagesize=%s' % imagesize
     if 'noinstall' in locals():
@@ -65,7 +65,7 @@ if 'mirror' in locals(): #Installer
     codepath = None
 elif 'cdrom_image' in locals():
     check(re.match('^[A-Za-z0-9][A-Za-z0-9_.-]*$', cdrom_image))
-    disk.append('file:/srv/images/' + cdrom_image + '.iso,hdc:cdrom,r')
+    disk.append('phy:/srv/images/' + cdrom_image + '.iso,hdc:cdrom,r')
     boot = 'd'
     codepath = 'hvm'
 
diff --git a/debian/changelog b/debian/changelog
index 2af5b40..a273028 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.29) unstable; urgency=low
+
+  * Some fixes in the sipb-database script
+
+ -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 18:55:24 -0400
+
 sipb-xen-database (10.28) unstable; urgency=low
 
   * Re-establish the database connection if the server goes AWOL
-- 
1.7.9.5


From 10a1af41408ed1feed086a361b08e828ce132b58 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Thu, 9 Oct 2008 02:12:36 -0400
Subject: [PATCH 11/16] Look for CD images in /dev/xenvg/image_* and validate
 them against the database

svn path=/trunk/packages/sipb-xen-database/; revision=1090
---
 client/etc/xen/sipb-database |   11 +++++++----
 debian/changelog             |    7 +++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index 4bf7382..0d4d466 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -18,7 +18,11 @@ def check(b):
 
 machine = models.Machine.query().filter_by(name=machine_name).one()
 check(machine is not None)
-machine_type = models.Type.query().filter_by(type_id=machine.type_id).one()
+machine_type = machine.type
+cdrom = None
+if 'cdrom_image' in locals():
+    cdrom = models.CDROM.query().filter_by(name=cdrom_image).one()
+    check(cdrom is not None)
 
 memory = machine.memory
 maxmem = memory
@@ -63,9 +67,8 @@ if 'mirror' in locals(): #Installer
         extra += ' noinstall'
     root = '/dev/hdb1'
     codepath = None
-elif 'cdrom_image' in locals():
-    check(re.match('^[A-Za-z0-9][A-Za-z0-9_.-]*$', cdrom_image))
-    disk.append('phy:/srv/images/' + cdrom_image + '.iso,hdc:cdrom,r')
+elif cdrom is not None:
+    disk.append('phy:/etc/xenvg/image_' + cdrom.cdrom_id + ',hdc:cdrom,r')
     boot = 'd'
     codepath = 'hvm'
 
diff --git a/debian/changelog b/debian/changelog
index a273028..3c1b8ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sipb-xen-database (10.30) unstable; urgency=low
+
+  * Look for CD images in /dev/xenvg/image_* and validate image name from
+    the database
+
+ -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 02:08:49 -0400
+
 sipb-xen-database (10.29) unstable; urgency=low
 
   * Some fixes in the sipb-database script
-- 
1.7.9.5


From a964d744e6f3594a58e7c0b8c121a429a2770227 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Thu, 9 Oct 2008 02:12:37 -0400
Subject: [PATCH 12/16] Update the sipb-database script to match the remctl
 interface

svn path=/trunk/packages/sipb-xen-database/; revision=1091
---
 client/etc/xen/sipb-database |    7 ++-----
 debian/changelog             |    4 +++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index 0d4d466..fbc8079 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -49,7 +49,7 @@ if machine_type.hvm:
 else:
     codepath = 'paravm'
 
-if 'mirror' in locals(): #Installer
+if 'installer_options' in locals(): #Installer
     disk.append('phy:/dev/xenvg/s_install_hda,hdb,r')
 
     kernel = '/boot/vmlinuz-2.6.24-19-xen' #From hardy
@@ -61,10 +61,7 @@ if 'mirror' in locals(): #Installer
     extra = 'ro noresume'
     extra += (' ip=%s::%s:%s:%s:eth0:off'
          % (n.ip, config.dhcp.gateway, config.dhcp.netmask, machine.name))
-    extra += ' mirror=%s dist=%s' % (mirror, dist)
-    extra += ' imagesize=%s' % imagesize
-    if 'noinstall' in locals():
-        extra += ' noinstall'
+    extra += ' %s' % installer_options[1:-1]
     root = '/dev/hdb1'
     codepath = None
 elif cdrom is not None:
diff --git a/debian/changelog b/debian/changelog
index 3c1b8ff..c44c207 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,10 @@ sipb-xen-database (10.30) unstable; urgency=low
 
   * Look for CD images in /dev/xenvg/image_* and validate image name from
     the database
+  * Pass the installer arguments unaltered to the kernel, matching the
+    remctl interface
 
- -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 02:08:49 -0400
+ -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 02:09:42 -0400
 
 sipb-xen-database (10.29) unstable; urgency=low
 
-- 
1.7.9.5


From 3df757befd07a92962aa1b969bacb8115934188f Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Fri, 10 Oct 2008 01:54:50 -0400
Subject: [PATCH 13/16] Don't strip quotes in sipb-database that won't be
 there

svn path=/trunk/packages/sipb-xen-database/; revision=1098
---
 client/etc/xen/sipb-database |    2 +-
 debian/changelog             |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index fbc8079..a4da026 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -61,7 +61,7 @@ if 'installer_options' in locals(): #Installer
     extra = 'ro noresume'
     extra += (' ip=%s::%s:%s:%s:eth0:off'
          % (n.ip, config.dhcp.gateway, config.dhcp.netmask, machine.name))
-    extra += ' %s' % installer_options[1:-1]
+    extra += ' %s' % installer_options
     root = '/dev/hdb1'
     codepath = None
 elif cdrom is not None:
diff --git a/debian/changelog b/debian/changelog
index c44c207..fe386f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.30.1) unstable; urgency=low
+
+  * Don't strip quotes that won't be there
+
+ -- Evan Broder <broder@mit.edu>  Fri, 10 Oct 2008 01:48:48 -0400
+
 sipb-xen-database (10.30) unstable; urgency=low
 
   * Look for CD images in /dev/xenvg/image_* and validate image name from
-- 
1.7.9.5


From 075f6b8135bc61fa46dcd3aa4a79b9fcf8f43aa6 Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Sat, 11 Oct 2008 19:19:52 -0400
Subject: [PATCH 14/16] Fix a typo in the CDROM lookup in sipb-database

svn path=/trunk/packages/sipb-xen-database/; revision=1101
---
 client/etc/xen/sipb-database |    2 +-
 debian/changelog             |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index a4da026..9006232 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -21,7 +21,7 @@ check(machine is not None)
 machine_type = machine.type
 cdrom = None
 if 'cdrom_image' in locals():
-    cdrom = models.CDROM.query().filter_by(name=cdrom_image).one()
+    cdrom = models.CDROM.query().filter_by(cdrom_id=cdrom_image).one()
     check(cdrom is not None)
 
 memory = machine.memory
diff --git a/debian/changelog b/debian/changelog
index fe386f1..b8f6c9d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sipb-xen-database (10.30.2) unstable; urgency=low
+
+  * Fix a typo in the CDROM lookup in sipb-database
+
+ -- Evan Broder <broder@mit.edu>  Sat, 11 Oct 2008 19:17:05 -0400
+
 sipb-xen-database (10.30.1) unstable; urgency=low
 
   * Don't strip quotes that won't be there
-- 
1.7.9.5


From deff52e230e44b5464892d0ec2acce9f45178ffd Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Sat, 11 Oct 2008 20:56:30 -0400
Subject: [PATCH 15/16] fix dumb textual mistakes in sipb-xen-database-server
 initscript

svn path=/trunk/packages/sipb-xen-database/; revision=1104
---
 debian/changelog                     |    7 +++++++
 debian/sipb-xen-database-server.init |    6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b8f6c9d..e948734 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sipb-xen-database (10.30.3) unstable; urgency=low
+
+  * fix copy-paste errors in initscript: this is database, not console
+  * fix "typo" in initscript for package name printed in logs
+
+ -- Greg Price <price@mit.edu>  Sat, 11 Oct 2008 17:50:11 -0700
+
 sipb-xen-database (10.30.2) unstable; urgency=low
 
   * Fix a typo in the CDROM lookup in sipb-database
diff --git a/debian/sipb-xen-database-server.init b/debian/sipb-xen-database-server.init
index 8c9a4b3..431e675 100644
--- a/debian/sipb-xen-database-server.init
+++ b/debian/sipb-xen-database-server.init
@@ -1,15 +1,15 @@
 #!/bin/bash
 ### BEGIN INIT INFO
-# Provides:          sipb-xen-console
+# Provides:          sipb-xen-database-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: sipb-xen Console Server homedir filesystem
+# Short-Description: sipb-xen database server
 # Description:       
 ### END INIT INFO
 
-PACKAGE=sipb-xen-database-tables
+PACKAGE=sipb-xen-database-server
 
 # Exit if the package is not installed
 [ -x "/usr/bin/sipb-xen-database-tables" ] || exit 0
-- 
1.7.9.5


From 23b01ba18008f065413589a8f754b96fb0c05405 Mon Sep 17 00:00:00 2001
From: Eric Price <ecprice@mit.edu>
Date: Mon, 13 Oct 2008 21:40:46 -0400
Subject: [PATCH 16/16] Changed location for pygrub

svn path=/trunk/packages/sipb-xen-database/; revision=1107
---
 client/etc/xen/sipb-database |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/etc/xen/sipb-database b/client/etc/xen/sipb-database
index 9006232..cc12679 100644
--- a/client/etc/xen/sipb-database
+++ b/client/etc/xen/sipb-database
@@ -79,7 +79,7 @@ if codepath == 'hvm':
     device_model = '/usr/sbin/qemu-dm-sipb'
     serial = "pty"
 elif codepath == 'paravm':
-    bootloader = '/usr/lib/xen-default/bin/pygrub'
+    bootloader = '/usr/bin/pygrub'
 
 
 for n in machine.nics:
-- 
1.7.9.5