Index: /trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5500)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5501)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.14 2005-11-10 21:31:26 jhoblitt Exp $
+# $Id: Server.pm,v 1.15 2005-11-10 21:51:06 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -82,4 +82,8 @@
         {
             type        => SCALAR,
+            callbacks   => {
+                # check that the volume requested is valid
+                'is valid volume name' => sub { _is_valid_volume_name($_[0]) },
+            },
             optional    => 1,
         },
@@ -97,5 +101,4 @@
 
     # check that the comment isn't too long
-    # check that the volume requested is valid
 
     my $uri;
@@ -702,4 +705,23 @@
 }
 
+sub _is_valid_volume_name  {
+    my $vol_name = shift;
+
+    my $volume;
+    eval {
+        my $query = $db->prepare_cached( $sql->get_volume_by_name  ); 
+        $query->execute( $vol_name );
+        ( $volume ) = $query->fetchrow_array;
+
+        $query->finish;
+    };
+    if ( $@ ) {
+        $db->rollback;
+        $log->logdie( "database error: $@" );
+    }
+
+    return ( defined $volume ) ? 1 : undef;
+}
+
 1;
 
Index: /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5500)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5501)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.15 2005-11-10 21:21:14 jhoblitt Exp $
+# $Id: SQL.pm,v 1.16 2005-11-10 21:51:06 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -128,4 +128,9 @@
         FROM class
         WHERE class_id = ?
+    },
+    get_volume_by_name => qq{
+        SELECT vol_id, name, uri
+        FROM volume
+        WHERE name = ?
     },
 );
Index: /trunk/Nebulous-Server/t/09_server_is_valid_volume_name.t
===================================================================
--- /trunk/Nebulous-Server/t/09_server_is_valid_volume_name.t	(revision 5501)
+++ /trunk/Nebulous-Server/t/09_server_is_valid_volume_name.t	(revision 5501)
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 09_server_is_valid_volume_name.t,v 1.1 2005-11-10 21:51:06 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 3;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Nebulous::Util qw( :standard );
+use Test::Nebulous;
+
+my $neb = "Nebulous::Server";
+
+$neb->init(
+    dsn         => "DBI:mysql:database=test:host=localhost",
+    dbuser      => "test",
+    dbpasswd    => "",
+);
+
+*_is_valid_volume_name = \&Nebulous::Server::_is_valid_volume_name;
+
+Test::Nebulous->setup;
+
+ok( _is_valid_volume_name( 'node01' ), "valid volume name" );
+
+Test::Nebulous->setup;
+
+ok( _is_valid_volume_name( 'node02' ), "valid volume name" );
+
+Test::Nebulous->setup;
+
+is( _is_valid_volume_name( 'node99' ), undef, "invalid volume name" );
+
+Test::Nebulous->cleanup;
Index: /trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5500)
+++ /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5501)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.14 2005-11-10 21:31:26 jhoblitt Exp $
+# $Id: Server.pm,v 1.15 2005-11-10 21:51:06 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -82,4 +82,8 @@
         {
             type        => SCALAR,
+            callbacks   => {
+                # check that the volume requested is valid
+                'is valid volume name' => sub { _is_valid_volume_name($_[0]) },
+            },
             optional    => 1,
         },
@@ -97,5 +101,4 @@
 
     # check that the comment isn't too long
-    # check that the volume requested is valid
 
     my $uri;
@@ -702,4 +705,23 @@
 }
 
+sub _is_valid_volume_name  {
+    my $vol_name = shift;
+
+    my $volume;
+    eval {
+        my $query = $db->prepare_cached( $sql->get_volume_by_name  ); 
+        $query->execute( $vol_name );
+        ( $volume ) = $query->fetchrow_array;
+
+        $query->finish;
+    };
+    if ( $@ ) {
+        $db->rollback;
+        $log->logdie( "database error: $@" );
+    }
+
+    return ( defined $volume ) ? 1 : undef;
+}
+
 1;
 
Index: /trunk/Nebulous/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5500)
+++ /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5501)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.15 2005-11-10 21:21:14 jhoblitt Exp $
+# $Id: SQL.pm,v 1.16 2005-11-10 21:51:06 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -128,4 +128,9 @@
         FROM class
         WHERE class_id = ?
+    },
+    get_volume_by_name => qq{
+        SELECT vol_id, name, uri
+        FROM volume
+        WHERE name = ?
     },
 );
Index: /trunk/Nebulous/t/09_server_is_valid_volume_name.t
===================================================================
--- /trunk/Nebulous/t/09_server_is_valid_volume_name.t	(revision 5501)
+++ /trunk/Nebulous/t/09_server_is_valid_volume_name.t	(revision 5501)
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 09_server_is_valid_volume_name.t,v 1.1 2005-11-10 21:51:06 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 3;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Nebulous::Util qw( :standard );
+use Test::Nebulous;
+
+my $neb = "Nebulous::Server";
+
+$neb->init(
+    dsn         => "DBI:mysql:database=test:host=localhost",
+    dbuser      => "test",
+    dbpasswd    => "",
+);
+
+*_is_valid_volume_name = \&Nebulous::Server::_is_valid_volume_name;
+
+Test::Nebulous->setup;
+
+ok( _is_valid_volume_name( 'node01' ), "valid volume name" );
+
+Test::Nebulous->setup;
+
+ok( _is_valid_volume_name( 'node02' ), "valid volume name" );
+
+Test::Nebulous->setup;
+
+is( _is_valid_volume_name( 'node99' ), undef, "invalid volume name" );
+
+Test::Nebulous->cleanup;
