fix
Revert "treat ping as success if 22 port is open"
This reverts commit
@@ -59,7 +59,6 @@ import org.zstack.tag.TagManager;
import org.zstack.utils.*;
import org.zstack.utils.gson.JSONObjectUtil;
import org.zstack.utils.logging.CLogger;
-import org.zstack.utils.network.NetworkUtils;
import org.zstack.utils.path.PathUtil;
import org.zstack.utils.ssh.Ssh;
import org.zstack.utils.ssh.SshResult;
@@ -2238,13 +2237,6 @@ public class KVMHost extends HostBase implements Host {
@AfterDone
List<Runnable> afterDone = new ArrayList<>();
- private boolean isSshPortOpen() {
- if (CoreGlobalProperty.UNIT_TEST_ON) {
- return false;
- }
- return NetworkUtils.isRemotePortOpen(self.getManagementIp(), getSelf().getPort(), 2);
- }
-
@Override
public void run(FlowTrigger trigger, Map data) {
PingCmd cmd = new PingCmd();
@@ -2252,14 +2244,8 @@ public class KVMHost extends HostBase implements Host {
restf.asyncJsonPost(pingPath, cmd, new JsonAsyncRESTCallback<PingResponse>(trigger) {
@Override
public void fail(ErrorCode err) {
- if (isSshPortOpen()) {
- logger.debug(String.format("ssh port of host[uuid:%s, ip:%s] is open, ping success",
- self.getUuid(), self.getManagementIp()));
- trigger.next();
- } else {
trigger.fail(err);
}
- }
@Override
public void success(PingResponse ret) {
@@ -2278,13 +2264,7 @@ public class KVMHost extends HostBase implements Host {
trigger.next();
} else {
- if (isSshPortOpen()) {
- logger.debug(String.format("ssh port of host[uuid:%s, ip:%s] is open, ping success",
- self.getUuid(), self.getManagementIp()));
- trigger.next();
- } else {
- trigger.fail(operr("operation error, because:%s", ret.getError()));
- }
+ trigger.fail(operr(ret.getError()));
}
}
