Repository: cloudstack Updated Branches: refs/heads/4.4-forward 45f0c7367 -> 2ec7359b4
CLOUDSTACK-6662 CLOUDSTACK-6844 exit status delivery might get delayed Please enter the commit message for your changes. Lines starting Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2ec7359b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2ec7359b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2ec7359b Branch: refs/heads/4.4-forward Commit: 2ec7359b4eb501b0d9e80ed87af7a54938e9d505 Parents: 45f0c73 Author: Anthony Xu <[email protected]> Authored: Wed Jun 18 15:05:24 2014 -0700 Committer: Anthony Xu <[email protected]> Committed: Wed Jun 18 15:05:24 2014 -0700 ---------------------------------------------------------------------- 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/2ec7359b/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());
