use of com.cloud.agent.api.CheckOnHostAnswer in project cloudstack by apache.
the class Ovm3HypervisorSupport method execute.
public CheckOnHostAnswer execute(CheckOnHostCommand cmd) {
LOGGER.debug("CheckOnHostCommand");
CloudstackPlugin csp = new CloudstackPlugin(c);
try {
Boolean alive = csp.dom0CheckStorageHealth(config.getAgentScriptsDir(), config.getAgentCheckStorageScript(), cmd.getHost().getGuid(), config.getAgentStorageCheckTimeout());
String msg = "";
if (alive == null) {
msg = "storage check failed for " + cmd.getHost().getGuid();
} else if (alive) {
msg = "storage check ok for " + cmd.getHost().getGuid();
} else {
msg = "storage dead for " + cmd.getHost().getGuid();
}
LOGGER.debug(msg);
return new CheckOnHostAnswer(cmd, alive, msg);
} catch (Ovm3ResourceException e) {
return new CheckOnHostAnswer(cmd, false, "Error while checking storage for " + cmd.getHost().getGuid() + ": " + e.getMessage());
}
}
use of com.cloud.agent.api.CheckOnHostAnswer in project cloudstack by apache.
the class XenServerInvestigator method isAgentAlive.
@Override
public Status isAgentAlive(Host agent) {
if (agent.getHypervisorType() != HypervisorType.XenServer) {
return null;
}
CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
List<HostVO> neighbors = _resourceMgr.listAllHostsInCluster(agent.getClusterId());
for (HostVO neighbor : neighbors) {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != HypervisorType.XenServer) {
continue;
}
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
if (answer != null && answer.getResult()) {
CheckOnHostAnswer ans = (CheckOnHostAnswer) answer;
if (!ans.isDetermined()) {
s_logger.debug("Host " + neighbor + " couldn't determine the status of " + agent);
continue;
}
// even it returns true, that means host is up, but XAPI may not work
return ans.isAlive() ? null : Status.Down;
}
}
return null;
}
use of com.cloud.agent.api.CheckOnHostAnswer in project cosmic by MissionCriticalCloud.
the class XenServerInvestigator method isAgentAlive.
@Override
public Status isAgentAlive(final Host agent) {
if (agent.getHypervisorType() != HypervisorType.XenServer) {
return null;
}
final CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
final List<HostVO> neighbors = _resourceMgr.listAllHostsInCluster(agent.getClusterId());
for (final HostVO neighbor : neighbors) {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != HypervisorType.XenServer) {
continue;
}
final Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
if (answer != null && answer.getResult()) {
final CheckOnHostAnswer ans = (CheckOnHostAnswer) answer;
if (!ans.isDetermined()) {
s_logger.debug("Host " + neighbor + " couldn't determine the status of " + agent);
continue;
}
// even it returns true, that means host is up, but XAPI may not work
return ans.isAlive() ? null : Status.Down;
}
}
return null;
}
Aggregations