commit c761acc7d1e534e8cc33dbf54cff18f9ad404586
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Nov 14 17:51:26 2014 +0100
NetTestResultSerializer: extend xml generation
This patch updates the result xml format by adding information about the
match number of the recipe and the associated pool match that was used.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestResultSerializer.py | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/NetTestResultSerializer.py
b/lnst/Controller/NetTestResultSerializer.py
index 622ba04..bf3da1e 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -204,9 +204,35 @@ class NetTestResultSerializer:
recipe_el = doc.createElement("recipe")
recipe_el.setAttribute("name", recipe["name"])
recipe_el.setAttribute("result", recipe["result"])
+ recipe_el.setAttribute("match_num",
str(recipe["match_num"]))
top_el.appendChild(recipe_el)
+ match = recipe["pool_match"]
+ if match != {}:
+ match_el = doc.createElement("pool_match")
+
+ if "virtual" in match and match["virtual"]:
+ match_el.setAttribute("virtual", "true")
+ else:
+ match_el.setAttribute("virtual", "false")
+
+ for m_id, m in match["machines"].iteritems():
+ m_el = doc.createElement("m_match")
+ m_el.setAttribute("host_id", str(m_id))
+ m_el.setAttribute("pool_id", str(m["target"]))
+
+ for if_id, pool_id in m["interfaces"].iteritems():
+ if_el = doc.createElement("if_match")
+ if_el.setAttribute("if_id", str(if_id))
+ if_el.setAttribute("pool_if_id", str(pool_id))
+ m_el.appendChild(if_el)
+
+ match_el.appendChild(m_el)
+
+
+ recipe_el.appendChild(match_el)
+
if recipe["result"] == "FAIL" and \
"err_msg" in recipe and recipe["err_msg"] !=
"":
err_el = doc.createElement("error_message")
Show replies by thread