[X2Go-Commits] [x2gobroker] 02/02: lib/x2gobroker-agent.pl: Make sure that the reported system load average is never zero.
git-admin at x2go.org
git-admin at x2go.org
Fri Jun 15 21:54:07 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gobroker.
commit e46b65aedef296804c9bc5ce2cecac494dfbdb31
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Jun 15 21:53:58 2018 +0200
lib/x2gobroker-agent.pl: Make sure that the reported system load average is never zero.
---
etc/x2gobroker.conf | 3 ++-
lib/x2gobroker-agent.pl | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/etc/x2gobroker.conf b/etc/x2gobroker.conf
index dc35007..23fe594 100644
--- a/etc/x2gobroker.conf
+++ b/etc/x2gobroker.conf
@@ -274,7 +274,8 @@
# load-factor = --------------------------------------
# loadavg*100 * numSessions
#
-# (memAvail in MByte, typeCPUs in MHz)
+# (memAvail in MByte, typeCPUs in MHz, loadavg is (system load *100 + 1) as
+# positive integer value)
#
# The higher the load-factor, the more likely that a server will be chosen
# for the next to be allocated X2Go session.
diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl
index 708ceca..18d6492 100755
--- a/lib/x2gobroker-agent.pl
+++ b/lib/x2gobroker-agent.pl
@@ -160,9 +160,9 @@ if ( $mode eq 'checkload' ) {
open FILE, "< /proc/loadavg" or die return ("Cannot open /proc/loadavg: $!");
my ($avg1, $avg5, $avg15, undef, undef) = split / /, <FILE>;
close FILE;
- my $loadavgXX = ( $avg1 + $avg5 + $avg15 ) * 100/3;
- if ( $loadavgXX == 0 ) {
- # load may not be ZERO
+ my $loadavgXX = ( $avg1 + $avg5 + $avg15 ) * 100/3 + 1;
+ if ( $loadavgXX lt 1 ) {
+ # load may not be ZERO, we should never get here...
$loadavgXX = 1;
}
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
More information about the x2go-commits
mailing list