20 Feb 2013 23:41
x2gobroker.git - master (branch) updated: 0.0.0.1-44-g6267590
The branch, master has been updated
via 62675904dff3890b3cd24cc9d819d4040bd38530 (commit)
from 7009b45598b63ddc76192f7fc87bc9a80b15e8bc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 62675904dff3890b3cd24cc9d819d4040bd38530
Author: Mike Gabriel <mike.gabriel@...>
Date: Wed Feb 20 23:44:32 2013 +0100
simplyfy findbusyservers mode in broker agent
-----------------------------------------------------------------------
Summary of changes:
lib/x2gobroker-agent.pl | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
The diff of changes is:
diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl
index 481de06..3155837 100755
--- a/lib/x2gobroker-agent.pl
+++ b/lib/x2gobroker-agent.pl
<at> <at> -121,36 +121,28 <at> <at> if( ($mode eq 'findbusyservers_by_sessionstats') || ($mode eq 'findbusyservers')
InitX2GoUser($uid, $uidNumber, $gidNumber, $home);
print "OK\n";
- my $session_list = `/bin/su - -c \"x2golistsessions_root --all-servers\"`;
my $busy_servers = `/bin/su - $uid -c \"x2gogetservers\"`;
- my $amount_sessions = 0;
- # initialize server_load hash
my %server_load = ();
+ my $num_sessions = 0;
foreach (split('\n', $busy_servers))
{
- $server_load{$_} = 0;
- }
-
- # count sessions per server
- my <at> session_list = split(/\n/, $session_list);
- foreach ( <at> session_list)
- {
- my ($apid, $sid, $disp, $hostname, $stat, $dcreated, $cookie, $gport, $sndport, $dsusp, $username,
$fsport) = split('\\|', $_);
- $amount_sessions++;
- $server_load{$hostname} += 1;
+ my ($hostname, $num_users) = split(' ', $_);
+ $server_load{$hostname} = $num_users;
+ $num_sessions += $num_users;
}
# render the output result
my <at> result;
for my $hostname ( keys %server_load ) {
- my $available = $server_load{$hostname}/$amount_sessions*100;
+ my $available = $server_load{$hostname}/$num_sessions*100;
push <at> result, sprintf '%1$d:%2$s', $available, $hostname;
}
- print join('\n', sort <at> result);
+ print join("\n", sort <at> result);
print "\n";
}
+
if($mode eq 'getservers')
{
InitX2GoUser($uid, $uidNumber, $gidNumber, $home);
hooks/post-receive
RSS Feed