WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] CA-46108: vmpp message must contain body and data

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] CA-46108: vmpp message must contain body and data
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Fri, 24 Sep 2010 16:18:44 +0100
Delivery-date: Fri, 24 Sep 2010 08:24:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
 ocaml/xapi/xapi_vmpp.ml |  8 ++++----
 scripts/mail-alarm      |  6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1285341480 -3600
# Node ID 377a8710491fa9b66f159fc6a6faf527cd272d5e
# Parent  1e76d839159a258dec264d0469963df0036a9715
CA-46108: vmpp message must contain body and data

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r 1e76d839159a -r 377a8710491f ocaml/xapi/xapi_vmpp.ml
--- a/ocaml/xapi/xapi_vmpp.ml
+++ b/ocaml/xapi/xapi_vmpp.ml
@@ -59,9 +59,9 @@
 
 let create_alert ~__context ~vmpp ~name ~priority ~body ~data =
   assert_licensed ~__context;
-  let value =
-    (*"<message><email>"^body^"</email><data>"^data^"</data></message>"*)
-    data
+  let value = data in
+  let msg = 
+    "<message><email>"^body^"</email><data>"^value^"</data></message>"
   in
   let successful = priority < 5L in
   if successful
@@ -72,7 +72,7 @@
     add_to_recent_alerts ~__context ~vmpp ~value;
     let cls = `VMPP in
     let obj_uuid = Db.VMPP.get_uuid ~__context ~self:vmpp in
-    Xapi_message.create ~__context ~name ~priority ~cls ~obj_uuid ~body;
+    Xapi_message.create ~__context ~name ~priority ~cls ~obj_uuid ~body:msg;
     ()
   )
 
diff -r 1e76d839159a -r 377a8710491f scripts/mail-alarm
--- a/scripts/mail-alarm
+++ b/scripts/mail-alarm
@@ -297,11 +297,15 @@
 
     def generate_body(self):
         msg = self.msg
+        msg_body = unescape(msg.body)
         try:
+            xmldoc = minidom.parseString(msg_body)
+            body_message = xmldoc.getElementsByTagName('message')[0]
+            email_message = 
body_message.getElementsByTagName('email')[0].firstChild.data
             return \
             
"Field\t\tValue\n-----\t\t-----\nName:\t\t%s\nPriority:\t%s\nClass:\t\t%s\n" \
             "Object UUID:\t%s\nTimestamp:\t%s\nMessage UUID:\t%s\nPool 
name:\t%s\nBody:\t\t%s\n" % \
-            
(msg.name,msg.priority,msg.cls,msg.obj_uuid,msg.timestamp,msg.uuid,msg.pool_name,msg.body)
+            
(msg.name,msg.priority,msg.cls,msg.obj_uuid,msg.timestamp,msg.uuid,msg.pool_name,email_message)
         except:
             log_err("Badly formatted XML, or missing field")
             sys.exit(1)

Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-46108: vmpp message must contain body and data, Marcus Granado <=