Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion utils/src/main/java/com/cloud/utils/ssh/SSHCmdHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

public class SSHCmdHelper {
private static final Logger s_logger = Logger.getLogger(SSHCmdHelper.class);
private static final int DEFAULT_CONNECT_TIMEOUT = 180000;
private static final int DEFAULT_KEX_TIMEOUT = 60000;

public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, String username, String password) {
return acquireAuthorizedConnection(ip, 22, username, password);
Expand All @@ -37,7 +39,7 @@ public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip,
public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, int port, String username, String password) {
com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(ip, port);
try {
sshConnection.connect(null, 60000, 60000);
sshConnection.connect(null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_KEX_TIMEOUT);
if (!sshConnection.authenticateWithPassword(username, password)) {
String[] methods = sshConnection.getRemainingAuthMethods(username);
StringBuffer mStr = new StringBuffer();
Expand Down
4 changes: 2 additions & 2 deletions utils/src/main/java/com/cloud/utils/ssh/SshHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import com.cloud.utils.Pair;

public class SshHelper {
private static final int DEFAULT_CONNECT_TIMEOUT = 60000;
private static final int DEFAULT_CONNECT_TIMEOUT = 180000;
private static final int DEFAULT_KEX_TIMEOUT = 60000;

private static final Logger s_logger = Logger.getLogger(SshHelper.class);

public static Pair<Boolean, String> sshExecute(String host, int port, String user, File pemKeyFile, String password, String command) throws Exception {

return sshExecute(host, port, user, pemKeyFile, password, command, 60000, 60000, 120000);
return sshExecute(host, port, user, pemKeyFile, password, command, DEFAULT_CONNECT_TIMEOUT, DEFAULT_KEX_TIMEOUT, 120000);
}

public static void scpTo(String host, int port, String user, File pemKeyFile, String password, String remoteTargetDirectory, String localFile, String fileMode)
Expand Down