Skip to content

Commit 450db8c

Browse files
committed
Merge pull request #1291 from remibergsma/bump-ssh-timeout
CLOUDSTACK-9202 Bump ssh timeout for VR commandsIt 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. Error seen: ``` 2015-12-28 14:35:18,201 ERROR [c.c.n.r.VirtualNetworkApplianceManagerImpl] (Work-Job-Executor-1:ctx-34ff7f80 job-39723/job-39726 ctx-d63de41b) Timed out in waiting SSH execution result 2015-12-28 14:35:18,201 WARN [c.c.n.r.VirtualNetworkApplianceManagerImpl] (Work-Job-Executor-1:ctx-34ff7f80 job-39723/job-39726 ctx-d63de41b) Command: com.cloud.agent.api.Command failed while starting virtua l router 2015-12-28 14:35:18,201 INFO [c.c.v.VirtualMachineManagerImpl] (Work-Job-Executor-1:ctx-34ff7f80 job-39723/job-39726 ctx-d63de41b) The guru did not like the answers so stopping VM[DomainRouter|r-1534-VM] .Answer":{"result":true,"wait":0}},{"com.cloud.agent.api.Answer":{"result":false,"details":"Timed out in waiting SSH execution result","wait":0}}] } ``` * pr/1291: CLOUDSTACK-9202 Bump ssh timeout Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents 66a933a + 1c5e899 commit 450db8c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

utils/src/main/java/com/cloud/utils/ssh/SSHCmdHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
public class SSHCmdHelper {
3131
private static final Logger s_logger = Logger.getLogger(SSHCmdHelper.class);
32+
private static final int DEFAULT_CONNECT_TIMEOUT = 180000;
33+
private static final int DEFAULT_KEX_TIMEOUT = 60000;
3234

3335
public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, String username, String password) {
3436
return acquireAuthorizedConnection(ip, 22, username, password);
@@ -37,7 +39,7 @@ public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip,
3739
public static com.trilead.ssh2.Connection acquireAuthorizedConnection(String ip, int port, String username, String password) {
3840
com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(ip, port);
3941
try {
40-
sshConnection.connect(null, 60000, 60000);
42+
sshConnection.connect(null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_KEX_TIMEOUT);
4143
if (!sshConnection.authenticateWithPassword(username, password)) {
4244
String[] methods = sshConnection.getRemainingAuthMethods(username);
4345
StringBuffer mStr = new StringBuffer();

utils/src/main/java/com/cloud/utils/ssh/SshHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
import com.cloud.utils.Pair;
3030

3131
public class SshHelper {
32-
private static final int DEFAULT_CONNECT_TIMEOUT = 60000;
32+
private static final int DEFAULT_CONNECT_TIMEOUT = 180000;
3333
private static final int DEFAULT_KEX_TIMEOUT = 60000;
3434

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

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

39-
return sshExecute(host, port, user, pemKeyFile, password, command, 60000, 60000, 120000);
39+
return sshExecute(host, port, user, pemKeyFile, password, command, DEFAULT_CONNECT_TIMEOUT, DEFAULT_KEX_TIMEOUT, 120000);
4040
}
4141

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

0 commit comments

Comments
 (0)