Index: trunk/Nebulous-Server/Build.PL
===================================================================
--- trunk/Nebulous-Server/Build.PL	(revision 16566)
+++ trunk/Nebulous-Server/Build.PL	(revision 17072)
@@ -2,76 +2,5 @@
 # See perldoc Module::Build for details of how this works
 
-my $build_pkg   = eval { require Apache::TestMB }
-                ? 'Apache::TestMB'
-                : 'Module::Build';
-
-my $class = $build_pkg->subclass(code => <<'EOF');
-use Cwd;
-
-my $pkg_dir = "./nebclient";
-
-sub ACTION_code {
-    my $self = shift;
-
-    $self->SUPER::ACTION_code(@_);
-
-    my $old_pwd = getcwd();
-    chdir $pkg_dir;
-
-    unless (-e "configure") {
-        system("./autogen.sh") == 0 or die "install failed: $?";
-    }
-
-    chdir $old_pwd;
-}
-
-sub ACTION_build {
-    my $self = shift;
-
-    $self->SUPER::ACTION_build(@_);
-
-    my $old_pwd = getcwd();
-    chdir $pkg_dir;
-
-    unless (-e "Makefile") {
-        system("sh ./configure") == 0 or die "build failed: $?";
-    }
-
-    system("make") == 0 or die "build failed: $?";
-
-    chdir $old_pwd;
-}
-
-# Do not attempt to install nebclient.  It is bundled in this package for
-# testing only.
-#
-# sub ACTION_install {
-#     my $self = shift;
-# 
-#     $self->SUPER::ACTION_install(@_);
-# 
-#     my $old_pwd = getcwd();
-#     chdir $pkg_dir;
-# 
-#     system("make install") == 0 or die "install failed: $?";
-# 
-#     chdir $old_pwd;
-# }
-
-sub ACTION_clean {
-    my $self = shift;
-
-    $self->SUPER::ACTION_clean(@_);
-
-    my $old_pwd = getcwd();
-    chdir $pkg_dir;
-
-    system("make clean") == 0 or die "install failed: $?";
-
-    chdir $old_pwd;
-}
-EOF
-
-$class->new(
+Module::Build->new(
     module_name         => 'Nebulous',
     dist_version_from   => 'lib/Nebulous/Server.pm',
@@ -80,4 +9,5 @@
     create_makefile_pl  => 'passthrough',
     requires            => {
+        'Apache2::Const'        => 0,
         'Class::Accessor::Fast' => 0,
         'Config::YAML'          => '1.42',
@@ -89,4 +19,5 @@
         'File::Spec'            => 0,
         'File::Spec::Functions' => 0,
+        'File::Temp'            => 0,
         'Log::Log4perl'         => '0.48',
         'Net::Server::Daemonize'=> '0.05',
@@ -97,9 +28,4 @@
     },
     build_requires      => {
-        'Apache2::SOAP'         => 0,
-        'Apache::DBI'           => '1.05',
-        'Apache::Test'          => '1.27',  # bundles Apache::TestMB
-        'Apache::TestMB'        => 0,
-        'File::Temp'            => 0,
         'Test::More'            => '0.49',
         'Test::URI'             => '1.06',
@@ -107,20 +33,11 @@
     recommends          => {
         'Test::Distribution'    => '1.22',
+        'Apache2::SOAP'         => 0,
+        'Apache::DBI'           => '1.05',
     },
     script_files        => [qw(
         bin/neb-addvol
-        bin/neb-cat
-        bin/neb-cp
-        bin/neb-cull
-        bin/neb-df
         bin/neb-fsck
         bin/neb-initdb
-        bin/neb-locate
-        bin/neb-ls
-        bin/neb-mv
-        bin/neb-replicate
-        bin/neb-rm
-        bin/neb-stat
-        bin/neb-touch
         bin/nebdiskd
     )],
Index: trunk/Nebulous-Server/MANIFEST
===================================================================
--- trunk/Nebulous-Server/MANIFEST	(revision 16566)
+++ trunk/Nebulous-Server/MANIFEST	(revision 17072)
@@ -7,19 +7,7 @@
 README
 Todo
-autogen.sh
 bin/neb-addvol
-bin/neb-cat
-bin/neb-cp
-bin/neb-cull
-bin/neb-df
 bin/neb-fsck
 bin/neb-initdb
-bin/neb-locate
-bin/neb-ls
-bin/neb-mv
-bin/neb-replicate
-bin/neb-rm
-bin/neb-stat
-bin/neb-touch
 bin/nebdiskd
 docs/c_api.h
@@ -30,12 +18,9 @@
 docs/tmp.txt
 examples/Makefile
+examples/uri_test.pl
 examples/nebexample.c
 examples/nebexample.pl
-lib/Nebulous/Client.pm
-lib/Nebulous/Client.pod
-lib/Nebulous/Client/HTTP.pm
-lib/Nebulous/Client/Log.pm
-lib/Nebulous/Client/QuickStart.pod
-lib/Nebulous/Keys.pod
+lib/Test/Nebulous.pm
+lib/Nebulous/Keys.pm
 lib/Nebulous/Server.pm
 lib/Nebulous/Server.pod
@@ -45,52 +30,4 @@
 lib/Nebulous/Server/SOAP.pm
 lib/Nebulous/Server/SQL.pm
-lib/Nebulous/Util.pm
-nebclient/Doxyfile.in
-nebclient/Makefile.am
-nebclient/Makefile.in
-nebclient/aclocal.m4
-nebclient/autogen.sh
-nebclient/compile
-nebclient/config.guess
-nebclient/config.h.in
-nebclient/config.sub
-nebclient/configure
-nebclient/configure.ac
-nebclient/depcomp
-nebclient/install-sh
-nebclient/ltmain.sh
-nebclient/missing
-nebclient/nebclient.pc.in
-nebclient/nebulous.wsdl
-nebclient/src/Makefile.am
-nebclient/src/Makefile.in
-nebclient/src/SOAP.nsmap
-nebclient/src/nebclient.c
-nebclient/src/nebclient.h
-nebclient/src/soapC.c
-nebclient/src/soapClient.c
-nebclient/src/soapH.h
-nebclient/src/soapStub.h
-nebclient/src/stdsoap2.c
-nebclient/src/stdsoap2.h
-nebclient/src/xmalloc.c
-nebclient/src/xmalloc.h
-nebclient/tests/tap/INSTALL
-nebclient/tests/tap/Makefile.am
-nebclient/tests/tap/Makefile.in
-nebclient/tests/tap/README
-nebclient/tests/tap/aclocal.m4
-nebclient/tests/tap/compile
-nebclient/tests/tap/configure
-nebclient/tests/tap/configure.in
-nebclient/tests/tap/src/
-nebclient/tests/tap/src/Makefile.am
-nebclient/tests/tap/src/Makefile.in
-nebclient/tests/tap/src/config.h.in
-nebclient/tests/tap/src/tap.c
-nebclient/tests/tap/src/tap.h
-nebclient/tests/Makefile.am
-nebclient/tests/Makefile.in
-nebclient/tests/tests.c
 scripts/bench_test.pl
 scripts/nebulous.cgi
@@ -111,24 +48,2 @@
 t/13_server_rename_object.t
 t/14_server_xattr.t
-t/50_client_new.t
-t/51_client_create.t
-t/51_client_open_create.t
-t/52_client_replicate.t
-t/53_client_cull.t
-t/54_client_lock.t
-t/55_client_unlock.t
-t/56_client_find_instances.t
-t/57_client_find.t
-t/58_client_open.t
-t/59_client_delete.t
-t/60_client_copy.t
-t/61_client_move.t
-t/62_client_delete_instance.t
-t/63_client_stat.t
-t/64_client_find_objects.t
-t/75_parse_neb_key.t
-t/90_nebclient.t
-t/TEST.PL
-t/Test/Nebulous.pm
-t/conf/extra.conf.in
-t/conf/startup.pl.in
Index: trunk/Nebulous-Server/bin/neb-fsck
===================================================================
--- trunk/Nebulous-Server/bin/neb-fsck	(revision 16566)
+++ trunk/Nebulous-Server/bin/neb-fsck	(revision 17072)
@@ -3,5 +3,5 @@
 # Copyright (C) 2005-2008  Joshua Hoblitt
 #
-# $Id: neb-fsck,v 1.1 2008-01-30 00:19:34 jhoblitt Exp $
+# $Id: neb-fsck,v 1.2 2008-03-20 21:12:06 jhoblitt Exp $
 
 use strict;
@@ -59,4 +59,6 @@
 my $sql = Nebulous::Server::SQL->new();
 
+print "Pass 1: Look for objects with inaccessable instances\n";
+
 # so_id, ext_id, instances, available_instances, need_recovery, recoverable
 my $query = $dbh->prepare( $sql->find_objects_with_unavailable_instances );
@@ -70,14 +72,19 @@
 
 foreach my $obj (@rows) {
+#    use Data::Dumper;
+#    print Dumper($obj);
     my $so_id = $obj->{so_id};
     my $key = $obj->{ext_id};
     my $has = $obj->{instances};
-    my $available = $obj->{instances_available};
-    my $need = $obj->{need_recovery};
+    my $available = $obj->{available_instances} || 0;
+    my $need_recovery = $obj->{need_recovery};
     my $recoverable = $obj->{recoverable};
+    # if the copies xattr is unset and the object has 2 or more instances, we
+    # will assume a target of 2 copies
+    my $copies = $obj->{copies} || 2;
 
     # objects with only a single instance that are offline are unrecoverable so
     # we don't need to handle that special case
-    next unless $need;
+    next unless $need_recovery;
     unless ($recoverable) {
         warn "so_id: $so_id key: \'$key\' ",
@@ -86,13 +93,25 @@
     }
 
-    $available ||= 0;
-    next unless $available < 2;
-
-    warn "so_id: $so_id key: \'$key\' ",
-            " has only 1 instance avaiable -- replicating";
-
-    $neb->replicate($obj->{ext_id})
-        or warn "so_id: $so_id key: \'$key\' failed to replicate";
+    my $need = $copies - $available;
+    $need = 0 if $need < 0;
+
+    next unless $need;
+
+    for (; $need > 0; $need--) {
+        warn "so_id: $so_id key: \'$key\' ",
+            "has $available available instances, target $copies -- replicating";
+        $neb->replicate($obj->{ext_id})
+            or warn "so_id: $so_id key: \'$key\' replication failed";
+
+        $available++;
+    }
 }
+
+print "Pass 2: Check volumes for files without an instance\n";
+
+# get a list of volumes and their paths
+# get a list of all instances on a volume
+# get a list of all files under the volumes path
+# compare the two lists
 
 __END__
Index: trunk/Nebulous-Server/examples/uri_test.pl
===================================================================
--- trunk/Nebulous-Server/examples/uri_test.pl	(revision 17072)
+++ trunk/Nebulous-Server/examples/uri_test.pl	(revision 17072)
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use URI;
+
+my $u1 = URI->new("neb://www.perl.com/bar");
+
+print $u1->scheme, "\n";
+print $u1->opaque, "\n";
+print $u1->path, "\n";
+
+my $u2 = URI->new("neb:/www.perl.com");
+print $u2->scheme, "\n";
+print $u2->opaque, "\n";
+print $u2->path, "\n";
+
Index: trunk/Nebulous-Server/lib/Nebulous/Keys.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Keys.pm	(revision 17072)
+++ trunk/Nebulous-Server/lib/Nebulous/Keys.pm	(revision 17072)
@@ -0,0 +1,214 @@
+# Copyright (c) 2004  Joshua Hoblitt
+#
+# $Id: Keys.pm,v 1.1 2008-03-20 21:13:28 jhoblitt Exp $
+
+package Nebulous::Keys;
+
+use strict;
+use warnings FATAL => qw( all );
+
+our $VERSION = '0.01';
+
+use base qw( Exporter );
+
+use File::Spec::Functions;
+use URI::file;
+use URI;
+
+our @EXPORT_OK      = qw( parse_neb_key );
+
+sub parse_neb_key
+{
+    my $text = shift;
+    return unless defined $text;
+
+    # white space is not allowed
+    if ($text =~ qr/\s+/) {
+        die "keys and URIs may not contain whitespace";
+    }
+
+    my $uri = URI->new($text);
+    my $scheme = $uri->scheme;
+    my $path = $uri->opaque;
+    
+    my $volume;
+    # if this is a valid uri 
+    if (defined $scheme) {
+        # if so, does it use the neb scheme?
+        die "URI does not use the 'neb' scheme"
+            unless $scheme eq 'neb'; 
+
+        # neb:path (not allowed)
+        # neb://<volume name>/...
+        # neb:/path... (leading '/' is stripped)
+        # neb:///path... (same as neb:/path)
+
+        # volume specifier must be at least one character
+        # strip off volume component if it exists
+        $path =~ s|^//([^/]+)||;
+        $volume = $1;
+
+        # require a leading slash if there is no volume name
+        if ((not defined $volume) and (not $path =~ m|^/|)) {
+            die "neb URI scheme requires a leading slash, eg. neb:/";
+        }
+    }
+
+    # strip leading slashes
+    $path =~ s|^/+||;
+
+    # remove multiple /'s and trailing slashes
+    $path = canonpath($path);
+
+    return ($volume, $path);
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Nebulous::Keys - Nebulous Keys Explained
+
+=head1 DESCRIPTION
+
+The Nebulous system interprets it's storage object keys in a I<slightly>
+magical manner.  It supports both plain vanilla C<key strings> and keys in the
+form of an L<URI>.  In the L<URI> form a specific storage volume can be implied
+(as a request, not a requirement).  Both key forms are subject to mangling such
+that I<IF> the key I<looks> like a C<POSIX> semantics file path, it is
+canocalized.
+
+=head1 RESERVED SYNTAX
+
+This particular syntax is disallowed and is reserved for future use.
+
+    <neb:<phrase>/<path>
+
+=head1 EXAMPLES
+
+=head2 Key Strings
+
+    key:        foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        /foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        //foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        ///foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        foo////bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        foo/bar/baz/quix/
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+=head2 URI w/ volume name
+
+neb://<volume>/<path>
+
+    key:        neb://foo/bar/baz/quix
+    mangled to: bar/baz/quix
+    volume:     foo
+
+    key:        neb://foo//bar/baz/quix
+    mangled to: bar/baz/quix
+    volume:     foo
+
+    key:        neb://foo///bar/baz/quix
+    mangled to: bar/baz/quix
+    volume:     foo
+
+    key:        neb://foo/bar///baz/quix
+    mangled to: bar/baz/quix
+    volume:     foo
+
+    key:        neb://foo/bar/baz/quix/
+    mangled to: bar/baz/quix
+    volume:     foo
+
+=head2 URI w/o volume name
+
+neb:/<path>
+
+    key:        neb:/foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        neb:///foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+    key:        neb://///foo/bar/baz/quix
+    mangled to: foo/bar/baz/quix
+    volume:     any
+
+=head2 Forbidden Keys
+
+=head3 Key with whitespace
+
+    "/ foo/bar/baz/quix"
+    " /foo/bar/baz/quix"
+    "/foo/bar/baz/quix "
+
+=head3 URI with whitespace
+
+    "neb ://foo/bar/baz/quix"
+    "neb:// foo/bar/baz/quix"
+    " neb://foo/bar/baz/quix"
+    "neb://foo/bar/baz/quix "
+
+=head3 URI with out a volume requires a leading slash
+
+    neb:foo/bar/baz/quix
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the LICENSE file included with
+this module, or in the L<perlgpl> Pod as supplied with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<Nebulous::Server>, L<Nebulous::Client>, L<nebclient(3)>
+
+=cut
Index: trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 16566)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 17072)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.54 2008-02-21 23:21:09 jhoblitt Exp $
+# $Id: Server.pm,v 1.55 2008-03-20 21:10:57 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -21,5 +21,5 @@
 use Nebulous::Server::Log;
 use Nebulous::Server::SQL;
-use Nebulous::Util qw( :standard );
+use Nebulous::Keys qw( parse_neb_key );
 use Params::Validate qw( validate_pos SCALAR SCALARREF );
 use URI::file;
Index: trunk/Nebulous-Server/lib/Nebulous/Server/Config.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server/Config.pm	(revision 16566)
+++ trunk/Nebulous-Server/lib/Nebulous/Server/Config.pm	(revision 17072)
@@ -1,5 +1,5 @@
 # Copyright (C) 2005  Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.2 2006-12-12 00:06:27 jhoblitt Exp $
+# $Id: Config.pm,v 1.3 2008-03-20 21:10:57 jhoblitt Exp $
 
 package Nebulous::Server::Config;
@@ -12,6 +12,16 @@
 use base qw( Class::Accessor::Fast );
 
-use Nebulous::Util qw( %LEVELS );
+use Log::Log4perl qw( :levels );
 use Params::Validate qw( validate SCALAR );
+
+our %LEVELS = (
+    off     => $OFF,
+    fatal   => $FATAL,
+    error   => $ERROR,
+    warn    => $WARN,
+    info    => $INFO,
+    debug   => $DEBUG,
+    all     => $ALL,
+);
 
 my $new_validate = {
Index: trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 16566)
+++ trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 17072)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.48 2008-02-02 02:10:52 jhoblitt Exp $
+# $Id: SQL.pm,v 1.49 2008-03-20 21:10:57 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -246,18 +246,19 @@
     find_objects_with_unavailable_instances => qq{
         SELECT
-            so_id,
+            storage_object.so_id,
             ext_id,
             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
+            count(mountedvol.vol_id) > 0 as recoverable,
+            storage_object_xattr.value as copies
         FROM storage_object
         JOIN storage_object_attr
             USING(so_id)
-        JOIN storage_object_xattr
+        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'
-        JOIN instance
-            USING(so_id)
         LEFT JOIN mountedvol
             USING(vol_id)
Index: trunk/Nebulous-Server/lib/Test/Nebulous.pm
===================================================================
--- trunk/Nebulous-Server/lib/Test/Nebulous.pm	(revision 17072)
+++ trunk/Nebulous-Server/lib/Test/Nebulous.pm	(revision 17072)
@@ -0,0 +1,94 @@
+# Copyright (C) 2004  Joshua Hoblitt
+#
+# $Id: Nebulous.pm,v 1.1 2008-03-20 21:13:28 jhoblitt Exp $
+
+package Test::Nebulous;
+
+use strict;
+
+our $VERSION = '0.01';
+
+use base qw( Exporter );
+
+use DBI;
+use File::Path qw( mkpath rmtree );
+use File::Temp qw( tempdir );
+use Nebulous::Server::SQL;
+
+our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS );
+
+our $NEB_DB     = $ENV{'NEB_DB'}   || "DBI:mysql:database=test:host=localhost";
+our $NEB_USER   = $ENV{'NEB_USER'} || "test";
+our $NEB_PASS   = $ENV{'NEB_PASS'} || '';
+
+my $dbh = DBI->connect( $NEB_DB, $NEB_USER, $NEB_PASS );
+my $sql = Nebulous::Server::SQL->new;
+
+# suppress uninitalized warnings
+my $dir1 = "";
+my $dir2 = "";
+my $dir3 = "";
+my $dir4 = "";
+my $dir5 = "";
+my $dir6 = "";
+
+sub setup {
+    my $self = shift;
+
+    $self->cleanup;
+
+    # create directories after cleanup
+    $dir1 = tempdir( CLEANUP => 0 );
+    $dir2 = tempdir( CLEANUP => 0 );
+    $dir3 = tempdir( CLEANUP => 0 );
+    $dir4 = tempdir( CLEANUP => 0 );
+    $dir5 = tempdir( CLEANUP => 0 );
+    $dir6 = tempdir( CLEANUP => 0 );
+
+    foreach my $statement (@{ $sql->get_db_schema }) {
+        $dbh->do( $statement );
+    }
+
+    # node01/node02: allocate = TRUE
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (1, 'node01', ?, TRUE, TRUE) }, undef, $dir1);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir1);
+
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (2, 'node02', ?, TRUE, TRUE) }, undef, $dir2);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e8) }, undef, $dir2);
+
+    # node03: allocate = TRUE, volume full
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (3, 'node03', ?, TRUE, TRUE) }, undef, $dir3);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e10) }, undef, $dir3);
+
+    # node04: allocate = FALSE, available = FALSE
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (4, 'node04', ?, FALSE, FALSE) }, undef, $dir4);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir4);
+
+    # node05: allocate = FALSE, available = TRUE
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (5, 'node05', ?, FALSE, TRUE) }, undef, $dir5);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir5);
+
+    # node06: allocate = TRUE, available = FALSE
+    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (6, 'node06', ?, TRUE, FALSE) }, undef, $dir4);
+    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir6);
+
+    $dbh->do(qq{ call getmountedvol() });
+}
+
+sub cleanup {
+    foreach my $statement (@{ $sql->get_db_clear }) {
+        $dbh->do( $statement );
+    }
+
+    # on the first call to setup the $dir[12] will be ""
+    rmtree([$dir1], 0, 1) if -e $dir1;
+    rmtree([$dir2], 0, 1) if -e $dir2;
+    rmtree([$dir3], 0, 1) if -e $dir3;
+    rmtree([$dir4], 0, 1) if -e $dir4;
+    rmtree([$dir5], 0, 1) if -e $dir5;
+    rmtree([$dir6], 0, 1) if -e $dir6;
+}
+
+1;
+
+__END__
Index: trunk/Nebulous-Server/t/01_load.t
===================================================================
--- trunk/Nebulous-Server/t/01_load.t	(revision 16566)
+++ trunk/Nebulous-Server/t/01_load.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 01_load.t,v 1.7 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 01_load.t,v 1.8 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -10,10 +10,6 @@
 use lib qw( ./t ./lib );
 
-use Test::More tests => 8;
+use Test::More tests => 4;
 
-BEGIN { use_ok( 'Nebulous::Client' ); }
-BEGIN { use_ok( 'Nebulous::Client::Log' ); }
-BEGIN { use_ok( 'Nebulous::Client::HTTP' ); }
-BEGIN { use_ok( 'Nebulous::Util' ); }
 BEGIN { use_ok( 'Nebulous::Server' ); }
 BEGIN { use_ok( 'Nebulous::Server::SQL' ); }
Index: trunk/Nebulous-Server/t/03_server_create_object.t
===================================================================
--- trunk/Nebulous-Server/t/03_server_create_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/03_server_create_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 03_server_create_object.t,v 1.24 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 03_server_create_object.t,v 1.25 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -14,5 +14,4 @@
 use File::ExtAttr qw( getfattr );
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 use Test::URI;
Index: trunk/Nebulous-Server/t/04_server_replicate_object.t
===================================================================
--- trunk/Nebulous-Server/t/04_server_replicate_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/04_server_replicate_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 04_server_replicate_object.t,v 1.11 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 04_server_replicate_object.t,v 1.12 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -14,5 +14,4 @@
 use File::ExtAttr qw( getfattr );
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 use Test::URI;
Index: trunk/Nebulous-Server/t/05_server_lock_object.t
===================================================================
--- trunk/Nebulous-Server/t/05_server_lock_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/05_server_lock_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 05_server_lock_object.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 05_server_lock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/06_server_unlock_object.t
===================================================================
--- trunk/Nebulous-Server/t/06_server_unlock_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/06_server_unlock_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 06_server_unlock_object.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 06_server_unlock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/07_server_find_instances.t
===================================================================
--- trunk/Nebulous-Server/t/07_server_find_instances.t	(revision 16566)
+++ trunk/Nebulous-Server/t/07_server_find_instances.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 07_server_find_instances.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 07_server_find_instances.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::URI;
 use Test::Nebulous;
Index: trunk/Nebulous-Server/t/08_server_delete_instance.t
===================================================================
--- trunk/Nebulous-Server/t/08_server_delete_instance.t	(revision 16566)
+++ trunk/Nebulous-Server/t/08_server_delete_instance.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 08_server_delete_instance.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 08_server_delete_instance.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/09_server_stat_object.t
===================================================================
--- trunk/Nebulous-Server/t/09_server_stat_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/09_server_stat_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 09_server_stat_object.t,v 1.12 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 09_server_stat_object.t,v 1.13 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t
===================================================================
--- trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t	(revision 16566)
+++ trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 10_server_is_valid_volume_name.t,v 1.4 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 10_server_is_valid_volume_name.t,v 1.5 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/11_server_is_valid_object_key.t
===================================================================
--- trunk/Nebulous-Server/t/11_server_is_valid_object_key.t	(revision 16566)
+++ trunk/Nebulous-Server/t/11_server_is_valid_object_key.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 11_server_is_valid_object_key.t,v 1.2 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 11_server_is_valid_object_key.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/12_server_find_objects.t
===================================================================
--- trunk/Nebulous-Server/t/12_server_find_objects.t	(revision 16566)
+++ trunk/Nebulous-Server/t/12_server_find_objects.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 12_server_find_objects.t,v 1.2 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 12_server_find_objects.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/13_server_rename_object.t
===================================================================
--- trunk/Nebulous-Server/t/13_server_rename_object.t	(revision 16566)
+++ trunk/Nebulous-Server/t/13_server_rename_object.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2007  Joshua Hoblitt
 #
-# $Id: 13_server_rename_object.t,v 1.3 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 13_server_rename_object.t,v 1.4 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
Index: trunk/Nebulous-Server/t/14_server_xattr.t
===================================================================
--- trunk/Nebulous-Server/t/14_server_xattr.t	(revision 16566)
+++ trunk/Nebulous-Server/t/14_server_xattr.t	(revision 17072)
@@ -3,5 +3,5 @@
 # Copryight (C) 2007  Joshua Hoblitt
 #
-# $Id: 14_server_xattr.t,v 1.3 2008-02-02 01:51:29 jhoblitt Exp $
+# $Id: 14_server_xattr.t,v 1.4 2008-03-20 21:10:14 jhoblitt Exp $
 
 use strict;
@@ -13,5 +13,4 @@
 
 use Nebulous::Server;
-use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
