CLOUDSTACK-9202 Bump ssh timeout

It seems the VR needs more time for some of its commands. Until we figured
out the root cause, this allows the VRs to start again.
This commit is contained in:
Remi Bergsma 2015-12-28 15:54:26 +01:00
parent 9be76b350f
commit 1c5e899a2d
2 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,8 @@ import com.trilead.ssh2.Session;
public class SSHCmdHelper { public class SSHCmdHelper {
private static final Logger s_logger = Logger.getLogger(SSHCmdHelper.class); 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) { public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, String username, String password) {
return acquireAuthorizedConnection(ip, 22, username, password); return acquireAuthorizedConnection(ip, 22, username, password);
@ -37,7 +39,7 @@ public class SSHCmdHelper {
public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, int port, String username, String password) { 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); com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(ip, port);
try { try {
sshConnection.connect(null, 60000, 60000); sshConnection.connect(null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_KEX_TIMEOUT);
if (!sshConnection.authenticateWithPassword(username, password)) { if (!sshConnection.authenticateWithPassword(username, password)) {
String[] methods = sshConnection.getRemainingAuthMethods(username); String[] methods = sshConnection.getRemainingAuthMethods(username);
StringBuffer mStr = new StringBuffer(); StringBuffer mStr = new StringBuffer();

View File

@ -29,14 +29,14 @@ import com.trilead.ssh2.ChannelCondition;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
public class SshHelper { 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 int DEFAULT_KEX_TIMEOUT = 60000;
private static final Logger s_logger = Logger.getLogger(SshHelper.class); 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 { 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) public static void scpTo(String host, int port, String user, File pemKeyFile, String password, String remoteTargetDirectory, String localFile, String fileMode)