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 09 of 11] CA-35165: Avoid generating scary-looking exce

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 09 of 11] CA-35165: Avoid generating scary-looking exceptions in the startup code: avoid attempting to resynchronise the state of VBDs or VIFs if they are missing (or empty); also silence the setting of the unco-operative flags
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 30 Nov 2009 15:41:01 +0000
Delivery-date: Mon, 30 Nov 2009 07:41:11 -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 1259595426 0
# Node ID 0ce8573e2051c86469d7dbcb9144609229929f29
# Parent  867e4af3bc75bd8d1c28ed2e8eebb36b7116edf0
CA-35165: Avoid generating scary-looking exceptions in the startup code: avoid 
attempting to resynchronise the state of VBDs or VIFs if they are missing (or 
empty); also silence the setting of the unco-operative flags.

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

diff -r 867e4af3bc75 -r 0ce8573e2051 ocaml/xapi/dbsync_slave.ml
--- a/ocaml/xapi/dbsync_slave.ml        Mon Nov 30 15:37:05 2009 +0000
+++ b/ocaml/xapi/dbsync_slave.ml        Mon Nov 30 15:37:06 2009 +0000
@@ -382,14 +382,16 @@
         List.iter
           (fun vbd ->
              try
-               Events.Resync.vbd ~__context token vmref vbd
+                       if Db.is_valid_ref vbd && not (Db.VBD.get_empty 
~__context ~self:vbd)
+                       then Events.Resync.vbd ~__context token vmref vbd
              with e ->
                warn "Caught error resynchronising VBD: %s" 
(ExnHelper.string_of_exn e)) vm_vbds;
         let vm_vifs = vmrec.API.vM_VIFs in
         List.iter 
           (fun vif ->
              try
-               Events.Resync.vif ~__context token vmref vif
+                       if Db.is_valid_ref vif
+                       then Events.Resync.vif ~__context token vmref vif
              with e ->
                warn "Caught error resynchronising VIF: %s" 
(ExnHelper.string_of_exn e)) vm_vifs
       ) () in
diff -r 867e4af3bc75 -r 0ce8573e2051 ocaml/xapi/helpers.ml
--- a/ocaml/xapi/helpers.ml     Mon Nov 30 15:37:05 2009 +0000
+++ b/ocaml/xapi/helpers.ml     Mon Nov 30 15:37:06 2009 +0000
@@ -903,11 +903,15 @@
   List.iter (fun k -> if not (List.mem k valid_keys) then Hashtbl.remove table 
k) keys
 
 let set_vm_uncooperative ~__context ~self ~value = 
-  info "VM %s uncooperative <- %b" (Ref.string_of self) value;
-  begin
-    try
-      Db.VM.remove_from_other_config ~__context ~self ~key:"uncooperative"
-    with _ -> ()
-  end;
-  Db.VM.add_to_other_config ~__context ~self ~key:"uncooperative" 
~value:(string_of_bool value)
-
+  let current_value = 
+       let oc = Db.VM.get_other_config ~__context ~self in
+       List.mem_assoc "uncooperative" oc && (bool_of_string (List.assoc 
"uncooperative" oc)) in
+  if value <> current_value then begin
+       info "VM %s uncooperative <- %b" (Ref.string_of self) value;
+       begin
+      try
+               Db.VM.remove_from_other_config ~__context ~self 
~key:"uncooperative"
+      with _ -> ()
+       end;
+       Db.VM.add_to_other_config ~__context ~self ~key:"uncooperative" 
~value:(string_of_bool value)
+  end
2 files changed, 16 insertions(+), 10 deletions(-)
ocaml/xapi/dbsync_slave.ml |    6 ++++--
ocaml/xapi/helpers.ml      |   20 ++++++++++++--------


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>