Index: trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 16264)
+++ trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 16265)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.46 2008-01-30 00:19:06 jhoblitt Exp $
+# $Id: SQL.pm,v 1.47 2008-01-31 02:26:33 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -40,9 +40,9 @@
     new_object_instance => qq{
         INSERT INTO instance 
-        VALUES (NULL, LAST_INSERT_ID(), 0, 'error', NULL, NULL, NULL, NULL)
+        VALUES (NULL, LAST_INSERT_ID(), ?, 'error', NULL, NULL, NULL, NULL)
     },
     new_instance        => qq{
         INSERT INTO instance
-        VALUES (NULL, ?, 0, 'error', NULL,NULL, NULL, NULL)
+        VALUES (NULL, ?, ?, 'error', NULL, NULL, NULL, NULL)
     },
     get_object          => qq{
@@ -253,4 +253,9 @@
             count(mountedvol.vol_id) > 0 as recoverable
         FROM storage_object
+        JOIN storage_object_attr
+            USING(so_id)
+        JOIN storage_object_xattr
+            ON storage_object.so_id = storage_object_xattr.so_id
+            AND storage_object_xattr.name = 'copies'
         JOIN instance
             USING(so_id)
