Alon Bar-Lev has uploaded a new change for review.

Change subject: host-deploy: flush both stdout, stderr at ssh execute
......................................................................

host-deploy: flush both stdout, stderr at ssh execute

although until unclear why it is needed.

1. flush before java attempt to close using try-with-resources.

2. flush also stderr.

3. perform at one location.

Related-To: https://bugzilla.redhat.com/show_bug.cgi?id=1084911
Change-Id: I14424723f2ef6abff6f3abdc1072e5ac621d4e67
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHClient.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
2 files changed, 10 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/26586/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHClient.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHClient.java
index 143ecfa..7ea9ba2 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHClient.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHClient.java
@@ -541,6 +541,16 @@
                     )
                 );
             }
+
+            // the PipedOutputStream does not
+            // flush streams at close
+            // this leads other side of pipe
+            // to miss last bytes
+            // not sure why it is required as
+            // FilteredOutputStream does flush
+            // on close.
+            out.flush();
+            err.flush();
         }
         catch (RuntimeException e) {
             log.debug("Execute failed", e);
@@ -709,12 +719,6 @@
                 pout,
                 remoteDigest
             );
-
-            // the apache-sshd does not
-            // flush streams nor close them
-            // this leads other side of pipe
-            // to miss last bytes
-            pout.flush();
 
             t.join(THREAD_JOIN_WAIT_TIME);
             if (t.getState() != Thread.State.TERMINATED) {
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
index 633af12..98959f2 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
@@ -320,12 +320,6 @@
                     poutStdout,
                     stderr
                 );
-
-                // the apache-sshd does not
-                // flush streams nor close them
-                // this leads other side of pipe
-                // to miss last bytes
-                poutStdout.flush();
             }
             catch (Exception e) {
                 if (stderr.size() == 0) {


-- 
To view, visit http://gerrit.ovirt.org/26586
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14424723f2ef6abff6f3abdc1072e5ac621d4e67
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to