cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [42/50] [abbrv] git commit: updated refs/heads/affinity_groups to ca1a794
Date Fri, 05 Apr 2013 21:03:37 GMT
Fix for _pingTimeout being 0 in AgentMonitor

With commit d79f1f6fdc8307aa4038bfb2c7607904b89eedbe the AgentMonitor
was replaced with a pluggable service. However the ping timeout in the
original constructor was not passed on anymore, leading to a default
pingTimout of 0. This would fail all agents constantly.

Modified the startMonitor command to take a pingtimeout as an argument
and instruct AgentManagerImpl to pass it along.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f1259d50
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f1259d50
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f1259d50

Branch: refs/heads/affinity_groups
Commit: f1259d50bdd6120174717f4cce6a45dc12b6645b
Parents: dbf4cb7
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Thu Apr 4 14:23:42 2013 +0200
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Thu Apr 4 14:23:42 2013 +0200

----------------------------------------------------------------------
 .../com/cloud/agent/manager/AgentManagerImpl.java  |    2 +-
 .../src/com/cloud/agent/manager/AgentMonitor.java  |   35 +++------------
 .../cloud/agent/manager/AgentMonitorService.java   |    2 +-
 3 files changed, 9 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1259d50/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index c1bbb58..6baeecf 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -668,7 +668,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager,
Handl
     public boolean start() {
         startDirectlyConnectedHosts();
         if (_monitor != null) {
-            _monitor.startMonitoring();
+            _monitor.startMonitoring(_pingTimeout);
         }
         if (_connection != null) {
             _connection.start();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1259d50/server/src/com/cloud/agent/manager/AgentMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentMonitor.java b/server/src/com/cloud/agent/manager/AgentMonitor.java
index ae539fd..f3f6669 100755
--- a/server/src/com/cloud/agent/manager/AgentMonitor.java
+++ b/server/src/com/cloud/agent/manager/AgentMonitor.java
@@ -35,6 +35,7 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.alert.AlertManager;
+import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
 import com.cloud.dc.dao.ClusterDao;
@@ -60,7 +61,7 @@ import com.cloud.vm.dao.VMInstanceDao;
 public class AgentMonitor extends Thread implements AgentMonitorService {
     private static Logger s_logger = Logger.getLogger(AgentMonitor.class);
     private static Logger status_Logger = Logger.getLogger(Status.class);
-    private long _pingTimeout;
+    private long _pingTimeout = 120; // Default set to 120 seconds
     @Inject private HostDao _hostDao;
     private boolean _stop;
     @Inject private AgentManager _agentMgr;
@@ -69,40 +70,16 @@ public class AgentMonitor extends Thread implements AgentMonitorService
{
     @Inject private HostPodDao _podDao = null;
     @Inject private AlertManager _alertMgr;
     private long _msId;
-    private ConnectionConcierge _concierge;
     @Inject ClusterDao _clusterDao;
     @Inject ResourceManager _resourceMgr;
-
+        
     // private ConnectionConcierge _concierge;
     private Map<Long, Long> _pingMap;
 
     public AgentMonitor() {
         _pingMap = new ConcurrentHashMap<Long, Long>(10007);
     }
-
-    public AgentMonitor(long msId, HostDao hostDao, VMInstanceDao vmDao, DataCenterDao dcDao,
HostPodDao podDao, AgentManagerImpl agentMgr, AlertManager alertMgr, long pingTimeout) {
-        super("AgentMonitor");
-        _msId = msId;
-        _pingTimeout = pingTimeout;
-        _hostDao = hostDao;
-        _agentMgr = agentMgr;
-        _stop = false;
-        _vmDao = vmDao;
-        _dcDao = dcDao;
-        _podDao = podDao;
-        _alertMgr = alertMgr;
-        _pingMap = new ConcurrentHashMap<Long, Long>(10007);
-        // try {
-        // Connection conn = Transaction.getStandaloneConnectionWithException();
-        // conn.setAutoCommit(true);
-        // conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
-        // _concierge = new ConnectionConcierge("AgentMonitor", conn, true);
-        // } catch (SQLException e) {
-        // throw new CloudRuntimeException("Unable to get a db connection", e);
-        // }
-
-    }
-
+    
     /**
      * Check if the agent is behind on ping
      *
@@ -297,7 +274,9 @@ public class AgentMonitor extends Thread implements AgentMonitorService
{
         return -1;
     }
 
-    public void startMonitoring() {
+    @Override
+    public void startMonitoring(long pingTimeout) {
+        _pingTimeout = pingTimeout;
     	start();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1259d50/server/src/com/cloud/agent/manager/AgentMonitorService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentMonitorService.java b/server/src/com/cloud/agent/manager/AgentMonitorService.java
index cdb0c1e..5759e5f 100644
--- a/server/src/com/cloud/agent/manager/AgentMonitorService.java
+++ b/server/src/com/cloud/agent/manager/AgentMonitorService.java
@@ -24,5 +24,5 @@ public interface AgentMonitorService extends Listener {
     public Long getAgentPingTime(long agentId);
     public void pingBy(long agentId);
     public void signalStop();
-    public void startMonitoring();
+    public void startMonitoring(long pingTimeout);
 }


Mime
View raw message