Repository: cloudstack Updated Branches: refs/heads/master bc4be5272 -> ce3550f33
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/ce3550f3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ce3550f3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ce3550f3 Branch: refs/heads/master Commit: ce3550f33338bc0bafacae5bdca8de8905bf31cc Parents: bc4be52 Author: Anthony Xu <[email protected]> Authored: Wed Jun 18 15:05:24 2014 -0700 Committer: Anthony Xu <[email protected]> Committed: Wed Jun 18 15:07:50 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/ce3550f3/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());
