version 1.251, 2014/08/06 17:16:29
|
version 1.252, 2014/10/04 02:41:44
|
Line 10793 sub modify_loadbalancing {
|
Line 10793 sub modify_loadbalancing {
|
\%defaultshash,$dom); |
\%defaultshash,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
|
my %toupdate; |
if (ref($changes{'delete'}) eq 'ARRAY') { |
if (ref($changes{'delete'}) eq 'ARRAY') { |
foreach my $balancer (sort(@{$changes{'delete'}})) { |
foreach my $balancer (sort(@{$changes{'delete'}})) { |
$resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>'; |
$resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>'; |
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
$toupdate{$balancer} = 1; |
&Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); |
|
} |
} |
} |
} |
if (ref($changes{'add'}) eq 'ARRAY') { |
if (ref($changes{'add'}) eq 'ARRAY') { |
foreach my $balancer (sort(@{$changes{'add'}})) { |
foreach my $balancer (sort(@{$changes{'add'}})) { |
$resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer); |
$resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer); |
|
$toupdate{$balancer} = 1; |
} |
} |
} |
} |
if (ref($changes{'curr'}) eq 'HASH') { |
if (ref($changes{'curr'}) eq 'HASH') { |
Line 10845 sub modify_loadbalancing {
|
Line 10846 sub modify_loadbalancing {
|
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
$balancetext = $ruletitles{$rule}; |
$balancetext = $ruletitles{$rule}; |
|
if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
|
foreach my $sparetype (@sparestypes) { |
|
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
|
map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}}); |
|
} |
|
} |
|
} |
} else { |
} else { |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |
} |
} |
Line 10853 sub modify_loadbalancing {
|
Line 10861 sub modify_loadbalancing {
|
} |
} |
} |
} |
} |
} |
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
if (keys(%toupdate)) { |
&Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); |
my %thismachine; |
|
my $updatedhere; |
|
my $cachetime = 60*60*24; |
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
|
foreach my $lonhost (keys(%toupdate)) { |
|
if ($thismachine{$lonhost}) { |
|
unless ($updatedhere) { |
|
&Apache::lonnet::do_cache_new('loadbalancing',$dom, |
|
$defaultshash{'loadbalancing'}, |
|
$cachetime); |
|
$updatedhere = 1; |
|
} |
|
} else { |
|
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
|
&Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]); |
|
} |
|
} |
|
} |
} |
} |
} |
} |
if ($resulttext ne '') { |
if ($resulttext ne '') { |