Index: trunk/Nebulous-Server/Changes
===================================================================
--- trunk/Nebulous-Server/Changes	(revision 17076)
+++ trunk/Nebulous-Server/Changes	(revision 17077)
@@ -2,4 +2,5 @@
 
 0.07
+    - add Nebulous::Server::mounts()
     - server/client split into Nebulous::Server and Nebulous::Client packages
     - add support for storing instances in multi-tier 'hashed' directories 
Index: trunk/Nebulous-Server/MANIFEST
===================================================================
--- trunk/Nebulous-Server/MANIFEST	(revision 17076)
+++ trunk/Nebulous-Server/MANIFEST	(revision 17077)
@@ -48,3 +48,4 @@
 t/13_server_rename_object.t
 t/14_server_xattr.t
+t/15_mounts.t
 t/75_parse_neb_key.t
Index: trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 17076)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 17077)
@@ -1,5 +1,5 @@
-# Copyright (c) 2004  Joshua Hoblitt
+# Copyright (c) 2004-2008  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.56 2008-03-20 23:29:56 jhoblitt Exp $
+# $Id: Server.pm,v 1.57 2008-03-21 01:24:36 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -1105,4 +1105,40 @@
 
 
+sub mounts
+{
+    my $self = shift;
+
+    validate_pos(@_); 
+
+    my $log = $self->log;
+    my $sql = $self->sql;
+    my $db  =$self->db;
+
+    $log->debug("entered - @_");
+
+    my $stats;
+    my $query;
+    eval {
+        # ask the db to generate the table of mounted Nebulous volume 
+        $db->do("call getmountedvol()");
+
+        $query = $db->prepare_cached( $sql->get_mounted_volumes );
+        $query->execute();
+
+        # suck that table into an AoA
+        $stats = $query->fetchall_arrayref;
+
+        $query->finish;
+    };
+    $log->logdie("database error: $@") if $@;
+
+    $log->logdie("no mounted volumes found") unless (scalar @$stats);
+
+    $log->debug("leaving");
+
+    return $stats;
+}
+
+
 sub _get_storage_volume
 {
Index: trunk/Nebulous-Server/lib/Nebulous/Server.pod
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pod	(revision 17076)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pod	(revision 17077)
@@ -27,4 +27,5 @@
     Nebulous::Server->delete_instance( $uri );
     Nebulous::Server->stat_object( $key );
+    Nebulous::Server->mounts();
 
 =head1 DESCRIPTION
@@ -97,4 +98,24 @@
     number of instances
 
+=item * mounts( $key );
+
+Accepts no parameters and returns an AoA of:
+
+    [
+        [
+            mountpoint,
+            total,
+            used,
+            vol_id,
+            name,
+            path,
+            allocate,
+            available,
+            xattr,
+        ],
+        [ ... ],
+        ...
+    ]
+
 =back
 
@@ -117,5 +138,5 @@
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2005  Joshua Hoblitt.  All rights reserved.
+Copyright (C) 2004-2008  Joshua Hoblitt.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under
Index: trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 17076)
+++ trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 17077)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.49 2008-03-20 21:10:57 jhoblitt Exp $
+# $Id: SQL.pm,v 1.50 2008-03-21 01:24:36 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -265,4 +265,7 @@
         GROUP BY so_id
         HAVING need_recovery = 1
+    },
+    get_mounted_volumes => qq{
+        SELECT * FROM mountedvol ORDER BY vol_id
     },
 );
Index: trunk/Nebulous-Server/t/15_mounts.t
===================================================================
--- trunk/Nebulous-Server/t/15_mounts.t	(revision 17077)
+++ trunk/Nebulous-Server/t/15_mounts.t	(revision 17077)
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2008  Joshua Hoblitt
+#
+# $Id: 15_mounts.t,v 1.1 2008-03-21 01:25:21 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 16;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::URI;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $mounts = $neb->mounts();
+
+    is(scalar @$mounts, 6, "number of rows");
+
+    my %row;
+    # first row
+    @row{qw(mountpoint total used vol_id name path allocate available xattr)}
+        = @{$mounts->[0]};
+    
+    is($row{total},     100000000000);
+    is($row{used},      100000000);
+    is($row{vol_id},    1);
+    is($row{name},      "node01");
+    is($row{allocate},  1);
+    is($row{available}, 1);
+    is($row{xattr},     0);
+
+    # 2nd row
+    @row{qw(mountpoint total used vol_id name path allocate available xattr)}
+        = @{$mounts->[1]};
+
+    is($row{total},     100000000000);
+    is($row{used},      1000000000);
+    is($row{vol_id},    2);
+    is($row{name},      "node02");
+    is($row{allocate},  1);
+    is($row{available}, 1);
+    is($row{xattr},     0);
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->mounts("foo");
+};
+like($@, qr/0 were expected/, "no params");
+
+Test::Nebulous->cleanup;
