Index: trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 17771)
+++ trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 17772)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.50 2008-03-21 01:24:36 jhoblitt Exp $
+# $Id: SQL.pm,v 1.51 2008-05-22 04:10:01 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -250,22 +250,16 @@
             count(ins_id) as instances,
             count(mountedvol.vol_id) as available_instances,
-            count(mountedvol.vol_id) < count(ins_id) as need_recovery,
             count(mountedvol.vol_id) > 0 as recoverable,
             storage_object_xattr.value as copies
         FROM storage_object
-        JOIN storage_object_attr
-            USING(so_id)
         JOIN instance
             USING(so_id)
         LEFT JOIN storage_object_xattr
             ON storage_object.so_id = storage_object_xattr.so_id
-            AND storage_object_xattr.name = 'copies'
-        LEFT JOIN mountedvol
+        JOIN mountedvol
             USING(vol_id)
+--        WHERE storage_object_xattr.name = 'user.copies'
         GROUP BY so_id
-        HAVING need_recovery = 1
-    },
-    get_mounted_volumes => qq{
-        SELECT * FROM mountedvol ORDER BY vol_id
+        HAVING available_instances < instances OR instances != copies
     },
 );
