[X2go-Commits] x2gobroker.git - master (branch) updated: 0.0.0.6-15-g9ffb741

X2Go dev team git-admin at x2go.org
Thu Mar 7 05:54:30 CET 2013


The branch, master has been updated
       via  9ffb7417721a1ca2ab19e48cca2a545c92a56e0e (commit)
      from  02b425048b6beca03c0ae202d54005157dc71d5f (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 9ffb7417721a1ca2ab19e48cca2a545c92a56e0e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Mar 7 05:54:20 2013 +0100

    fix for load balancing of agent query mode is LOCAL

-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/brokers/base_broker.py |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

The diff of changes is:
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index f9fd037..333368e 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -789,6 +789,13 @@ class X2GoBroker(object):
 
     def random_remote_agent(self, profile_id, exclude_agents=[]):
         """\
+        Randomly choose a remote agent for agent query.
+
+        @param profile_id: choose remote agent for this profile ID
+        @type profile_id: C{unicode}
+        @param exclude_agents: a list of remote agent dict objects to be exclude from the random choice
+        @type exclude_agents: C{list}
+
         """
         profile = self.get_profile(profile_id)
         server_list = profile[u'host']
@@ -822,6 +829,7 @@ class X2GoBroker(object):
 
         # if we have more than one server, pick one server randomly for X2Go Broker Agent queries
         server_list = profile[u'host']
+        random.shuffle(server_list)
         agent_query_mode = self.get_agent_query_mode()
 
         remote_agent = None
@@ -831,7 +839,6 @@ class X2GoBroker(object):
         # detect best X2Go server for this user if load balancing is configured
         if len(server_list) >= 2 and username:
 
-
             # query remote agent for session info, if one of the server's is down, we will try the next one...
             busy_servers = None
             exclude_agents = []
@@ -842,12 +849,15 @@ class X2GoBroker(object):
                 except x2gobroker.X2GoBrokerAgentException:
                     logger_broker.warning('base_broker.X2GoBroker.select_session(): failed to query broker agent (quey-mode: {query_mode}, remote_agent: {remote_agent})'.format(query_mode=agent_query_mode, remote_agent=remote_agent))
 
-                    # mark this agent as bad
-                    exclude_agents.append(remote_agent)
-                    # also remove this agent from the list of available servers as the machine is probably down
-                    server_list.remove(remote_agent['hostname'])
+                    if agent_query_mode.upper() == u'SSH':
+                        # mark this agent as bad
+                        exclude_agents.append(remote_agent)
+                        # also remove this agent from the list of available servers as the machine is probably down
+                        server_list.remove(remote_agent['hostname'])
 
-                    remote_agent = self.random_remote_agent(profile_id, exclude_agents=exclude_agents)
+                        remote_agent = self.random_remote_agent(profile_id, exclude_agents=exclude_agents)
+                    else:
+                        remote_agent = None
 
             if busy_servers is not None:
 


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list