Updated Branches:
  refs/heads/4.2 e2b29e3d4 -> b6a13d125

CLOUDSTACK-4911 - [Mixed Hypervisor] VM Status is marked as alive when exit 
status of ping command is not available within command timeout

Currently during ssh execution of remote command, if no response is received 
within timeout, Cloudstack is returning success result.
This is resulting in false positives. Fix is to check if exit status of remote 
command is available or not. If not, return failure result.

Signed-off-by: Sateesh Chodapuneedi <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6a13d12
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6a13d12
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6a13d12

Branch: refs/heads/4.2
Commit: b6a13d125773371813734e87bd39c6030707f97c
Parents: e2b29e3
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Mon Oct 21 16:31:45 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Mon Oct 21 16:31:45 2013 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/ssh/SshHelper.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6a13d12/utils/src/com/cloud/utils/ssh/SshHelper.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/ssh/SshHelper.java 
b/utils/src/com/cloud/utils/ssh/SshHelper.java
index fb81e50..667b3e3 100755
--- a/utils/src/com/cloud/utils/ssh/SshHelper.java
+++ b/utils/src/com/cloud/utils/ssh/SshHelper.java
@@ -185,6 +185,12 @@ public class SshHelper {
             }
             
             String result = sbResult.toString();
+
+            if (sess.getExitStatus() == null) {
+                //Exit status is NOT available. Returning failure result.
+                return new Pair<Boolean, String>(false, result);
+            }
+
             if (sess.getExitStatus() != null && 
sess.getExitStatus().intValue() != 0) {
                 s_logger.error("SSH execution of command " + command + " has 
an error status code in return. result output: " + result);
                 return new Pair<Boolean, String>(false, result);

Reply via email to