Changeset 32476
- Timestamp:
- Oct 3, 2011, 3:16:23 PM (15 years ago)
- Location:
- tags/ipp-20110622/Nebulous
- Files:
-
- 5 edited
- 1 copied
-
. (modified) (1 prop)
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
bin/neb-repair (copied) (copied from trunk/Nebulous/bin/neb-repair )
-
bin/neb-shift (modified) (2 diffs)
-
bin/neb-stat (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20110622/Nebulous
- Property svn:mergeinfo set to
-
tags/ipp-20110622/Nebulous/Build.PL
r29894 r32476 116 116 bin/neb-mv 117 117 bin/neb-replicate 118 bin/neb-repair 118 119 bin/neb-rm 119 120 bin/neb-shift -
tags/ipp-20110622/Nebulous/MANIFEST
r28446 r32476 17 17 bin/neb-mv 18 18 bin/neb-replicate 19 bin/neb-repair 19 20 bin/neb-rm 20 21 bin/neb-shift -
tags/ipp-20110622/Nebulous/bin/neb-shift
r28446 r32476 29 29 30 30 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 31 pod2usage( -msg => "Required options: --server <source key> <source volume>",31 pod2usage( -msg => "Required options: --server --volume <source key> <source volume>", 32 32 -exitval => 2 ) 33 unless defined $server and defined $src and defined $abandon_vol ;33 unless defined $server and defined $src and defined $abandon_vol and defined $volume; 34 34 35 35 my $neb = Nebulous::Client->new( … … 45 45 } 46 46 47 my $all_uris = $neb->find_instances($src); 48 47 49 my $status; 48 if ($volume) { 49 $status = $neb->replicate( $src, $volume); 50 $status = $neb->replicate( $src, $volume); 51 die "Replicate phase failed for $src ($abandon_vol) ($volume)" unless $status; 52 53 $uris = $neb->find_instances($src, "~$volume"); 54 unless (defined $uris) { 55 die "Replicate phase failed for $src ($abandon_vol) ($volume)"; 50 56 } 51 else {52 $status = $neb->replicate($src);53 }54 die "Replicate phase failed for $src ($abandon_vol) ($volume)" unless $status;55 57 56 58 $status = $neb->cull($src,$abandon_vol); -
tags/ipp-20110622/Nebulous/bin/neb-stat
r24644 r32476 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($server); 18 use Digest::MD5; 19 use URI; 20 21 my ($validate,$server,$nouris); 19 22 20 23 $server = $ENV{'NEB_SERVER'} unless $server; … … 22 25 GetOptions( 23 26 'server|s=s' => \$server, 27 'validate|v' => \$validate, 28 'files' => \$nouris, 24 29 ) || pod2usage( 2 ); 25 30 … … 44 49 die "no instances found" unless $instances; 45 50 51 my $user_copies; 52 eval { 53 $user_copies = $neb->getxattr($key, "user.copies"); 54 }; 55 unless(defined($user_copies)) { 56 $user_copies = 1; 57 } 58 59 my @validation; 60 my %md5sum_uniq; 61 my $existing_copies = 0; 62 if (defined $validate) { 63 my @existance; 64 my @md5sums; 65 my @files = map {URI->new($_)->file if $_} @$instances; 66 67 for (my $i = 0; $i <= $#files; $i++) { 68 if (-e $files[$i]) { 69 $existance[$i] = 1; 70 $existing_copies++; 71 my $fh; 72 open($fh,$files[$i]); 73 $md5sums[$i] = Digest::MD5->new->addfile($fh)->hexdigest; 74 $md5sum_uniq{$md5sums[$i]} = 1; 75 close($fh); 76 } 77 else { 78 $existance[$i] = 0; 79 $md5sums[$i] = 'NON-EXISTANT'; 80 $md5sum_uniq{$md5sums[$i]} = 1; 81 } 82 if (defined($nouris)) { 83 $validation[$i] = sprintf("% 3d %32s %s", 84 $existance[$i], 85 $md5sums[$i], 86 $files[$i]); 87 } 88 else { 89 $validation[$i] = sprintf("% 3d %32s %s", 90 $existance[$i], 91 $md5sums[$i], 92 ${ $instances }[$i]); 93 } 94 } 95 } 96 46 97 no warnings qw(uninitialized); 47 print 48 "object id: ", @$stat[0], "\n", 49 "key: ", @$stat[1], "\n", 50 "read lock: ", @$stat[2], "\n", 51 "write lock: ", @$stat[3], "\n", 52 "epoch: ", @$stat[4], "\n", 53 "mtime: ", @$stat[5], "\n", 54 "available instances: ", @$stat[6], "\n", 55 "total instances: ", @$stat[7], "\n", 56 "instance location:\n", " " x 4, 57 join("\n" . " " x 4, @$instances), "\n"; 98 if (defined $validate) { 99 print 100 "object id: ", @$stat[0], "\n", 101 "key: ", @$stat[1], "\n", 102 "read lock: ", @$stat[2], "\n", 103 "write lock: ", @$stat[3], "\n", 104 "epoch: ", @$stat[4], "\n", 105 "mtime: ", @$stat[5], "\n", 106 "md5sum count: ", scalar(keys %md5sum_uniq), "\n", 107 "requested instances: ", $user_copies, "\n", 108 "available instances: ", @$stat[6], "\n", 109 "existing instances: ", $existing_copies, "\n", 110 "total instances: ", @$stat[7], "\n", 111 112 "instance location:\n", " " x 4, 113 join("\n" . " " x 4, @validation), "\n"; 114 } 115 else { 116 print 117 "object id: ", @$stat[0], "\n", 118 "key: ", @$stat[1], "\n", 119 "read lock: ", @$stat[2], "\n", 120 "write lock: ", @$stat[3], "\n", 121 "epoch: ", @$stat[4], "\n", 122 "mtime: ", @$stat[5], "\n", 123 "available instances: ", @$stat[6], "\n", 124 "requested instances: ", $user_copies, "\n", 125 "total instances: ", @$stat[7], "\n", 126 127 "instance location:\n", " " x 4, 128 join("\n" . " " x 4, @$instances), "\n"; 129 } 130 58 131 59 132 __END__ … … 67 140 =head1 SYNOPSIS 68 141 69 neb-stat [--server <URL>] <key>142 neb-stat [--server <URL>] [--validate] <key> 70 143 71 144 =head1 DESCRIPTION … … 82 155 83 156 Optional if the appropriate environment variable is set. 157 158 =item * --validate|-v 159 160 Optional - prints out additional information including md5sum. 161 162 =item * --files 163 164 Optional - prints out disk files instead of uris during validate stage. 84 165 85 166 =back
Note:
See TracChangeset
for help on using the changeset viewer.
