bug 9855: two fixes.

1. can not cancel maintenace mode.
2. maintenance related modes are preserved through MS restart

status 9855: resolved fixed
This commit is contained in:
anthony 2011-06-27 13:41:50 -07:00
parent e716245218
commit 468136be74
3 changed files with 16 additions and 12 deletions

View File

@ -993,7 +993,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
}
final Status currentState = host.getStatus();
if (currentState == Status.Down || currentState == Status.Alert || currentState == Status.Removed || currentState == Status.PrepareForMaintenance) {
if (currentState == Status.Down || currentState == Status.Alert || currentState == Status.Removed) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Host " + hostId + " is already " + currentState.toString());
}

View File

@ -72,12 +72,6 @@ public class AgentMonitor extends Thread implements Listener {
public void run() {
s_logger.info("Agent Monitor is started.");
// _agentMgr.startDirectlyConnectedHosts();
try {
Thread.sleep(_pingTimeout * 2000);
} catch (InterruptedException e) {
s_logger.info("Woke me up so early!");
}
while (!_stop) {
try {
// check every 60 seconds

View File

@ -137,7 +137,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
MsStatusSearch = createSearchBuilder();
MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
MsStatusSearch.and("statuses", MsStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
MsStatusSearch.and("statuses", MsStatusSearch.entity().getStatus(), SearchCriteria.Op.NIN);
MsStatusSearch.done();
TypeDcSearch = createSearchBuilder();
@ -224,6 +224,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
UnmanagedDirectConnectSearch.and("resource", UnmanagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
UnmanagedDirectConnectSearch.and("statuses", UnmanagedDirectConnectSearch.entity().getStatus(), SearchCriteria.Op.NIN);
/*
* UnmanagedDirectConnectSearch.op(SearchCriteria.Op.OR, "managementServerId",
* UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
@ -367,24 +368,33 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
public List<HostVO> findDirectAgentToLoad(long lastPingSecondsAfter, Long limit) {
SearchCriteria<HostVO> sc = UnmanagedDirectConnectSearch.create();
sc.setParameters("lastPinged", lastPingSecondsAfter);
sc.setParameters("statuses", Status.ErrorInMaintenance, Status.Maintenance, Status.PrepareForMaintenance);
return search(sc, new Filter(HostVO.class, "clusterId", true, 0L, limit));
}
@Override
public void markHostsAsDisconnected(long msId) {
SearchCriteria<HostVO> sc = MsStatusSearch.create();
sc.setParameters("ms", msId);
sc.setParameters("ms", msId);
sc.setParameters("statuses", Status.ErrorInMaintenance, Status.Maintenance, Status.PrepareForMaintenance);
HostVO host = createForUpdate();
host.setManagementServerId(null);
host.setLastPinged((System.currentTimeMillis() >> 10) - (10 * 60));
host.setDisconnectedOn(new Date());
UpdateBuilder ub = getUpdateBuilder(host);
ub.set(host, "status", Status.Disconnected);
update(ub, sc, null);
sc = MsStatusSearch.create();
sc.setParameters("ms", msId);
host = createForUpdate();
host.setManagementServerId(null);
host.setLastPinged((System.currentTimeMillis() >> 10) - (10 * 60));
host.setDisconnectedOn(new Date());
ub = getUpdateBuilder(host);
update(ub, sc, null);
}
@Override