Changeset 17072
- Timestamp:
- Mar 20, 2008, 11:13:28 AM (18 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 4 added
- 19 edited
-
Build.PL (modified) (5 diffs)
-
MANIFEST (modified) (4 diffs)
-
bin/neb-fsck (modified) (4 diffs)
-
examples/uri_test.pl (added)
-
lib/Nebulous/Keys.pm (added)
-
lib/Nebulous/Server.pm (modified) (2 diffs)
-
lib/Nebulous/Server/Config.pm (modified) (2 diffs)
-
lib/Nebulous/Server/SQL.pm (modified) (2 diffs)
-
lib/Test (added)
-
lib/Test/Nebulous.pm (added)
-
t/01_load.t (modified) (2 diffs)
-
t/03_server_create_object.t (modified) (2 diffs)
-
t/04_server_replicate_object.t (modified) (2 diffs)
-
t/05_server_lock_object.t (modified) (2 diffs)
-
t/06_server_unlock_object.t (modified) (2 diffs)
-
t/07_server_find_instances.t (modified) (2 diffs)
-
t/08_server_delete_instance.t (modified) (2 diffs)
-
t/09_server_stat_object.t (modified) (2 diffs)
-
t/10_server_is_valid_volume_name.t (modified) (2 diffs)
-
t/11_server_is_valid_object_key.t (modified) (2 diffs)
-
t/12_server_find_objects.t (modified) (2 diffs)
-
t/13_server_rename_object.t (modified) (2 diffs)
-
t/14_server_xattr.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Build.PL
r16565 r17072 2 2 # See perldoc Module::Build for details of how this works 3 3 4 my $build_pkg = eval { require Apache::TestMB } 5 ? 'Apache::TestMB' 6 : 'Module::Build'; 7 8 my $class = $build_pkg->subclass(code => <<'EOF'); 9 use Cwd; 10 11 my $pkg_dir = "./nebclient"; 12 13 sub ACTION_code { 14 my $self = shift; 15 16 $self->SUPER::ACTION_code(@_); 17 18 my $old_pwd = getcwd(); 19 chdir $pkg_dir; 20 21 unless (-e "configure") { 22 system("./autogen.sh") == 0 or die "install failed: $?"; 23 } 24 25 chdir $old_pwd; 26 } 27 28 sub ACTION_build { 29 my $self = shift; 30 31 $self->SUPER::ACTION_build(@_); 32 33 my $old_pwd = getcwd(); 34 chdir $pkg_dir; 35 36 unless (-e "Makefile") { 37 system("sh ./configure") == 0 or die "build failed: $?"; 38 } 39 40 system("make") == 0 or die "build failed: $?"; 41 42 chdir $old_pwd; 43 } 44 45 # Do not attempt to install nebclient. It is bundled in this package for 46 # testing only. 47 # 48 # sub ACTION_install { 49 # my $self = shift; 50 # 51 # $self->SUPER::ACTION_install(@_); 52 # 53 # my $old_pwd = getcwd(); 54 # chdir $pkg_dir; 55 # 56 # system("make install") == 0 or die "install failed: $?"; 57 # 58 # chdir $old_pwd; 59 # } 60 61 sub ACTION_clean { 62 my $self = shift; 63 64 $self->SUPER::ACTION_clean(@_); 65 66 my $old_pwd = getcwd(); 67 chdir $pkg_dir; 68 69 system("make clean") == 0 or die "install failed: $?"; 70 71 chdir $old_pwd; 72 } 73 EOF 74 75 $class->new( 4 Module::Build->new( 76 5 module_name => 'Nebulous', 77 6 dist_version_from => 'lib/Nebulous/Server.pm', … … 80 9 create_makefile_pl => 'passthrough', 81 10 requires => { 11 'Apache2::Const' => 0, 82 12 'Class::Accessor::Fast' => 0, 83 13 'Config::YAML' => '1.42', … … 89 19 'File::Spec' => 0, 90 20 'File::Spec::Functions' => 0, 21 'File::Temp' => 0, 91 22 'Log::Log4perl' => '0.48', 92 23 'Net::Server::Daemonize'=> '0.05', … … 97 28 }, 98 29 build_requires => { 99 'Apache2::SOAP' => 0,100 'Apache::DBI' => '1.05',101 'Apache::Test' => '1.27', # bundles Apache::TestMB102 'Apache::TestMB' => 0,103 'File::Temp' => 0,104 30 'Test::More' => '0.49', 105 31 'Test::URI' => '1.06', … … 107 33 recommends => { 108 34 'Test::Distribution' => '1.22', 35 'Apache2::SOAP' => 0, 36 'Apache::DBI' => '1.05', 109 37 }, 110 38 script_files => [qw( 111 39 bin/neb-addvol 112 bin/neb-cat113 bin/neb-cp114 bin/neb-cull115 bin/neb-df116 40 bin/neb-fsck 117 41 bin/neb-initdb 118 bin/neb-locate119 bin/neb-ls120 bin/neb-mv121 bin/neb-replicate122 bin/neb-rm123 bin/neb-stat124 bin/neb-touch125 42 bin/nebdiskd 126 43 )], -
trunk/Nebulous-Server/MANIFEST
r16264 r17072 7 7 README 8 8 Todo 9 autogen.sh10 9 bin/neb-addvol 11 bin/neb-cat12 bin/neb-cp13 bin/neb-cull14 bin/neb-df15 10 bin/neb-fsck 16 11 bin/neb-initdb 17 bin/neb-locate18 bin/neb-ls19 bin/neb-mv20 bin/neb-replicate21 bin/neb-rm22 bin/neb-stat23 bin/neb-touch24 12 bin/nebdiskd 25 13 docs/c_api.h … … 30 18 docs/tmp.txt 31 19 examples/Makefile 20 examples/uri_test.pl 32 21 examples/nebexample.c 33 22 examples/nebexample.pl 34 lib/Nebulous/Client.pm 35 lib/Nebulous/Client.pod 36 lib/Nebulous/Client/HTTP.pm 37 lib/Nebulous/Client/Log.pm 38 lib/Nebulous/Client/QuickStart.pod 39 lib/Nebulous/Keys.pod 23 lib/Test/Nebulous.pm 24 lib/Nebulous/Keys.pm 40 25 lib/Nebulous/Server.pm 41 26 lib/Nebulous/Server.pod … … 45 30 lib/Nebulous/Server/SOAP.pm 46 31 lib/Nebulous/Server/SQL.pm 47 lib/Nebulous/Util.pm48 nebclient/Doxyfile.in49 nebclient/Makefile.am50 nebclient/Makefile.in51 nebclient/aclocal.m452 nebclient/autogen.sh53 nebclient/compile54 nebclient/config.guess55 nebclient/config.h.in56 nebclient/config.sub57 nebclient/configure58 nebclient/configure.ac59 nebclient/depcomp60 nebclient/install-sh61 nebclient/ltmain.sh62 nebclient/missing63 nebclient/nebclient.pc.in64 nebclient/nebulous.wsdl65 nebclient/src/Makefile.am66 nebclient/src/Makefile.in67 nebclient/src/SOAP.nsmap68 nebclient/src/nebclient.c69 nebclient/src/nebclient.h70 nebclient/src/soapC.c71 nebclient/src/soapClient.c72 nebclient/src/soapH.h73 nebclient/src/soapStub.h74 nebclient/src/stdsoap2.c75 nebclient/src/stdsoap2.h76 nebclient/src/xmalloc.c77 nebclient/src/xmalloc.h78 nebclient/tests/tap/INSTALL79 nebclient/tests/tap/Makefile.am80 nebclient/tests/tap/Makefile.in81 nebclient/tests/tap/README82 nebclient/tests/tap/aclocal.m483 nebclient/tests/tap/compile84 nebclient/tests/tap/configure85 nebclient/tests/tap/configure.in86 nebclient/tests/tap/src/87 nebclient/tests/tap/src/Makefile.am88 nebclient/tests/tap/src/Makefile.in89 nebclient/tests/tap/src/config.h.in90 nebclient/tests/tap/src/tap.c91 nebclient/tests/tap/src/tap.h92 nebclient/tests/Makefile.am93 nebclient/tests/Makefile.in94 nebclient/tests/tests.c95 32 scripts/bench_test.pl 96 33 scripts/nebulous.cgi … … 111 48 t/13_server_rename_object.t 112 49 t/14_server_xattr.t 113 t/50_client_new.t114 t/51_client_create.t115 t/51_client_open_create.t116 t/52_client_replicate.t117 t/53_client_cull.t118 t/54_client_lock.t119 t/55_client_unlock.t120 t/56_client_find_instances.t121 t/57_client_find.t122 t/58_client_open.t123 t/59_client_delete.t124 t/60_client_copy.t125 t/61_client_move.t126 t/62_client_delete_instance.t127 t/63_client_stat.t128 t/64_client_find_objects.t129 t/75_parse_neb_key.t130 t/90_nebclient.t131 t/TEST.PL132 t/Test/Nebulous.pm133 t/conf/extra.conf.in134 t/conf/startup.pl.in -
trunk/Nebulous-Server/bin/neb-fsck
r16264 r17072 3 3 # Copyright (C) 2005-2008 Joshua Hoblitt 4 4 # 5 # $Id: neb-fsck,v 1. 1 2008-01-30 00:19:34jhoblitt Exp $5 # $Id: neb-fsck,v 1.2 2008-03-20 21:12:06 jhoblitt Exp $ 6 6 7 7 use strict; … … 59 59 my $sql = Nebulous::Server::SQL->new(); 60 60 61 print "Pass 1: Look for objects with inaccessable instances\n"; 62 61 63 # so_id, ext_id, instances, available_instances, need_recovery, recoverable 62 64 my $query = $dbh->prepare( $sql->find_objects_with_unavailable_instances ); … … 70 72 71 73 foreach my $obj (@rows) { 74 # use Data::Dumper; 75 # print Dumper($obj); 72 76 my $so_id = $obj->{so_id}; 73 77 my $key = $obj->{ext_id}; 74 78 my $has = $obj->{instances}; 75 my $available = $obj->{ instances_available};76 my $need = $obj->{need_recovery};79 my $available = $obj->{available_instances} || 0; 80 my $need_recovery = $obj->{need_recovery}; 77 81 my $recoverable = $obj->{recoverable}; 82 # if the copies xattr is unset and the object has 2 or more instances, we 83 # will assume a target of 2 copies 84 my $copies = $obj->{copies} || 2; 78 85 79 86 # objects with only a single instance that are offline are unrecoverable so 80 87 # we don't need to handle that special case 81 next unless $need ;88 next unless $need_recovery; 82 89 unless ($recoverable) { 83 90 warn "so_id: $so_id key: \'$key\' ", … … 86 93 } 87 94 88 $available ||= 0; 89 next unless $available < 2; 90 91 warn "so_id: $so_id key: \'$key\' ", 92 " has only 1 instance avaiable -- replicating"; 93 94 $neb->replicate($obj->{ext_id}) 95 or warn "so_id: $so_id key: \'$key\' failed to replicate"; 95 my $need = $copies - $available; 96 $need = 0 if $need < 0; 97 98 next unless $need; 99 100 for (; $need > 0; $need--) { 101 warn "so_id: $so_id key: \'$key\' ", 102 "has $available available instances, target $copies -- replicating"; 103 $neb->replicate($obj->{ext_id}) 104 or warn "so_id: $so_id key: \'$key\' replication failed"; 105 106 $available++; 107 } 96 108 } 109 110 print "Pass 2: Check volumes for files without an instance\n"; 111 112 # get a list of volumes and their paths 113 # get a list of all instances on a volume 114 # get a list of all files under the volumes path 115 # compare the two lists 97 116 98 117 __END__ -
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r16566 r17072 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.5 4 2008-02-21 23:21:09jhoblitt Exp $3 # $Id: Server.pm,v 1.55 2008-03-20 21:10:57 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 21 21 use Nebulous::Server::Log; 22 22 use Nebulous::Server::SQL; 23 use Nebulous:: Util qw( :standard);23 use Nebulous::Keys qw( parse_neb_key ); 24 24 use Params::Validate qw( validate_pos SCALAR SCALARREF ); 25 25 use URI::file; -
trunk/Nebulous-Server/lib/Nebulous/Server/Config.pm
r10628 r17072 1 1 # Copyright (C) 2005 Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1. 2 2006-12-12 00:06:27 jhoblitt Exp $3 # $Id: Config.pm,v 1.3 2008-03-20 21:10:57 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::Config; … … 12 12 use base qw( Class::Accessor::Fast ); 13 13 14 use Nebulous::Util qw( %LEVELS);14 use Log::Log4perl qw( :levels ); 15 15 use Params::Validate qw( validate SCALAR ); 16 17 our %LEVELS = ( 18 off => $OFF, 19 fatal => $FATAL, 20 error => $ERROR, 21 warn => $WARN, 22 info => $INFO, 23 debug => $DEBUG, 24 all => $ALL, 25 ); 16 26 17 27 my $new_validate = { -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r16282 r17072 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.4 8 2008-02-02 02:10:52jhoblitt Exp $3 # $Id: SQL.pm,v 1.49 2008-03-20 21:10:57 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 246 246 find_objects_with_unavailable_instances => qq{ 247 247 SELECT 248 s o_id,248 storage_object.so_id, 249 249 ext_id, 250 250 count(ins_id) as instances, 251 251 count(mountedvol.vol_id) as available_instances, 252 252 count(mountedvol.vol_id) < count(ins_id) as need_recovery, 253 count(mountedvol.vol_id) > 0 as recoverable 253 count(mountedvol.vol_id) > 0 as recoverable, 254 storage_object_xattr.value as copies 254 255 FROM storage_object 255 256 JOIN storage_object_attr 256 257 USING(so_id) 257 JOIN storage_object_xattr 258 JOIN instance 259 USING(so_id) 260 LEFT JOIN storage_object_xattr 258 261 ON storage_object.so_id = storage_object_xattr.so_id 259 262 AND storage_object_xattr.name = 'copies' 260 JOIN instance261 USING(so_id)262 263 LEFT JOIN mountedvol 263 264 USING(vol_id) -
trunk/Nebulous-Server/t/01_load.t
r4440 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 01_load.t,v 1. 7 2005-06-30 02:35:06jhoblitt Exp $5 # $Id: 01_load.t,v 1.8 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use lib qw( ./t ./lib ); 11 11 12 use Test::More tests => 8;12 use Test::More tests => 4; 13 13 14 BEGIN { use_ok( 'Nebulous::Client' ); }15 BEGIN { use_ok( 'Nebulous::Client::Log' ); }16 BEGIN { use_ok( 'Nebulous::Client::HTTP' ); }17 BEGIN { use_ok( 'Nebulous::Util' ); }18 14 BEGIN { use_ok( 'Nebulous::Server' ); } 19 15 BEGIN { use_ok( 'Nebulous::Server::SQL' ); } -
trunk/Nebulous-Server/t/03_server_create_object.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 03_server_create_object.t,v 1.2 4 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 03_server_create_object.t,v 1.25 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 14 14 use File::ExtAttr qw( getfattr ); 15 15 use Nebulous::Server; 16 use Nebulous::Util qw( :standard );17 16 use Test::Nebulous; 18 17 use Test::URI; -
trunk/Nebulous-Server/t/04_server_replicate_object.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 04_server_replicate_object.t,v 1.1 1 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 04_server_replicate_object.t,v 1.12 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 14 14 use File::ExtAttr qw( getfattr ); 15 15 use Nebulous::Server; 16 use Nebulous::Util qw( :standard );17 16 use Test::Nebulous; 18 17 use Test::URI; -
trunk/Nebulous-Server/t/05_server_lock_object.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 05_server_lock_object.t,v 1. 9 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 05_server_lock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/06_server_unlock_object.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 06_server_unlock_object.t,v 1. 9 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 06_server_unlock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/07_server_find_instances.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 07_server_find_instances.t,v 1. 9 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 07_server_find_instances.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::URI; 17 16 use Test::Nebulous; -
trunk/Nebulous-Server/t/08_server_delete_instance.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 08_server_delete_instance.t,v 1. 9 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 08_server_delete_instance.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/09_server_stat_object.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 09_server_stat_object.t,v 1.1 2 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 09_server_stat_object.t,v 1.13 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 10_server_is_valid_volume_name.t,v 1. 4 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 10_server_is_valid_volume_name.t,v 1.5 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/11_server_is_valid_object_key.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 11_server_is_valid_object_key.t,v 1. 2 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 11_server_is_valid_object_key.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/12_server_find_objects.t
r16281 r17072 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 12_server_find_objects.t,v 1. 2 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 12_server_find_objects.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/13_server_rename_object.t
r16281 r17072 3 3 # Copryight (C) 2007 Joshua Hoblitt 4 4 # 5 # $Id: 13_server_rename_object.t,v 1. 3 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 13_server_rename_object.t,v 1.4 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16 -
trunk/Nebulous-Server/t/14_server_xattr.t
r16281 r17072 3 3 # Copryight (C) 2007 Joshua Hoblitt 4 4 # 5 # $Id: 14_server_xattr.t,v 1. 3 2008-02-02 01:51:29jhoblitt Exp $5 # $Id: 14_server_xattr.t,v 1.4 2008-03-20 21:10:14 jhoblitt Exp $ 6 6 7 7 use strict; … … 13 13 14 14 use Nebulous::Server; 15 use Nebulous::Util qw( :standard );16 15 use Test::Nebulous; 17 16
Note:
See TracChangeset
for help on using the changeset viewer.
