Skip to content

Commit 8ce6eba

Browse files
author
Likitha Shetty
committed
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.
1 parent 134a868 commit 8ce6eba

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
170170
private int _directAgentThreadCap;
171171

172172
protected StateMachine2<Status, Status.Event, Host> _statusStateMachine = Status.getStateMachine();
173-
private final Map<Long, Long> _pingMap = new ConcurrentHashMap<Long, Long>(10007);
173+
private final ConcurrentHashMap<Long, Long> _pingMap = new ConcurrentHashMap<Long, Long>(10007);
174174

175175
@Inject
176176
ResourceManager _resourceMgr;
@@ -1469,7 +1469,10 @@ public Long getAgentPingTime(long agentId) {
14691469
}
14701470

14711471
public void pingBy(long agentId) {
1472-
_pingMap.put(agentId, InaccurateClock.getTimeInSeconds());
1472+
// Update PingMap with the latest time if agent entry exists in the PingMap
1473+
if (_pingMap.replace(agentId, InaccurateClock.getTimeInSeconds()) == null) {
1474+
s_logger.info("PingMap for agent: " + agentId + " will not be updated because agent is no longer in the PingMap");
1475+
}
14731476
}
14741477

14751478
protected class MonitorTask extends ManagedContextRunnable {

0 commit comments

Comments
 (0)