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 04 of 11] CA-35165: Silence failure when no Pool record

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 04 of 11] CA-35165: Silence failure when no Pool record exists i.e. during initial xapi startup
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 30 Nov 2009 15:40:56 +0000
Delivery-date: Mon, 30 Nov 2009 07:41:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1259595652@xxxxxxxxxxxxxxxxxxxx>
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
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1259595423 0
# Node ID 968a9c3b6d3cabb434a4d6252c1caabe0edb78e8
# Parent  b9e5b4439b52ca8dabd7214397fc484441767b4e
CA-35165: Silence failure when no Pool record exists i.e. during initial xapi 
startup.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r b9e5b4439b52 -r 968a9c3b6d3c ocaml/xapi/xapi_event.ml
--- a/ocaml/xapi/xapi_event.ml  Mon Nov 30 15:37:02 2009 +0000
+++ b/ocaml/xapi/xapi_event.ml  Mon Nov 30 15:37:03 2009 +0000
@@ -280,12 +280,15 @@
   try
     Db_lock.with_lock 
       (fun () ->
-        (* We must hold the database lock since we are sending an update for a 
real object
-           and we don't want to accidentally transmit an older snapshot. *)
-        let pool = Helpers.get_pool ~__context in
-        let pool_r = Db.Pool.get_record ~__context ~self:pool in
-        let pool_xml = API.To.pool_t pool_r in
-        event_add ~snapshot:pool_xml "pool" "mod" (Ref.string_of pool)
+                  (* We must hold the database lock since we are sending an 
update for a real object
+                         and we don't want to accidentally transmit an older 
snapshot. *)
+                  let pool = try Some (Helpers.get_pool ~__context) with _ -> 
None in
+                  match pool with
+                  | Some pool ->
+                                let pool_r = Db.Pool.get_record ~__context 
~self:pool in
+                                let pool_xml = API.To.pool_t pool_r in
+                                event_add ~snapshot:pool_xml "pool" "mod" 
(Ref.string_of pool)
+                  | None -> () (* no pool object created during initial boot *)
       )
   with e ->
     error "Caught exception sending event heartbeat: %s" 
(ExnHelper.string_of_exn e)
1 file changed, 9 insertions(+), 6 deletions(-)
ocaml/xapi/xapi_event.ml |   15 +++++++++------


Attachment: xen-api.hg-11.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>