Repository: cloudstack
Updated Branches:
  refs/heads/master 134a86801 -> 8ce6eba54


CLOUDSTACK-7415. Host remains in Alert after vCenter restart.
Management server PingTask should update PingMap entry for an agent only if it 
is already present in the Management Server's PingMap.


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

Branch: refs/heads/master
Commit: 8ce6eba549bcd3fa007aaf10a29c3a2fef9ffaaa
Parents: 134a868
Author: Likitha Shetty <likitha.she...@citrix.com>
Authored: Mon Aug 25 12:59:40 2014 +0530
Committer: Likitha Shetty <likitha.she...@citrix.com>
Committed: Mon Aug 25 13:24:28 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/agent/manager/AgentManagerImpl.java         | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ce6eba5/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java 
b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
index 847e000..f1f6eb9 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -170,7 +170,7 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     private int _directAgentThreadCap;
 
     protected StateMachine2<Status, Status.Event, Host> _statusStateMachine = 
Status.getStateMachine();
-    private final Map<Long, Long> _pingMap = new ConcurrentHashMap<Long, 
Long>(10007);
+    private final ConcurrentHashMap<Long, Long> _pingMap = new 
ConcurrentHashMap<Long, Long>(10007);
 
     @Inject
     ResourceManager _resourceMgr;
@@ -1469,7 +1469,10 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     }
 
     public void pingBy(long agentId) {
-        _pingMap.put(agentId, InaccurateClock.getTimeInSeconds());
+        // Update PingMap with the latest time if agent entry exists in the 
PingMap
+        if (_pingMap.replace(agentId, InaccurateClock.getTimeInSeconds()) == 
null) {
+            s_logger.info("PingMap for agent: " + agentId + " will not be 
updated because agent is no longer in the PingMap");
+        }
     }
 
     protected class MonitorTask extends ManagedContextRunnable {

Reply via email to