|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-api
[Xen-API] [PATCH 09 of 11] CA-35165: Avoid generating scary-looking	exce
 
# 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 ++++++++++++--------
 
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>
 |  
- [Xen-API] [PATCH 00 of 11] Reduce xapi logspam (a bit), David Scott
- [Xen-API] [PATCH 02 of 11] CA-35165: Remove misleading log message	from sm_exec, David Scott
 
- [Xen-API] [PATCH 01 of 11] CA-35165: Clean up xapi startup log	messages, particularly those to do with the 'localdb', David Scott
 
- [Xen-API] [PATCH 05 of 11] CA-35165: Remove a spurious excxeption	when refreshing VM_guest_metrics when the VM_guest_metrics doesn't	exist (ie for dom0), David Scott
 
- [Xen-API] [PATCH 03 of 11] CA-35165: Trim a xapi startup message, David Scott
 
- [Xen-API] [PATCH 07 of 11] CA-35165: Remove some pointless and	frequent logging, David Scott
 
- [Xen-API] [PATCH 08 of 11] CA-35165: Remove some more verbose,	pointless and frequent logging, David Scott
 
- [Xen-API] [PATCH 06 of 11] CA-35165: Mute the error when looking	for SM backends in directories which don't exist, David Scott
 
- [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,
David Scott <=
 
- [Xen-API] [PATCH 04 of 11] CA-35165: Silence failure when no Pool	record exists i.e. during initial xapi startup, David Scott
 
- [Xen-API] [PATCH 11 of 11] CA-35165: Reduce the amount of log spam	created by the xenstore watching code, David Scott
 
- [Xen-API] [PATCH 10 of 11] CA-35165: Remove spammy 'check_rbac=%b'	debug print, David Scott
 
 
 
 
 |  
  
 | 
    | 
  
  
    |   | 
    |