Repository: cloudstack Updated Branches: refs/heads/4.4 7703b2fab -> 7fe353d49
CLOUDSTACK-6662 CLOUDSTACK-6844 exit status delivery might get delayed Please enter the commit message for your changes. Lines starting (cherry picked from commit 2ec7359b4eb501b0d9e80ed87af7a54938e9d505) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7fe353d4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7fe353d4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7fe353d4 Branch: refs/heads/4.4 Commit: 7fe353d4995a2b55c7baed5e27056dd2e2f7509f Parents: 7703b2f Author: Anthony Xu <[email protected]> Authored: Wed Jun 18 15:05:24 2014 -0700 Committer: Daan Hoogland <[email protected]> Committed: Wed Jul 16 13:38:15 2014 +0200 ---------------------------------------------------------------------- utils/src/com/cloud/utils/ssh/SSHCmdHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7fe353d4/utils/src/com/cloud/utils/ssh/SSHCmdHelper.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/ssh/SSHCmdHelper.java b/utils/src/com/cloud/utils/ssh/SSHCmdHelper.java index 4a440ef..e35a3ea 100644 --- a/utils/src/com/cloud/utils/ssh/SSHCmdHelper.java +++ b/utils/src/com/cloud/utils/ssh/SSHCmdHelper.java @@ -155,8 +155,15 @@ public class SSHCmdHelper { String result = sbResult.toString(); if (result != null && !result.isEmpty()) s_logger.debug(cmd + " output:" + result); - - return sshSession.getExitStatus(); + // exit status delivery might get delayed + for(int i = 0 ; i<10 ; i++ ) { + Integer status = sshSession.getExitStatus(); + if( status != null ) { + return status; + } + Thread.sleep(100); + } + return -1; } catch (Exception e) { s_logger.debug("Ssh executed failed", e); throw new SshException("Ssh executed failed " + e.getMessage());
