IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 8, 2008, 4:18:47 PM (18 years ago)
Author:
jhoblitt
Message:

start of inversion of soft volume semantics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r19144 r19431  
    11# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.83 2008-08-21 02:26:58 jhoblitt Exp $
     3# $Id: Server.pm,v 1.84 2008-09-09 02:18:47 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    150150        {
    151151            type        => SCALAR|UNDEF,
    152             callbacks   => {
    153                 # check that the volume requested is valid
    154                 'is valid volume name' => sub {
    155                     return 1 if not defined $_[0];
    156                     $self->_is_valid_volume_name($_[0])
    157                 },
    158             },
     152#            callbacks   => {
     153#                # check that the volume requested is valid
     154#                'is valid volume name' => sub {
     155#                    return 1 if not defined $_[0];
     156#                    $self->_is_valid_volume_name($_[0])
     157#                },
     158#            },
    159159            optional    => 1,
    160160        },
     
    167167    $log->debug( "entered - @_" );
    168168
     169    # vol_name overrides the key implied volume
    169170    $key = parse_neb_key($key, $vol_name);
    170     # vol_name overrides the key implied volume
    171     $vol_name = $key->volume;
    172 
    173     # the key isn't validiated on input for this method so we have to check it
    174     # again after parsing the key
    175     if (defined $vol_name and not $self->_is_valid_volume_name($vol_name)) {
     171
     172    if ($vol_name eq "99") {
     173        use Data::Dumper;
     174        print Dumper($key);
     175    }
     176
     177    # the key's volume can't be validiated on input for this method so we have
     178    # to check it after parsing the key
     179    if (defined $key->volume
     180        and not $key->soft_volume
     181        and not $self->_is_valid_volume_name($key->volume)
     182    ) {
    176183        $log->logdie("$vol_name is not a valid volume name");
    177184    }
    178185       
    179     if (defined $key->soft_volume) {
    180         $vol_name = undef;
    181     }
    182 
    183186    my ($vol_id, $vol_host, $vol_path, $vol_xattr)
    184         = $self->_get_storage_volume($vol_name);
     187        = $self->_get_storage_volume($key->volume, $key->soft_volume);
    185188
    186189    my $uri;
     
    330333        {
    331334            type        => SCALAR|UNDEF,
    332             callbacks   => {
    333                 # check that the volume name requested is valid
    334                 'is valid volume name' => sub {
    335                     return 1 if not defined $_[0];
    336                     $self->_is_valid_volume_name($_[0])
    337                 },
    338             },
     335#            callbacks   => {
     336#                # check that the volume name requested is valid
     337#                'is valid volume name' => sub {
     338#                    return 1 if not defined $_[0];
     339#                    $self->_is_valid_volume_name($_[0])
     340#                },
     341#            },
    339342            optional    => 1,
    340343        },
     
    11641167    use warnings;
    11651168
    1166     my $name = shift;
     1169    my ($name, $soft_volume) = @_;
    11671170
    11681171    my ($vol_id, $vol_host, $vol_path, $xattr);
     
    11781181            unless ($rows > 0) {
    11791182                $query->finish;
     1183
     1184                # if a volume name was specified, and is soft, and we failed to
     1185                # find it, fall back to any volume
     1186                if ($soft_volume) {
     1187                    return $self->_get_storage_volume;
     1188                }
    11801189                $log->logdie("storage volume: $name is not available");
    11811190            }
Note: See TracChangeset for help on using the changeset viewer.