cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GabrielBrascher <>
Subject [GitHub] cloudstack pull request: Cloudstack 8611 Handle SSH if server "for...
Date Fri, 01 Apr 2016 07:38:16 GMT
GitHub user GabrielBrascher opened a pull request:

    Cloudstack 8611 Handle SSH if server "forget" to send exit status

    <h5> Continuing the work started by @likitha, I cherry-picked the 
    commit (b9181c689e0e7b5f1e28c81d73710196dfabd0ba) from PR <>.
    I made some changes from the cherry-picked commit adding @wilderrodrigues suggestions
(create simple methods that could be reused and make unit tests feasible).
    Also, tried to simplify the logic by assuming that ....
        if ((conditions & ChannelCondition.EXIT_STATUS) != 0) {
                if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA))
== 0) {
    ... is the same as `((conditions & ChannelCondition.EXIT_STATUS) != 0) &&
((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0)`.
This expression has the following results according to each possible condition.
    TIMEOUT  | 0000001|false 
    CLOSED  | 0000010 |false 
    STDERR_DATA | 0000100 | false 
    STDERR_DATA | 0001000 | false
    EOF         | 0010000 | false 
    EXIT_STATUS | 0100000 | **true**
    EXIT_SIGNAL | 1000000 | false 
    Testing all the possibilities, it is possible to note that the condition of (newConditions
& ChannelCondition.EXIT_STATUS) != 0)`` is sufficient; thus the simplified "if" conditional
can be:
    `if ((conditions & ChannelCondition.EXIT_STATUS) != 0) {
    This proposed work can be explained by quoting @likitha:
    >CheckS2SVpnConnectionsCommand execution involves executing a script (
in the virtual router. Once CS has opened a session to a virtual router and executed a script
in the router, it waits indefinitely till the session either times out or the exit status
of the remote process is available. But it is possible that an EOF is reached by the process
in the router and the router never set the exit status.
    >References -
    >1. Some servers never send the exit status, or occasionally "forget" to do so (
    >2. Get the exit code/status from the remote command - if available. Be careful - not
all server implementations return this value - (

You can merge this pull request into a Git repository by running:

    $ git pull CLOUDSTACK-8611

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1459
commit 1409f981f298bfe60a1791222ca0e62276659cad
Author: Likitha Shetty <>
Date:   2015-05-01T11:14:51Z

    CLOUDSTACK-8611. CS waits indefinitely for CheckS2SVpnConnectionsCommand to return.
    While remote executing commands through ssh, handle channel condition of EOF because we
wait for the the condition.

commit 96d76d41ab38ab5459e3b3c685633fb8f41cf609
Author: gabrascher <>
Date:   2016-04-01T06:21:16Z

    Handle SSH if server "forget" to send exit status.
    Cherry-picked the work started by
    commit (b9181c689e0e7b5f1e28c81d73710196dfabd0ba) from PR
    CS waits indefinitely for CheckS2SVpnConnectionsComm and to return.
    While remote executing commands through ssh, handle channel condition of
    EOF because we wait for the the condition.


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message