mysql-izing for nova
diff --git a/README b/README
index 2db4373..b93c615 100644
--- a/README
+++ b/README
@@ -2,15 +2,19 @@
 
 # Todo
 
-* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume
 * move back to using sudo
-* move to mysql
-* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?)
-* Add volume support
-* Add quantum support
 * Add python-novaclient cli support
+* move to mysql
+* Add volume support
+* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?)
 * allow changing of git locations (specify different tag/branch or repos)
-* allow sql/rabbit connection to be specified via environment variables with sensible defaults
+* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume
+* Add quantum support
+* allow rabbit connection to be specified via environment variables with sensible defaults
+
+# Done
+
+* sqlconn can be set via env
 
 # Future
 
diff --git a/apts/nova b/apts/nova
index c23a609..6b867b2 100644
--- a/apts/nova
+++ b/apts/nova
@@ -1,5 +1,7 @@
 dnsmasq-base
 kpartx
+mysql-server
+python-mysqldb
 kvm
 gawk
 iptables
diff --git a/build.sh b/build.sh
index 1523ece..89d8141 100755
--- a/build.sh
+++ b/build.sh
@@ -13,7 +13,7 @@
     debootstrap natty proto
     cp files/sources.list proto/etc/apt/sources.list
     chroot proto apt-get update
-    chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin)"`
+    chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
     chroot proto pip install `cat pips/*`
     git clone https://github.com/cloudbuilders/nova.git proto/opt/nova
     git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx
diff --git a/stack.sh b/stack.sh
index 478592f..0faa09b 100755
--- a/stack.sh
+++ b/stack.sh
@@ -38,10 +38,17 @@
 #             ip or you risk breaking things.
 # FLAT_INTERFACE=eth0
 
-# TODO: set rabbitmq conn string explicitly as well
 # TODO: switch to mysql for all services
-SQL_CONN=${SQL_CONN:-sqlite:///$NOVA_DIR/nova.sqlite}
+MYSQL_PASS=${MYSQL_PASS:-nova}
+SQL_CONN=${SQL_CONN:-mysql://root:$MYSQL_PASS@localhost/nova}
+# TODO: set rabbitmq conn string explicitly as well
 
+# seed configuration with mysql password
+cat <<MYSQL_PRESEED | debconf-set-selections
+mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
+mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
+mysql-server-5.1 mysql-server/start_on_boot boolean true
+MYSQL_PRESEED
 
 # install apt requirements
 apt-get install -y -q `cat $DIR/apts/* | cut -d\# -f1`
@@ -107,7 +114,7 @@
 mkdir $DASH_DIR/openstack-dashboard/quantum
 touch $DASH_DIR/openstack-dashboard/quantum/__init__.py
 touch $DASH_DIR/openstack-dashboard/quantum/client.py
-# local_settings has 
+
 cd $DASH_DIR/openstack-dashboard
 cp local/local_settings.py.example local/local_settings.py
 dashboard/manage.py syncdb
@@ -115,9 +122,9 @@
 # ## Setup Apache
 # create an empty directory to use as our 
 mkdir $DASH_DIR/.blackhole
+
 # FIXME(ja): can't figure out how to make $DASH_DIR work in sed, also install to available/a2e it 
 cat $DIR/files/000-default.template | sed 's/%DASH_DIR%/\/opt\/dash/g' > /etc/apache2/sites-enabled/000-default
-
 chown -R www-data:www-data $DASH_DIR
 
 mkdir -p /var/log/glance
@@ -129,12 +136,6 @@
 
 NL=`echo -ne '\015'`
 
-function screen_it {
-    # nova api crashes if we start it with a regular screen command,
-    # so send the start command by forcing text into the window.
-    screen -S nova -X screen -t $1
-    screen -S nova -p $1 -X stuff "$2$NL"
-}
 
 function add_nova_flag {
     echo "$1" >> $NOVA_DIR/bin/nova.conf
@@ -173,7 +174,8 @@
 mkdir -p $NOVA_DIR/networks
 
 # (re)create nova database
-rm -f $NOVA_DIR/nova.sqlite
+mysql -p$MYSQL_PASS -e 'DROP DATABASE nova;'
+mysql -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
 $NOVA_DIR/bin/nova-manage db sync
 
 # initialize keystone with default users/endpoints
@@ -191,6 +193,13 @@
 rm -rf /var/lib/glance/images/*
 rm -f $GLANCE_DIR/glance.sqlite
 
+# nova api crashes if we start it with a regular screen command,
+# so send the start command by forcing text into the window.
+function screen_it {
+    screen -S nova -X screen -t $1
+    screen -S nova -p $1 -X stuff "$2$NL"
+}
+
 screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf"
 screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf"
 screen_it key "$KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_DIR/etc/keystone.conf"
@@ -202,7 +211,6 @@
 screen_it dash "/etc/init.d/apache2 restart; tail -f /var/log/apache2/error.log"
 
 
-
 # ---- download an install images ----
 
 mkdir -p $DEST/images