Changeset 1152

Show
Ignore:
Timestamp:
02/29/08 00:20:21 (9 months ago)
Author:
hachi
Message:

Whitespace removals

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/lib/MogileFS/ReplicationPolicy/MultipleNetworks.pm

    r1151 r1152  
    3636    my $all_devs = delete $args{all_devs}; # hashref of { devid => MogileFS::Device } 
    3737    my $failed   = delete $args{failed};   # hashref of { devid => 1 } of failed attempts this round 
    38      
     38 
    3939    # old-style 
    4040    my $min      = delete $args{min}; 
    4141    $min         = $self->{mindevcount} || $min; 
    42      
     42 
    4343    warn "Unknown parameters: " . join(", ", sort keys %args) if %args; 
    4444    die "Missing parameters" unless $on_devs && $all_devs && $failed && $fid; 
    45      
     45 
    4646    # number of devices we currently live on 
    4747    my $already_on = @$on_devs; 
     
    5252    # total disks available which are candidates for having files on them 
    5353    my $total_disks = scalar grep { $_->dstate->should_have_files } values %$all_devs; 
    54     
     54 
    5555    # if we have two copies and that's all the disks there are 
    5656    # anywhere, be happy enough 
     
    6464        $on_host{$dev->hostid} = 1; 
    6565        $on_dev{$dev->id} = 1; 
    66          
     66 
    6767        my $on_ip = $dev->host->ip; 
    6868        if ($on_ip) { 
     
    103103                next if ($seen_host{$device->host->id}++); 
    104104 
    105                 foreach my $disliked_network (@skip_network) {                     
     105                foreach my $disliked_network (@skip_network) { 
    106106                    if (($disliked_network->match($device->host->ip)) and 
    107107                        (not $skip_host{$device->host->id})) { 
     
    122122 
    123123    return TEMP_NO_ANSWER unless @all_dests; 
    124      
     124 
    125125    my @ideal         = grep { ! $skip_host{$_->hostid} } @all_dests; 
    126126    # wrong network is less desparate than wrong host 
     
    139139 
    140140# can't just scalar keys %cache to count networks 
    141 # might include networks for which we have no hosts yet        
     141# might include networks for which we have no hosts yet 
    142142sub unique_hosts_and_networks { 
    143143    my ($devs) = @_; 
     
    148148        my $dev = $devs->{$devid}; 
    149149        next unless $dev->dstate->should_get_repl_files; 
    150             
     150 
    151151        $host{$dev->hostid}++; 
    152152 
     
    162162    my %cache; # '192.168.0.0/24' => Net::Netmask->new2('192.168.0.0/24'); 
    163163    my $age;   # increments everytime we look 
    164      
     164 
    165165    # turn a server ip into a network 
    166166    # defaults to /16 ranges 
     
    191191            } 
    192192        } 
    193          
     193 
    194194        if (not $network) {  
    195195            ($network) = ($ip =~ m/(\d+\.\d+)./); 
     
    197197            $network = Net::Netmask->new2($network); 
    198198        } 
    199          
     199 
    200200        return $network; 
    201201    } 
     
    205205 
    206206        my @zones = split(",",MogileFS::Config->server_setting("network_zones")); 
    207          
     207 
    208208        foreach my $zone (@zones) { 
    209209            my $netmask = MogileFS::Config->server_setting("zone_".$zone); 
     
    213213                next; 
    214214            } 
    215              
     215 
    216216            if ($cache{$netmask}) { 
    217217                warn "duplicate netmask <$netmask> in network zones. check your server settings"; 
    218218            } 
    219              
     219 
    220220            $cache{$netmask} = Net::Netmask->new2($netmask); 
    221              
     221 
    222222            if (Net::Netmask::errstr()) { 
    223223                warn "couldn't parse <$zone> as a netmask. error was <".Net::Netmask::errstr(). 
     
    229229    sub stuff_cache { # for testing, or it'll try the db 
    230230        my ($self, $ip, $netmask) = @_; 
    231          
     231 
    232232        $cache{$ip} = $netmask; 
    233233        $age = 1; 
    234     }     
    235 } 
    236      
     234    } 
     235} 
     236 
    2372371; 
    238238