[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16249193#comment-16249193
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10132:
---------------------------------------------

rhtyd commented on a change in pull request #2309: CLOUDSTACK-10132: Multiple 
Management Servers Support for agents
URL: https://github.com/apache/cloudstack/pull/2309#discussion_r150463668
 
 

 ##########
 File path: agent/src/com/cloud/agent/Agent.java
 ##########
 @@ -990,4 +1091,53 @@ public void doTask(final Task task) throws 
TaskExecutionException {
             }
         }
     }
+
+    public class HostLBCheckerTask extends ManagedContextTimerTask {
+
+         @Override
+         protected void runInContext() {
+             try {
+                 int index = 0;
+                 final String[] msList = _shell.getHosts();
+                 String preferredHost  = msList[index];
+                 final String connectedHost = _shell.getConnectedHost();
+                 if (s_logger.isTraceEnabled()) {
+                     s_logger.trace("Running host LB checker task, connected 
host=" + connectedHost + ", preferred host=" + preferredHost);
+                 }
+                 final long wait = _shell.getFailbackPollingWait();
+                 while (!preferredHost.equals(connectedHost)) {
 
 Review comment:
   Let's not have a while loop here. @nvazquez if you're not aware, when the 
agent is disconnected the `reconnect()` logic already kicks and is responsible 
for performing reconnections. This timer/task should not share the same 
responsibility, instead it should check if the preferred host (first in the 
list) is available and if the agent is already connected, only then it should 
disconnect by performing a reconnect on the `_link` (if it's not null for 
example).
   
   Bear in mind, we've two assumptions here (1) the first host in the list is 
the preferred one, (2) the timer task is responsible for reconnecting to the 
preferred host.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Multiple Management Servers Support for agents
> ----------------------------------------------
>
>                 Key: CLOUDSTACK-10132
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10132
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.11.0.0
>            Reporter: Nicolas Vazquez
>            Assignee: Nicolas Vazquez
>
> Multiple Management Servers Support for agents



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to