IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 2, 2009, 3:00:37 PM (17 years ago)
Author:
jhoblitt
Message:

clean up --set_copies functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/neb_distrib_20081210/Nebulous/bin/neb-replicate

    r23568 r23691  
    4545    unless defined $neb;
    4646
    47 # XXX if replicate fails, we should still set user.copies (if requested)
    48 for (my $i = 0; $i < $copies; $i++) {
    49     if (defined $volume) {
    50         $neb->replicate($key, $volume)
    51             or die "failed to replicate Nebulous key: $key";
    52     } else {
    53         $neb->replicate($key)
    54             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        }
    5558    }
     59};
     60if ($@) {
     61    warn $@;
     62    $replication_problem = 1;
    5663}
    5764
    58 if (defined $set_copies && $set_copies) {
    59     write_xattrs($neb, $key, "user.copies:$set_copies") or die;
     65if ($set_copies) {
     66    $neb->setxattr($key, "user.copies", $copies, "replace")
     67        or die $neb->err;
    6068}
     69
     70exit(32) if defined $replication_problem;
    6171
    6272__END__
     
    7181
    7282    neb-replicate [--server <URL>] [--volume <volume name>]
    73                   [--copies <n>] <key>
     83                  [--copies <n>] [--set_copies <n>] <key>
    7484
    7585=head1 DESCRIPTION
     
    98108The number of new replications to create.
    99109
    100 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.
    101117
    102118=back
Note: See TracChangeset for help on using the changeset viewer.