use of com.cloud.agent.api.PingRoutingCommand in project cloudstack by apache.
the class VirtualMachineManagerImpl method processCommands.
@Override
public boolean processCommands(final long agentId, final long seq, final Command[] cmds) {
boolean processed = false;
for (final Command cmd : cmds) {
if (cmd instanceof PingRoutingCommand) {
final PingRoutingCommand ping = (PingRoutingCommand) cmd;
if (ping.getHostVmStateReport() != null) {
_syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport());
}
// take the chance to scan VMs that are stuck in transitional states
// and are missing from the report
scanStalledVMInTransitionStateOnUpHost(agentId);
processed = true;
}
}
return processed;
}
use of com.cloud.agent.api.PingRoutingCommand in project cloudstack by apache.
the class VmwareResource method getCurrentStatus.
@Override
public PingCommand getCurrentStatus(long id) {
try {
gcAndKillHungWorkerVMs();
VmwareContext context = getServiceContext();
VmwareHypervisorHost hyperHost = getHyperHost(context);
try {
if (!hyperHost.isHyperHostConnected()) {
return null;
}
} catch (Exception e) {
s_logger.error("Unexpected exception", e);
return null;
}
return new PingRoutingCommand(getType(), id, syncHostVmStates());
} finally {
recycleServiceContext();
}
}
use of com.cloud.agent.api.PingRoutingCommand in project cloudstack by apache.
the class HypervDirectConnectResource method getCurrentStatus.
@Override
public final PingCommand getCurrentStatus(final long id) {
final PingCommand pingCmd = new PingRoutingCommand(getType(), id, getHostVmStateReport());
if (s_logger.isDebugEnabled()) {
s_logger.debug("Ping host " + _name + " (IP " + _agentIp + ")");
}
final Answer pingAns = executeRequest(pingCmd);
if (pingAns == null || !pingAns.getResult()) {
s_logger.info("Cannot ping host " + _name + " (IP " + _agentIp + "), pingAns (blank means null) is:" + pingAns);
return null;
}
return pingCmd;
}
use of com.cloud.agent.api.PingRoutingCommand in project cloudstack by apache.
the class Ovm3HypervisorResource method getCurrentStatus.
@Override
public PingCommand getCurrentStatus(long id) {
try {
/* feels useless somehow */
Common test = new Common(c);
String ping = "put";
String pong = test.echo(ping);
if (pong.contains(ping)) {
hypervisorsupport.syncState();
CloudstackPlugin cSp = new CloudstackPlugin(c);
if (!cSp.dom0CheckStorageHealthCheck(configuration.getAgentScriptsDir(), configuration.getAgentCheckStorageScript(), configuration.getCsHostGuid(), configuration.getAgentStorageCheckTimeout(), configuration.getAgentStorageCheckInterval()) && !cSp.dom0CheckStorageHealthCheck()) {
LOGGER.error("Storage health check not running on " + configuration.getAgentHostname());
} else if (cSp.dom0CheckStorageHealthCheck()) {
LOGGER.error("Storage health check started on " + configuration.getAgentHostname());
} else {
LOGGER.debug("Storage health check running on " + configuration.getAgentHostname());
}
return new PingRoutingCommand(getType(), id, hypervisorsupport.hostVmStateReport());
} else {
LOGGER.debug("Agent did not respond correctly: " + ping + " but got " + pong);
}
} catch (Ovm3ResourceException | NullPointerException e) {
LOGGER.debug("Check agent status failed", e);
return null;
}
return null;
}
Aggregations