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

Change subject: host-deploy: ignore malformed messages received from host
......................................................................

host-deploy: ignore malformed messages received from host

CURRENT STATUS

Legacy vdsm-upgrade reports its status via semi-XML format. Unfortunately
there was a bug in vdsm-upgrade in which the XML that was sent had been
malformed.

As a result the upgrade of the ovirt-node succeeded, but host was marked
as installed failed.

WORKAROUND

After upgrade from ovirt-node with this bug, move host to maintain once and
then activate.

NEW IMPLEMENTATION

Do not fail installation if malformed data is received, issue a warning.

IMPLICATIONS

Upgrade will not fail if a severe error occurred at host side, for
example python exception.

SUGGESTION

Not to apply this patch, but provide a known issues paragraph in
documentation instead.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/15023/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
index f6ec68b..f06a577 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
@@ -88,41 +88,47 @@
 
     private boolean _internalPostOldXmlFormat(String message) {
         boolean error = false;
-        XmlDocument doc = new XmlDocument();
-        doc.LoadXml(message);
-        XmlNode node = doc.ChildNodes[0];
-        if (node != null) {
-            StringBuilder sb = new StringBuilder();
-            // check status
-            Severity severity;
-            if (node.Attributes.get("status") == null) {
-                severity = Severity.WARNING;
-            } else if (node.Attributes.get("status").getValue().equals("OK")) {
-                severity = Severity.INFO;
-            } else if 
(node.Attributes.get("status").getValue().equals("WARN")) {
-                severity = Severity.WARNING;
-            } else {
-                error = true;
-                severity = Severity.ERROR;
-            }
+        try {
+            XmlDocument doc = new XmlDocument();
+            doc.LoadXml(message);
+            XmlNode node = doc.ChildNodes[0];
+            if (node != null) {
+                StringBuilder sb = new StringBuilder();
+                // check status
+                Severity severity;
+                if (node.Attributes.get("status") == null) {
+                    severity = Severity.WARNING;
+                } else if 
(node.Attributes.get("status").getValue().equals("OK")) {
+                    severity = Severity.INFO;
+                } else if 
(node.Attributes.get("status").getValue().equals("WARN")) {
+                    severity = Severity.WARNING;
+                } else {
+                    error = true;
+                    severity = Severity.ERROR;
+                }
 
-            if ((node.Attributes.get("component") != null)
-                    && 
(StringUtils.isNotEmpty(node.Attributes.get("component").getValue()))) {
-                sb.append("Step: " + 
node.Attributes.get("component").getValue());
-            }
+                if ((node.Attributes.get("component") != null)
+                        && 
(StringUtils.isNotEmpty(node.Attributes.get("component").getValue()))) {
+                    sb.append("Step: " + 
node.Attributes.get("component").getValue());
+                }
 
-            if ((node.Attributes.get("message") != null)
-                    && 
(StringUtils.isNotEmpty(node.Attributes.get("message").getValue()))) {
-                sb.append("; ");
-                sb.append("Details: " + 
node.Attributes.get("message").getValue());
-                sb.append(" ");
-            }
+                if ((node.Attributes.get("message") != null)
+                        && 
(StringUtils.isNotEmpty(node.Attributes.get("message").getValue()))) {
+                    sb.append("; ");
+                    sb.append("Details: " + 
node.Attributes.get("message").getValue());
+                    sb.append(" ");
+                }
 
-            if ((node.Attributes.get("result") != null)
-                    && 
(StringUtils.isNotEmpty(node.Attributes.get("result").getValue()))) {
-                sb.append(" (" + node.Attributes.get("result").getValue() + 
")");
+                if ((node.Attributes.get("result") != null)
+                        && 
(StringUtils.isNotEmpty(node.Attributes.get("result").getValue()))) {
+                    sb.append(" (" + node.Attributes.get("result").getValue() 
+ ")");
+                }
+                post(severity, sb.toString());
             }
-            post(severity, sb.toString());
+        }
+        catch(Exception e) {
+            post(Severity.WARNING, "Invalid data reiceved");
+            log.warnFormat("Installation {0}: {1} {2}", _vds.getHostName(), 
"Invalid data", message);
         }
 
         return error;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05262d92dfbb76de75a66a32c83998ad0361c62d
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