version 1.160.6.54, 2014/10/04 02:44:18
|
version 1.160.6.55, 2014/10/07 03:16:05
|
Line 3642 sub print_loadbalancing {
|
Line 3642 sub print_loadbalancing {
|
$disabled = ' disabled="disabled"'; |
$disabled = ' disabled="disabled"'; |
} |
} |
$targettable .= |
$targettable .= |
'<td><label><input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'. |
'<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'. |
$checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'"> '.$chkboxval. |
$checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'"> '.$chkboxval. |
'</span></label></td>'; |
'</span></label></span></td>'; |
my $rem = $i%($numinrow); |
my $rem = $i%($numinrow); |
if ($rem == 0) { |
if ($rem == 0) { |
if (($i > 0) && ($i < $numspares-1)) { |
if (($i > 0) && ($i < $numspares-1)) { |
Line 3734 sub loadbalancing_rules {
|
Line 3735 sub loadbalancing_rules {
|
if (ref($currrules) eq 'HASH') { |
if (ref($currrules) eq 'HASH') { |
$current = $currrules->{$type}; |
$current = $currrules->{$type}; |
} |
} |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { |
if ($dom ne &Apache::lonnet::host_domain($lonhost)) { |
if ($dom ne &Apache::lonnet::host_domain($lonhost)) { |
$current = ''; |
$current = ''; |
} |
} |
Line 3786 sub loadbalance_rule_row {
|
Line 3787 sub loadbalance_rule_row {
|
my @rulenames; |
my @rulenames; |
my %ruletitles = &offloadtype_text(); |
my %ruletitles = &offloadtype_text(); |
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { |
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { |
@rulenames = ('balancer','offloadedto'); |
@rulenames = ('balancer','offloadedto','specific'); |
} else { |
} else { |
@rulenames = ('default','homeserver'); |
@rulenames = ('default','homeserver'); |
if ($type eq '_LC_external') { |
if ($type eq '_LC_external') { |
Line 3797 sub loadbalance_rule_row {
|
Line 3798 sub loadbalance_rule_row {
|
push(@rulenames,'none'); |
push(@rulenames,'none'); |
} |
} |
my $style = $targets_div_style; |
my $style = $targets_div_style; |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { |
$style = $homedom_div_style; |
$style = $homedom_div_style; |
} |
} |
my $space; |
my $space; |
Line 3848 sub loadbalance_rule_row {
|
Line 3849 sub loadbalance_rule_row {
|
'<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type. |
'<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type. |
'" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'. |
'" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'. |
$rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'". |
$rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'". |
')"'.$checked.' /> '.$ruletitles{$rulenames[$i]}. |
')"'.$checked.' /> '; |
'</label>'.$extra.'</span><br />'."\n"; |
if (($rulenames[$i] eq 'specific') && ($type =~ /_LC_ipchange/)) { |
|
$output .= $ruletitles{'particular'}; |
|
} else { |
|
$output .= $ruletitles{$rulenames[$i]}; |
|
} |
|
$output .= '</label>'.$extra.'</span><br />'."\n"; |
} |
} |
$output .= '</div></td></tr>'."\n"; |
$output .= '</div></td></tr>'."\n"; |
return $output; |
return $output; |
Line 3864 sub offloadtype_text {
|
Line 3870 sub offloadtype_text {
|
'none' => 'No offload', |
'none' => 'No offload', |
'balancer' => 'Session hosted on Load Balancer, after re-authentication', |
'balancer' => 'Session hosted on Load Balancer, after re-authentication', |
'offloadedto' => 'Session hosted on offload server, after re-authentication', |
'offloadedto' => 'Session hosted on offload server, after re-authentication', |
|
'particular' => 'Session hosted (after re-auth) on server:', |
); |
); |
return %ruletitles; |
return %ruletitles; |
} |
} |
Line 10661 sub modify_loadbalancing {
|
Line 10668 sub modify_loadbalancing {
|
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($dom); |
&Apache::loncommon::sorted_inst_types($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
|
my %libraryservers = &Apache::lonnet::get_servers($dom,'library'); |
my @sparestypes = ('primary','default'); |
my @sparestypes = ('primary','default'); |
my %typetitles = &sparestype_titles(); |
my %typetitles = &sparestype_titles(); |
my $resulttext; |
my $resulttext; |
Line 10752 sub modify_loadbalancing {
|
Line 10760 sub modify_loadbalancing {
|
$rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; |
$rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; |
} |
} |
if ($rule eq 'specific') { |
if ($rule eq 'specific') { |
$rule = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
|
if (exists($servers{$specifiedhost})) { |
|
$rule = $specifiedhost; |
|
} |
} |
} |
$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule; |
$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule; |
if (ref($currrules{$balancer}) eq 'HASH') { |
if (ref($currrules{$balancer}) eq 'HASH') { |
Line 10789 sub modify_loadbalancing {
|
Line 10800 sub modify_loadbalancing {
|
} |
} |
if (ref($changes{'curr'}) eq 'HASH') { |
if (ref($changes{'curr'}) eq 'HASH') { |
foreach my $balancer (sort(keys(%{$changes{'curr'}}))) { |
foreach my $balancer (sort(keys(%{$changes{'curr'}}))) { |
|
$toupdate{$balancer} = 1; |
if (ref($changes{'curr'}{$balancer}) eq 'HASH') { |
if (ref($changes{'curr'}{$balancer}) eq 'HASH') { |
if ($changes{'curr'}{$balancer}{'targets'}) { |
if ($changes{'curr'}{$balancer}{'targets'}) { |
my %offloadstr; |
my %offloadstr; |
Line 10825 sub modify_loadbalancing {
|
Line 10837 sub modify_loadbalancing {
|
if ($rule eq '') { |
if ($rule eq '') { |
$balancetext = $ruletitles{'default'}; |
$balancetext = $ruletitles{'default'}; |
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
$balancetext = $ruletitles{$rule}; |
if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
|
foreach my $sparetype (@sparestypes) { |
foreach my $sparetype (@sparestypes) { |
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}}); |
map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}}); |
} |
} |
} |
} |
|
foreach my $item (@{$alltypes}) { |
|
next if ($item =~ /^_LC_ipchange/); |
|
my $hasrule = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$item}; |
|
if ($hasrule eq 'homeserver') { |
|
map { $toupdate{$_} = 1; } (keys(%libraryservers)); |
|
} else { |
|
unless (($hasrule eq 'default') || ($hasrule eq 'none') || ($hasrule eq 'externalbalancer')) { |
|
if ($servers{$hasrule}) { |
|
$toupdate{$hasrule} = 1; |
|
} |
|
} |
|
} |
|
} |
|
if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
|
$balancetext = $ruletitles{$rule}; |
|
} else { |
|
my $receiver = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}; |
|
$balancetext = $ruletitles{'particular'}.' '.$receiver; |
|
if ($receiver) { |
|
$toupdate{$receiver}; |
|
} |
|
} |
|
} else { |
|
$balancetext = $ruletitles{$rule}; |
} |
} |
} else { |
} else { |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |