Fix searchcritera2 in agent monitor

get ha code back in agent manager
This commit is contained in:
frank 2011-12-08 16:17:51 -08:00
parent ef02c05c8c
commit 5d661c1e9d
2 changed files with 5 additions and 6 deletions

View File

@ -925,12 +925,11 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
}
handleDisconnectWithoutInvestigation(attache, event);
/*TODO: call HA manager in monitors
* host = _hostDao.findById(host.getId());
if (!event.equals(Event.PrepareUnmanaged) && !event.equals(Event.HypervisorVersionChanged) && (host.getStatus() == Status.Alert || host.getStatus() == Status.Down)) {
_haMgr.scheduleRestartForVmsOnHost(host, investigate);
host = _hostDao.findById(host.getId());
if (host.getStatus() == Status.Alert || host.getStatus() == Status.Down) {
_haMgr.scheduleRestartForVmsOnHost(host, true);
}
* */
return true;
}

View File

@ -144,7 +144,7 @@ public class AgentMonitor extends Thread implements Listener {
SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
sc.selectField(sc.getEntity().getResourceState());
sc.addAnd(sc.getEntity().getId(), Op.EQ, agentId);
HostVO h = sc.find();
HostVO h = sc.list().get(0);
ResourceState resourceState = h.getResourceState();
if (resourceState == ResourceState.Disabled || resourceState == ResourceState.Maintenance || resourceState == ResourceState.Unmanaged || resourceState == ResourceState.ErrorInMaintenance) {
/* Host is in non-operation state, so no investigation and direct put agent to Disconnected */