mirror of https://github.com/apache/cloudstack.git
bug 11413: when mark host ad disconnected, set lastping to now - pingtimeout
status 11413: resolved fixed
This commit is contained in:
parent
3cb4ad4934
commit
ae64c56c12
|
|
@ -270,19 +270,19 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
_port = NumbersUtil.parseInt(configs.get("port"), 8250);
|
||||
final int workers = NumbersUtil.parseInt(configs.get("workers"), 5);
|
||||
|
||||
String value = configs.get("ping.interval");
|
||||
String value = configs.get(Config.PingInterval.toString());
|
||||
_pingInterval = NumbersUtil.parseInt(value, 60);
|
||||
|
||||
value = configs.get("wait");
|
||||
value = configs.get(Config.Wait.toString());
|
||||
_wait = NumbersUtil.parseInt(value, 1800);
|
||||
|
||||
value = configs.get("alert.wait");
|
||||
value = configs.get(Config.AlertWait.toString());
|
||||
_alertWait = NumbersUtil.parseInt(value, 1800);
|
||||
|
||||
value = configs.get("update.wait");
|
||||
value = configs.get(Config.UpdateWait.toString());
|
||||
_updateWait = NumbersUtil.parseInt(value, 600);
|
||||
|
||||
value = configs.get("ping.timeout");
|
||||
value = configs.get(Config.PingTimeout.toString());
|
||||
final float multiplier = value != null ? Float.parseFloat(value) : 2.5f;
|
||||
_pingTimeout = (long) (multiplier * _pingInterval);
|
||||
|
||||
|
|
@ -299,8 +299,8 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
_nodeId = ManagementServerNode.getManagementServerId();
|
||||
s_logger.info("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId);
|
||||
|
||||
|
||||
_hostDao.markHostsAsDisconnected(_nodeId);
|
||||
long lastPing = (System.currentTimeMillis() >> 10) - _pingTimeout;
|
||||
_hostDao.markHostsAsDisconnected(_nodeId, lastPing);
|
||||
|
||||
_monitor = ComponentLocator.inject(AgentMonitor.class, _nodeId, _hostDao, _vmDao, _dcDao, _podDao, this, _alertMgr, _pingTimeout);
|
||||
registerForHostEvents(_monitor, true, true, false);
|
||||
|
|
|
|||
|
|
@ -697,7 +697,8 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
|||
public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList, long selfNodeId) {
|
||||
for (ManagementServerHostVO vo : nodeList) {
|
||||
s_logger.info("Marking hosts as disconnected on Management server" + vo.getMsid());
|
||||
_hostDao.markHostsAsDisconnected(vo.getMsid());
|
||||
long lastPing = (System.currentTimeMillis() >> 10) - _pingTimeout;
|
||||
_hostDao.markHostsAsDisconnected(vo.getMsid(), lastPing);
|
||||
s_logger.info("Deleting entries from op_host_transfer table for Management server " + vo.getMsid());
|
||||
cleanupTransferMap(vo.getMsid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public interface HostDao extends GenericDao<HostVO, Long> {
|
|||
*
|
||||
* @param msId management server id.
|
||||
*/
|
||||
void markHostsAsDisconnected(long msId);
|
||||
void markHostsAsDisconnected(long msId, long lastPing);
|
||||
|
||||
List<HostVO> findLostHosts(long timeout);
|
||||
|
||||
|
|
|
|||
|
|
@ -410,13 +410,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
}
|
||||
|
||||
@Override
|
||||
public void markHostsAsDisconnected(long msId) {
|
||||
public void markHostsAsDisconnected(long msId, long lastPing) {
|
||||
SearchCriteria<HostVO> sc = MsStatusSearch.create();
|
||||
sc.setParameters("ms", msId);
|
||||
sc.setParameters("statuses", Status.ErrorInMaintenance, Status.Maintenance, Status.PrepareForMaintenance);
|
||||
|
||||
HostVO host = createForUpdate();
|
||||
host.setLastPinged((System.currentTimeMillis() >> 10) - (10 * 60));
|
||||
host.setLastPinged(lastPing);
|
||||
host.setDisconnectedOn(new Date());
|
||||
UpdateBuilder ub = getUpdateBuilder(host);
|
||||
ub.set(host, "status", Status.Disconnected);
|
||||
|
|
|
|||
Loading…
Reference in New Issue