cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10132) Multiple Management Servers Support for agents
Date Mon, 13 Nov 2017 07:41:00 GMT

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

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_r150463839
 
 

 ##########
 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)) {
+                     if (_link != null) {
+                         boolean isHostUp = true;
+                         try (final Socket socket = new Socket()) {
+                             socket.connect(new InetSocketAddress(preferredHost, _shell.getPort()),
5000);
+                         } catch (final IOException e) {
+                             isHostUp = false;
+                             if (s_logger.isDebugEnabled()) {
+                                 s_logger.debug("Host: " + preferredHost + " is not reachable,
trying to reconnect to next host...");
+                             }
+                         }
+                         if (isHostUp && _link != null) {
+                             long initialTime = System.currentTimeMillis();
+                             while (System.currentTimeMillis() - initialTime < wait &&
_inProgress.get() > 0) {
+                                 s_logger.debug("Waiting for active commands to be completed");
+                                 Thread.sleep(5000l);
+                             }
+                             if (_inProgress.get() == 0) {
+                                 if (s_logger.isDebugEnabled()) {
+                                     s_logger.debug("Preferred host is found to be reachable,
trying to reconnect to: " + preferredHost);
+                                 }
+                                 _shell.resetHostCounter();
+                                 reconnect(_link);
+                             }
+                         }
+                     }
+                     index = (index + 1) % msList.length;
 
 Review comment:
   @nvazquez don't change the preferred host to some other host, it's because we assume the
first in the list is the `preferred` host. For example, consider this use-case when using
the `static` algorithm the first item in the list could be IP of the LB (netscalar/haproxy
etc) and the use of this mechanism is to ensure HA for the mgmt server when this LB is down.
If we change the preferred host, it breaks our use-case.

----------------------------------------------------------------
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:
users@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)

Mime
View raw message