Skip to content

Commit 54ebbe5

Browse files
Likitha ShettyDaanHoogland
authored andcommitted
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. (cherry picked from commit 8ce6eba) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> (cherry picked from commit 59ce639)
1 parent 5b549fd commit 54ebbe5

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
@@ -168,7 +168,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
168168
private int _directAgentThreadCap;
169169

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

173173
@Inject
174174
ResourceManager _resourceMgr;
@@ -1468,7 +1468,10 @@ public Long getAgentPingTime(long agentId) {
14681468
}
14691469

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

14741477
protected class MonitorTask extends ManagedContextRunnable {

0 commit comments

Comments
 (0)