Index: trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13245)
+++ trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13251)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.37 2007-05-04 20:46:29 jhoblitt Exp $
+# $Id: Server.pm,v 1.38 2007-05-04 23:36:46 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -930,12 +930,4 @@
     my $query;
     eval {
-        {
-            # ask the db to generate the table of mounted Nebulous volume 
-            my $query = $db->prepare_cached("call getmountedvol()");
-            $query->execute();
-        }
-
-        $log->debug("generated mountedvol table");
-
         if ($vol_name) {
             $query = $db->prepare_cached( $sql->get_object_instances_by_vol_name );
@@ -1114,10 +1106,4 @@
     my ($vol_id, $vol_path);
     eval {
-        {
-            # ask the db to generate the table of mounted Nebulous volume 
-            my $query = $db->prepare_cached("call getmountedvol()");
-            $query->execute();
-        }
-
         # TODO cache this?
         my $query;
Index: trunk/Nebulous/lib/Nebulous/Server/SQL.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 13245)
+++ trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 13251)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.39 2007-05-04 21:20:43 jhoblitt Exp $
+# $Id: SQL.pm,v 1.40 2007-05-04 23:36:46 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -274,4 +274,5 @@
 DROP TABLE IF EXISTS class;
 DROP TABLE IF EXISTS log;
+DROP TABLE IF EXISTS mountedvol;
 DROP PROCEDURE IF EXISTS getmountedvol;
 SET FOREIGN_KEY_CHECKS=1
@@ -386,4 +387,20 @@
 ###
 
+CREATE TABLE mountedvol(
+    mountpoint VARCHAR(255) NOT NULL,
+    total BIGINT NOT NULL,
+    used BIGINT NOT NULL,
+    vol_id INT NOT NULL,
+    name VARCHAR(255) NOT NULL,
+    path VARCHAR(255) NOT NULL,
+    allocate BOOLEAN DEFAULT FALSE,
+    available BOOLEAN DEFAULT FALSE,
+    KEY(vol_id),
+    KEY(allocate),
+    KEY(available)
+) ENGINE=innodb;
+
+###
+
 CREATE PROCEDURE getmountedvol() DETERMINISTIC
 BEGIN
@@ -401,32 +418,14 @@
     SELECT @@session.tx_isolation INTO trans_level; 
 
-    -- set trans level
+    -- set trans level to repeatable-read so the volume table does not change
+    -- out from under our cursor
     SET @@session.tx_isolation = 'REPEATABLE-READ';
-
-    -- create a temp table to hold the merged results of the volume & mount
-    -- tables.  One would hope the that the transaction isolation level will
-    -- stop one session from stomping on another sessions version of this
-    -- table.
-
-    DROP TABLE IF EXISTS mountedvol;
-    CREATE TEMPORARY TABLE mountedvol(
-        mountpoint VARCHAR(255) NOT NULL,
-        total BIGINT NOT NULL,
-        used BIGINT NOT NULL,
-        vol_id INT NOT NULL,
-        name VARCHAR(255) NOT NULL,
-        path VARCHAR(255) NOT NULL,
-        allocate BOOLEAN DEFAULT FALSE,
-        available BOOLEAN DEFAULT FALSE,
-        KEY(vol_id),
-        KEY(allocate),
-        KEY(available)
-    ) ENGINE=MEMORY;
 
     -- iterate over the volume table finding the coresponding entry in the
     -- mount table and inserting union of the volume & mount row into the
     -- mountedvol table
-
     OPEN cur1;
+
+    DELETE FROM mountedvol;
 
     myloop: LOOP
@@ -446,3 +445,5 @@
     -- restore the original transaction level
     SET @@session.tx_isolation = trans_level;
+
+    COMMIT;
 END 
