Changeset 19431 for trunk/Nebulous-Server/lib/Nebulous/Server.pm
- Timestamp:
- Sep 8, 2008, 4:18:47 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r19144 r19431 1 1 # Copyright (c) 2004-2008 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.8 3 2008-08-21 02:26:58jhoblitt Exp $3 # $Id: Server.pm,v 1.84 2008-09-09 02:18:47 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 150 150 { 151 151 type => SCALAR|UNDEF, 152 callbacks => {153 # check that the volume requested is valid154 '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 # }, 159 159 optional => 1, 160 160 }, … … 167 167 $log->debug( "entered - @_" ); 168 168 169 # vol_name overrides the key implied volume 169 170 $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 ) { 176 183 $log->logdie("$vol_name is not a valid volume name"); 177 184 } 178 185 179 if (defined $key->soft_volume) {180 $vol_name = undef;181 }182 183 186 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); 185 188 186 189 my $uri; … … 330 333 { 331 334 type => SCALAR|UNDEF, 332 callbacks => {333 # check that the volume name requested is valid334 '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 # }, 339 342 optional => 1, 340 343 }, … … 1164 1167 use warnings; 1165 1168 1166 my $name = shift;1169 my ($name, $soft_volume) = @_; 1167 1170 1168 1171 my ($vol_id, $vol_host, $vol_path, $xattr); … … 1178 1181 unless ($rows > 0) { 1179 1182 $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 } 1180 1189 $log->logdie("storage volume: $name is not available"); 1181 1190 }
Note:
See TracChangeset
for help on using the changeset viewer.
