[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [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
# 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 _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |