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

Change subject: host-deploy: node-upgrade: apply artificial eof for vdsm-upgrade
......................................................................

host-deploy: node-upgrade: apply artificial eof for vdsm-upgrade

apply artificial end-of-file

there is no way in java to use non blocking
InputStream.

there is no way to interrupt the blocking.

and we cannot terminate thread as the connection
pool will get messy.

so we should detect eof based on data.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1080594
Change-Id: I093357933d2f10c0d90864f53977b832a58dafbd
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/26122/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
index e6b4d2d..4b05c34 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
@@ -28,6 +28,7 @@
 
     private static final int BUFFER_SIZE = 10 * 1024;
     private static final int THREAD_JOIN_TIMEOUT = 20 * 1000;
+    private static final String ARTIFICIAL_EOF = "component='RHEV_INSTALL'";
 
     private static final Log log = LogFactory.getLog(OVirtNodeUpgrade.class);
 
@@ -52,12 +53,29 @@
         boolean error = false;
         try {
             String line;
+            boolean eof = false;
             while (
+                !eof &&
                 _incoming != null &&
                 (line = _incoming.readLine()) != null
             ) {
                 log.infoFormat("update from host {0}: {1}", 
_vds.getHostName(), line);
                 error = _messages.postOldXmlFormat(line) || error;
+
+                /*
+                 * apply artificial end-of-file
+                 *
+                 * there is no way in java to use non blocking
+                 * InputStream.
+                 *
+                 * there is no way to interrupt the blocking.
+                 *
+                 * and we cannot terminate thread as the connection
+                 * pool will get messy.
+                 *
+                 * so we should detect eof based on data.
+                 */
+                eof = line.contains(ARTIFICIAL_EOF);
             }
 
             if (error) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I093357933d2f10c0d90864f53977b832a58dafbd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to