[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Wed May 30 12:29:26 EDT 2012
raeburn Wed May 30 16:29:26 2012 EDT
Modified files:
/loncom/interface domainprefs.pm
/loncom/lonnet/perl lonnet.pm
Log:
- Loadbalancing.
- For a specified loadbalancing server add option to not offload specific
types of users (e.g., authors).
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160 loncom/interface/domainprefs.pm:1.161
--- loncom/interface/domainprefs.pm:1.160 Wed Nov 30 18:31:04 2011
+++ loncom/interface/domainprefs.pm Wed May 30 16:29:20 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160 2011/11/30 18:31:04 raeburn Exp $
+# $Id: domainprefs.pm,v 1.161 2012/05/30 16:29:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2914,6 +2914,7 @@
} else {
push(@rulenames,'specific');
}
+ push(@rulenames,'none');
my $style = $targets_div_style;
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
$style = $homedom_div_style;
@@ -2970,6 +2971,7 @@
'homeserver' => "Offloads to user's home server",
'externalbalancer' => "Offloads to Load Balancer in user's domain",
'specific' => 'Offloads to specific server',
+ 'none' => 'No offload',
);
return %ruletitles;
}
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1174 loncom/lonnet/perl/lonnet.pm:1.1175
--- loncom/lonnet/perl/lonnet.pm:1.1174 Mon May 28 12:28:14 2012
+++ loncom/lonnet/perl/lonnet.pm Wed May 30 16:29:25 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1174 2012/05/28 12:28:14 raeburn Exp $
+# $Id: lonnet.pm,v 1.1175 2012/05/30 16:29:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1239,6 +1239,7 @@
my ($is_balancer,$dom_in_use,$homeintdom,$rule_in_effect,
$offloadto,$otherserver);
my $lonhost = $perlvar{'lonHostID'};
+ my @hosts = ¤t_machine_ids();
my $uprimary_id = &Apache::lonnet::domain($udom,'primary');
my $uintdom = &Apache::lonnet::internet_dom($uprimary_id);
my $intdom = &Apache::lonnet::internet_dom($lonhost);
@@ -1265,7 +1266,6 @@
my $currtargets = $result->{'targets'};
my $currrules = $result->{'rules'};
if ($currbalancer ne '') {
- my @hosts = ¤t_machine_ids();
if (grep(/^\Q$currbalancer\E$/, at hosts)) {
$is_balancer = 1;
}
@@ -1381,13 +1381,18 @@
}
}
}
+ if (($otherserver ne '') && (grep(/^\Q$otherserver\E$/, at hosts))) {
+ $is_balancer = 0;
+ }
return ($is_balancer,$otherserver);
}
sub get_loadbalancer_targets {
my ($rule_in_effect,$currtargets,$uname,$udom) = @_;
my $offloadto;
- if ($rule_in_effect eq '') {
+ if ($rule_in_effect eq 'none') {
+ return [$perlvar{'lonHostID'}];
+ } elsif ($rule_in_effect eq '') {
$offloadto = $currtargets;
} else {
if ($rule_in_effect eq 'homeserver') {
More information about the LON-CAPA-cvs
mailing list