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.
This commit is contained in:
Likitha Shetty 2014-08-25 12:59:40 +05:30
parent 134a868013
commit 8ce6eba549

View File

@ -170,7 +170,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
private int _directAgentThreadCap; private int _directAgentThreadCap;
protected StateMachine2<Status, Status.Event, Host> _statusStateMachine = Status.getStateMachine(); 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 @Inject
ResourceManager _resourceMgr; ResourceManager _resourceMgr;
@ -1469,7 +1469,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
} }
public void pingBy(long agentId) { 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 { protected class MonitorTask extends ManagedContextRunnable {