IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23696


Ignore:
Timestamp:
Apr 3, 2009, 9:38:20 AM (17 years ago)
Author:
jhoblitt
Message:

merge from neb_distrib_20081210

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/bin/neb-replicate

    r18390 r23696  
    2525    'volume|v=s'    => \$volume,
    2626    'copies|c=i'    => \$copies,
     27    'set_copies=i'  => \$set_copies,
    2728) || pod2usage( 2 );
    2829
     
    4445    unless defined $neb;
    4546
    46 for (my $i = 0; $i < $copies; $i++) {
    47     if (defined $volume) {
    48         $neb->replicate($key, $volume)
    49             or die "failed to replicate Nebulous key: $key";
    50     } else {
    51         $neb->replicate($key)
    52             or die "failed to replicate Nebulous key: $key";
     47# if replicate fails, we should still set user.copies (if requested)
     48my $replication_problem;
     49eval {
     50    for (my $i = 0; $i < $copies; $i++) {
     51        if (defined $volume) {
     52            $neb->replicate($key, $volume)
     53                or die "failed to replicate Nebulous key: $key";
     54        } else {
     55            $neb->replicate($key)
     56                or die "failed to replicate Nebulous key: $key";
     57        }
    5358    }
     59};
     60if ($@) {
     61    warn $@;
     62    $replication_problem = 1;
    5463}
    5564
     65if ($set_copies) {
     66    $neb->setxattr($key, "user.copies", $copies, "replace")
     67        or die $neb->err;
     68}
     69
     70exit(32) if defined $replication_problem;
    5671
    5772__END__
     
    6681
    6782    neb-replicate [--server <URL>] [--volume <volume name>]
    68                   [--copies <n>] <key>
     83                  [--copies <n>] [--set_copies <n>] <key>
    6984
    7085=head1 DESCRIPTION
     
    93108The number of new replications to create.
    94109
    95 Optional.  Defaults to 0.
     110Optional.  Defaults to 1.
     111
     112=item * --set_copies|c <n>
     113
     114Set the C<user.copies> xattr for this storage object to C<<n>>.
     115
     116Optional.
    96117
    97118=back
Note: See TracChangeset for help on using the changeset viewer.