public PingTestCommand(String routerIp, String privateIp) { _routerIp = routerIp; _privateIp = privateIp; setWait(20); }
@Override public Answer execute(final PingTestCommand command, final LibvirtComputingResource libvirtComputingResource) { String result = null; final String computingHostIp = command.getComputingHostIp(); // TODO, split the command into 2 types if (computingHostIp != null) { result = doPingTest(libvirtComputingResource, computingHostIp); } else if (command.getRouterIp() != null && command.getPrivateIp() != null) { result = doPingTest(libvirtComputingResource, command.getRouterIp(), command.getPrivateIp()); } else { return new Answer(command, false, "routerip and private ip is null"); } if (result != null) { return new Answer(command, false, result); } return new Answer(command); }
protected Answer execute(final PingTestCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource PingTestCommand: " + s_gson.toJson(cmd)); } final String controlIp = cmd.getRouterIp(); final String args = " -c 1 -n -q " + cmd.getPrivateIp(); try { final Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/bin/ping" + args); if (result.first()) { return new Answer(cmd); } } catch (final Exception e) { s_logger.error("Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + e.getMessage()); } return new Answer(cmd, false, "PingTestCommand failed"); }
protected Answer execute(PingTestCommand cmd) { try { if (cmd.getComputingHostIp() != null) { OvmHost.pingAnotherHost(_conn, cmd.getComputingHostIp()); } else { return new Answer(cmd, false, "why asks me to ping router???"); } return new Answer(cmd, true, "success"); } catch (Exception e) { s_logger.debug("Ping " + cmd.getComputingHostIp() + " failed", e); return new Answer(cmd, false, e.getMessage()); } }
protected Status testIpAddress(Long hostId, String testHostIp) { try { Answer pingTestAnswer = _agentMgr.send(hostId, new PingTestCommand(testHostIp)); if (pingTestAnswer == null) { if (s_logger.isDebugEnabled()) {
@Override public Answer execute(final PingTestCommand command, final CitrixResourceBase citrixResourceBase) { final Connection conn = citrixResourceBase.getConnection(); boolean result = false; final String computingHostIp = command.getComputingHostIp(); if (computingHostIp != null) { result = citrixResourceBase.doPingTest(conn, computingHostIp); } else { result = citrixResourceBase.doPingTest(conn, command.getRouterIp(), command.getPrivateIp()); } if (!result) { return new Answer(command, false, "PingTestCommand failed"); } return new Answer(command); } }
public Answer execute(PingTestCommand cmd) { try { if (cmd.getComputingHostIp() != null) { CloudstackPlugin cSp = new CloudstackPlugin(c); if (!cSp.ping(cmd.getComputingHostIp())) { return new Answer(cmd, false, "ping failed"); } } else { return new Answer(cmd, false, "why asks me to ping a router???"); } return new Answer(cmd, true, "success"); } catch (Ovm3ResourceException e) { LOGGER.debug("Ping " + cmd.getComputingHostIp() + " failed", e); return new Answer(cmd, false, e.getMessage()); } }
Answer pingTestAnswer = _agentMgr.easySend(hostId, new PingTestCommand(routerPrivateIp, privateIp)); if (pingTestAnswer != null && pingTestAnswer.getResult()) { if (s_logger.isDebugEnabled()) {
public PingTestCommand(String computingHostIp) { _computingHostIp = computingHostIp; setWait(20); }