use of com.cloud.legacymodel.communication.command.CheckHealthCommand in project cosmic by MissionCriticalCloud.
the class AgentManagerImpl method investigate.
protected HostStatus investigate(final AgentAttache agent) {
final Long hostId = agent.getId();
final HostVO host = this._hostDao.findById(hostId);
if (host != null && host.getType() != null && !host.getType().isVirtual()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("checking if agent (" + hostId + ") is alive");
}
final Answer answer = easySend(hostId, new CheckHealthCommand());
if (answer != null && answer.getResult()) {
final HostStatus status = HostStatus.Up;
if (s_logger.isDebugEnabled()) {
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
}
return status;
}
return this._haMgr.investigate(hostId);
}
return HostStatus.Alert;
}
use of com.cloud.legacymodel.communication.command.CheckHealthCommand in project cosmic by MissionCriticalCloud.
the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenClusterIsNotStable.
@Test
public void tetsExecuteWhenClusterIsNotStable() throws Exception {
when(niciraApi.getControlClusterStatus()).thenReturn(new ControlClusterStatus());
final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
assertThat(answer.getResult(), equalTo(false));
}
use of com.cloud.legacymodel.communication.command.CheckHealthCommand in project cosmic by MissionCriticalCloud.
the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenClusterIsStable.
@Test
public void tetsExecuteWhenClusterIsStable() throws Exception {
final ControlClusterStatus statusValue = mock(ControlClusterStatus.class);
when(statusValue.getClusterStatus()).thenReturn("stable");
when(niciraApi.getControlClusterStatus()).thenReturn(statusValue);
final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
assertThat(answer.getResult(), equalTo(true));
}
use of com.cloud.legacymodel.communication.command.CheckHealthCommand in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResourceTest method testCheckHealthCommand.
@Test
public void testCheckHealthCommand() {
final CheckHealthCommand command = new CheckHealthCommand();
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, this.libvirtComputingResource);
assertTrue(answer.getResult());
}
use of com.cloud.legacymodel.communication.command.CheckHealthCommand in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testCheckHealthCommand.
@Test
public void testCheckHealthCommand() {
final CheckHealthCommand checkHealthCommand = new CheckHealthCommand();
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(checkHealthCommand, this.citrixResourceBase);
assertFalse(answer.getResult());
}
Aggregations