IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24995


Ignore:
Timestamp:
Aug 4, 2009, 10:45:57 AM (17 years ago)
Author:
jhoblitt
Message:

don't replicate to the volume being implied by the key being replicated!

Location:
trunk/Nebulous-Server
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r24915 r24995  
    3636      instance and just those that are available
    3737    - add Nebulous::Server->prune_object() API
     38    - don't replicate to the volume being implied by the key being replicated!
    3839     
    39400.16
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r24915 r24995  
    696696    $log->debug("entered - @_");
    697697
    698     my ($key, $vol_name) = validate_pos(@_,
     698    my ($key, $dest_vol_name) = validate_pos(@_,
    699699        {
    700700            type        => SCALAR,
     
    726726    # instance on it.  If all avilable volume already have an instance on them
    727727    # then we should throw an error
    728 
    729     # vol_name overrides the key implied volume
    730     eval {
    731         $key = parse_neb_key($key, $vol_name);
     728    # volume names implied as part of the key are *IGNORED* as the source and
     729    # *SHOULD NOT* be used as the destination either
     730
     731    eval {
     732        $key = parse_neb_key($key);
    732733    };
    733734    $log->logdie("$@") if $@;
    734     $vol_name = $key->volume;
    735735
    736736    my $db  = $self->db($key);
    737737
    738     if (defined $vol_name
     738    # puke if the source volume is bogus, we may want to actually use this as
     739    # the instance to be copied later
     740    if (defined $key->volume
    739741        and not $self->_is_valid_volume_name($key, $key->volume)) {
    740742        unless ($key->hard_volume) {
    741             $log->warn( "$vol_name is not a known volume name" );
    742             $vol_name = undef;
     743            $log->warn($key->volume . " not a known volume name");
    743744        } else {
    744            $log->logdie("$vol_name is not a valid volume name");
    745         }
     745           $log->logdie("$key is not a valid volume name");
     746        }
     747    }
     748    # puke if the source volume is bogus, we may want to actually use this as
     749    # the instance to be copied later
     750    if (defined $dest_vol_name
     751        and not $self->_is_valid_volume_name($key, $dest_vol_name)) {
     752           $log->logdie($key->volume . " is not a valid volume name");
    746753    }
    747754       
    748755    my ($vol_id, $vol_host, $vol_path, $vol_xattr);
    749     if (defined $vol_name) {
     756    if (defined $dest_vol_name) {
    750757        ($vol_id, $vol_host, $vol_path, $vol_xattr)
    751             = $self->_get_storage_volume($key, $vol_name);
     758            = $self->_get_storage_volume($key, $dest_vol_name);
    752759    } else {
    753760        ($vol_id, $vol_host, $vol_path, $vol_xattr)
     
    810817            $db->rollback;
    811818            # handle soft volumes
    812             if (defined $vol_name and not defined $key->hard_volume) {
     819            if (defined $dest_vol_name and not defined $key->hard_volume) {
    813820                $log->debug("retrying with 'any' volume");
    814821                return $self->replicate_object($key->path, 'any');
  • trunk/Nebulous-Server/t/05_server_replicate_object.t

    r24372 r24995  
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 26;
     10use Test::More tests => 25;
    1111
    1212use lib qw( ./t ./lib );
  • trunk/Nebulous-Server/t/09_server_delete_instance.t

    r24637 r24995  
    5858    my $key = "foo";
    5959    my $uri1 = $neb->create_object($key, 'node01');
    60     my $uri2 = $neb->replicate_object($key, 'node2');
     60    my $uri2 = $neb->replicate_object($key, 'node02');
    6161
    6262    # make one of the instances unavailable
Note: See TracChangeset for help on using the changeset viewer.