[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] remove unnecessary log spam



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1271279637 -3600
# Node ID 36c5ecfdb70f3973b99d5d52ed89a828e16cd5a3
# Parent  0dc60977336e9f1e1d1a22488b0f852e0d764f0f
CA-39537: remove a lot of unnecessary log-spam

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

diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/database/db_cache_types.ml
--- a/ocaml/database/db_cache_types.ml  Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/database/db_cache_types.ml  Wed Apr 14 22:13:57 2010 +0100
@@ -72,7 +72,7 @@
 let lookup_row_in_table tbl tblname objref =
   try
     Hashtbl.find tbl objref
-  with Not_found -> raise (DBCache_NotFound ("missing row",tblname,objref))
+  with Not_found ->  raise (DBCache_NotFound ("missing row",tblname,objref))
 
 let iter_over_rows func table =
   Hashtbl.iter func table
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/context.ml
--- a/ocaml/idl/ocaml_backend/context.ml        Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/context.ml        Wed Apr 14 22:13:57 2010 +0100
@@ -146,7 +146,7 @@
         origin = origin;
         task_name = task_name } 
 
-let make ?(__context=initial) ?subtask_of ?session_id 
?(task_in_database=false) ?task_description ?(origin=Internal) task_name =
+let make ?(__context=initial) ?(quiet=false) ?subtask_of ?session_id 
?(task_in_database=false) ?task_description ?(origin=Internal) task_name =
   let task_id, task_uuid =
     if task_in_database 
     then !__make_task ~__context ?description:task_description ?session_id 
?subtask_of task_name
@@ -159,6 +159,7 @@
   in
 
   let info = if task_in_database then Real.info else Dummy.debug in
+  if not quiet && subtask_of <> None then
     info "task %s%s created%s%s" (* CP-982: promote tracking debug line to 
info status *)
       (!__string_of_task task_name task_id) 
       task_uuid
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/context.mli
--- a/ocaml/idl/ocaml_backend/context.mli       Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/context.mli       Wed Apr 14 22:13:57 2010 +0100
@@ -25,7 +25,8 @@
 val initial : t
 
 (** [make ~__context ~subtask_of ~session_id ~task_in_database 
~task_description ~origin name] creates a new context. 
-    [__context] is the calling context, 
+    [__context] is the calling context,
+       [quiet] silences "task created" log messages,
     [subtask_of] is a reference to the parent task, 
     [session_id] is the current session id,
     [task_in_database] indicates if the task needs to be stored the task in 
the database, 
@@ -33,6 +34,7 @@
     [task_name] is the task name of the created context. *)
 val make :
   ?__context:t ->
+  ?quiet:bool ->
   ?subtask_of:API.ref_task ->
   ?session_id:API.ref_session ->
   ?task_in_database:bool ->
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/gen_server.ml
--- a/ocaml/idl/ocaml_backend/gen_server.ml     Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/gen_server.ml     Wed Apr 14 22:13:57 2010 +0100
@@ -296,8 +296,10 @@
              [
              "let subtask_of = if http_req.Http.task <> None then 
http_req.Http.task else http_req.Http.subtask_of in";
              "Server_helpers.exec_with_new_task (\"dispatch:\"^__call^\"\") 
?subtask_of:(Pervasiveext.may Ref.of_string subtask_of) (fun __context ->";
+(*
              "if not (Hashtbl.mem supress_printing_for_these_messages __call) 
then ";
              debug "%s %s" [ "__call"; "(if __async then \"(async)\" else 
\"\")" ];
+*)
              "Server_helpers.dispatch_exn_wrapper (fun () -> (match __call 
with ";
            ] @ (List.flatten (List.map obj all_objs)) @ [
                "| \"system.listMethods\" -> ";
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/server_helpers.ml
--- a/ocaml/idl/ocaml_backend/server_helpers.ml Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/server_helpers.ml Wed Apr 14 22:13:57 2010 +0100
@@ -110,7 +110,7 @@
         (fun () -> 
            if not called_async 
            then Context.destroy __context
-           else debug "nothing more to process for this thread"))
+           (* else debug "nothing more to process for this thread" *)))
     ()
 
 let dispatch_exn_wrapper f =
@@ -153,9 +153,9 @@
         in
           XMLRPC.Success (marshaller_fn result)
 
-let exec_with_new_task ?subtask_of ?session_id ?task_in_database 
?task_description ?origin task_name f =
+let exec_with_new_task ?quiet ?subtask_of ?session_id ?task_in_database 
?task_description ?origin task_name f =
   exec_with_context 
-    ~__context:(Context.make ?subtask_of ?session_id ?task_in_database 
?task_description ?origin task_name) 
+    ~__context:(Context.make ?quiet ?subtask_of ?session_id ?task_in_database 
?task_description ?origin task_name) 
     (fun ~__context -> f __context)
   
 let exec_with_forwarded_task ?session_id ?origin task_id f =
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/session_check.ml
--- a/ocaml/idl/ocaml_backend/session_check.ml  Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/session_check.ml  Wed Apr 14 22:13:57 2010 +0100
@@ -27,7 +27,7 @@
 
 (* intra_pool_only is true iff the call that's invoking this check can only be 
called from host<->host intra-pool communication *)
 let check ~intra_pool_only ~session_id =
-  Server_helpers.exec_with_new_task "session_check"
+  Server_helpers.exec_with_new_task ~quiet:true "session_check"
     (fun __context ->
        (* First see if this is a "local" session *)
        if is_local_session __context session_id 
@@ -48,7 +48,7 @@
              Db_actions.DB_Action.Session.set_last_active ~__context 
~self:session_id
                ~value:(Date.of_float (Unix.time()))
          with 
-         | Db_exn.DBCache_NotFound ("missing reference", tblname, reference) ->
+         | Db_exn.DBCache_NotFound (_, tblname, reference) ->
              debug "Session check failed: missing reference; tbl = %s, ref = 
%s" tblname reference;
              raise (Api_errors.Server_error 
(Api_errors.session_invalid,[reference]))
          | Non_master_login_on_slave ->
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/idl/ocaml_backend/taskHelper.ml
--- a/ocaml/idl/ocaml_backend/taskHelper.ml     Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/idl/ocaml_backend/taskHelper.ml     Wed Apr 14 22:13:57 2010 +0100
@@ -93,10 +93,12 @@
   then (
     assert_can_destroy ~ok_if_no_session_in_context:true ~__context task_id;
     Db_actions.DB_Action.Task.destroy ~__context ~self:task_id
-  );
+  )
+(*
   if Context.get_task_id __context = task_id
   then debug "task destroyed"
   else debug "task %s destroyed" (string_of_task "" task_id)
+*)
 
 (* set the ref fn to break the cyclic dependency *)
 let init () = 
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/util/stats.ml
--- a/ocaml/util/stats.ml       Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/util/stats.ml       Wed Apr 14 22:13:57 2010 +0100
@@ -82,9 +82,12 @@
        Hashtbl.replace timings name p';
 (*       debug "Population %s time = %f mean = %s" name x (string_of p'); *)
        p') in
+()
+(*
   (* Check to see if the value is > 3 standard deviations from the mean *)
   if abs_float (x -. (mean p)) > (sd p *. 3.)
   then debug "Population %s time more than 3 standard deviations from the mean 
(time = %f; mean = %s)" name x (string_of p)
+*)
 
 (** Helper function to time a specific thing *)
 let time_this (name: string) f = 
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xapi/events.ml
--- a/ocaml/xapi/events.ml      Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xapi/events.ml      Wed Apr 14 22:13:57 2010 +0100
@@ -551,7 +551,7 @@
 
 (** Called from Xal *)
 let callback_guest_agent ctx domid = 
-  debug "VM (domid: %d) guest agent update" domid;
+  (* debug "VM (domid: %d) guest agent update" domid; *)
   try
        (* This might fail if the domain has been destroyed: *)
        let uuid = uuid_of_domid domid in
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xapi/helpers.ml
--- a/ocaml/xapi/helpers.ml     Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xapi/helpers.ml     Wed Apr 14 22:13:57 2010 +0100
@@ -103,7 +103,7 @@
     passing it the rpc function and session id, logout when finished. *)
 let call_api_functions ~__context f =
   let rpc = make_rpc ~__context in
-  let () = debug "logging into master" in
+  (* let () = debug "logging into master" in *)
   (* If we're the master then our existing session may be a client one without 
'pool' flag set, so
      we consider making a new one. If we're a slave then our existing session 
(if we have one) must
      have the 'pool' flag set because it would have been created for us in the 
message forwarding layer
@@ -128,11 +128,11 @@
       with _ -> 
       do_master_login ()
   in
-  let () = debug "login done" in
+  (* let () = debug "login done" in *)
   finally 
     (fun () -> f rpc session_id) 
     (fun () ->
-       debug "remote client call finished; logging out";
+       (* debug "remote client call finished; logging out"; *)
        if !require_explicit_logout 
       then Client.Client.Session.logout rpc session_id)
 
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xapi/message_forwarding.ml
--- a/ocaml/xapi/message_forwarding.ml  Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xapi/message_forwarding.ml  Wed Apr 14 22:13:57 2010 +0100
@@ -66,7 +66,7 @@
   let table_m = Mutex.create ()
     
   let wait ((a, b) as key) time = 
-    debug "Early_wakeup wait key = (%s, %s) time = %.2f" a b time;
+    (* debug "Early_wakeup wait key = (%s, %s) time = %.2f" a b time; *)
     let d = Delay.make () in
     Mutex.execute table_m (fun () -> Hashtbl.add table key d);
     finally
@@ -74,23 +74,23 @@
         let start = Unix.gettimeofday () in
         let waited_full_length = Delay.wait d time in
         let time_sleeping = Unix.gettimeofday () -. start in
-        debug "Early_wakeup %s key = (%s, %s) after %.2f (speedup %.2f 
seconds)" 
+        (* debug "Early_wakeup %s key = (%s, %s) after %.2f (speedup %.2f 
seconds)" 
           (if waited_full_length then "slept" else "woken") a b time_sleeping 
(time -. time_sleeping)
-      )
+     *)() )
       (fun () -> Mutex.execute table_m (fun () -> Hashtbl.remove table key))
       
   let broadcast ((a, b) as key) = 
-    debug "Early_wakeup broadcast key = (%s, %s)" a b;
+    (*debug "Early_wakeup broadcast key = (%s, %s)" a b;*)
     Mutex.execute table_m 
       (fun () -> 
-        Hashtbl.iter (fun (a, b) d -> debug "Signalling thread blocked on (%s, 
%s)" a b; Delay.signal d) table
+        Hashtbl.iter (fun (a, b) d -> (*debug "Signalling thread blocked on 
(%s, %s)" a b;*) Delay.signal d) table
       )
 
   let signal ((a, b) as key) = 
-    debug "Early_wakeup signal key = (%s, %s)" a b;
+    (*debug "Early_wakeup signal key = (%s, %s)" a b;*)
     Mutex.execute table_m 
       (fun () -> 
-        if Hashtbl.mem table key then (debug "Signalling thread blocked on 
(%s,%s)" a b; Delay.signal (Hashtbl.find table key))
+        if Hashtbl.mem table key then ((*debug "Signalling thread blocked on 
(%s,%s)" a b;*) Delay.signal (Hashtbl.find table key))
       )
 end
 
@@ -1242,7 +1242,7 @@
        (fun () ->
           forward_vm_op ~local_fn ~__context ~vm (fun session_id rpc -> 
Client.VM.suspend rpc session_id vm));
       let uuid = Db.VM.get_uuid ~__context ~self:vm in
-       debug "placeholder for retrieving the current value of memory-actual";
+       (* debug "placeholder for retrieving the current value of 
memory-actual";*)
       let message_body = 
        Printf.sprintf "VM '%s' suspended" 
          (Db.VM.get_name_label ~__context ~self:vm) 
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml       Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xapi/vmops.ml       Wed Apr 14 22:13:57 2010 +0100
@@ -668,7 +668,6 @@
        (* CA-25297: domarch is r/o and not currently stored in the LBR *)
        let protocol = Helpers.device_protocol_of_string (Db.VM.get_domarch 
~__context ~self) in
 
-       debug "For each disk which was attached to the VM when suspended, 
reattach SRs, VDIs and use VDIs";
        let string_of_vbd_list vbds = String.concat "; " 
          (List.map (fun vbd -> string_of_vbd ~__context ~vbd) vbds) in
 
@@ -791,16 +790,14 @@
                               The double domain destroy that you'll get (since 
the outer handler will also call destroy) is harmless since domids are
                               not re-used until we loop round the whole range.
                            *)
-                           debug "Vmops.restore (inner-handler) caught: %s." 
(ExnHelper.string_of_exn exn);
-                           debug "Vmops.restore (inner-handler): calling 
domain_destroy";
+                           debug "Vmops.restore (inner-handler) caught: %s: 
calling domain_destroy" (ExnHelper.string_of_exn exn);
                            destroy ~__context ~xc ~xs ~self 
~clear_currently_attached:false ~detach_devices:false ~deactivate_devices:false 
domid `Suspended;
                            raise exn (* re-raise *)
                          end
                     )
                 with exn ->
                   begin
-                    debug "Vmops.restore caught: %s." (ExnHelper.string_of_exn 
exn);
-                    debug "Vmops.restore: calling domain_destroy";
+                    debug "Vmops.restore caught: %s: calling domain_destroy" 
(ExnHelper.string_of_exn exn);
                     (* We do not detach/deactivate here because -- either 
devices were attached (in which case the storage_access
                        handler has already detached them by this point); or 
devices were _never_ attached because exn was thrown
                        before storage_access handler *)
@@ -1099,18 +1096,16 @@
                                not re-used until we loop round the whole range.
                             *)
                             begin
-                              debug "Vmops.start_paused (inner-handler) 
caught: %s." (ExnHelper.string_of_exn exn);
-                              debug "Vmops.start_paused (inner-handler): 
calling domain_destroy";
+                              debug "Vmops.start_paused (inner-handler) 
caught: %s: calling domain_destroy" (ExnHelper.string_of_exn exn);
                               destroy ~__context ~xc ~xs ~self:vm 
~detach_devices:false ~deactivate_devices:false domid `Halted;
                               raise exn (* re-raise *)
                             end
                        )
                    with exn ->
-                     debug "Vmops.start_paused caught: %s."
+                     debug "Vmops.start_paused caught: %s: calling 
domain_destroy"
                        (ExnHelper.string_of_exn exn);
                      error "Memory F %Ld KiB S %Ld KiB T %Ld MiB" 
(Memory.get_free_memory_kib xc) (Memory.get_scrub_memory_kib xc) 
(Memory.get_total_memory_mib xc);
 
-                     debug "Vmops.start_paused: calling domain_destroy";
                      (* We do not detach/deactivate here because -- either 
devices were attached (in which case the storage_access
                         handler has already detached them by this point); or 
devices were _never_ attached because exn was thrown
                         before storage_access handler *)
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xapi/xapi_guest_agent.ml
--- a/ocaml/xapi/xapi_guest_agent.ml    Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xapi/xapi_guest_agent.ml    Wed Apr 14 22:13:57 2010 +0100
@@ -104,7 +104,7 @@
   and last_updated = Unix.gettimeofday () in
 
   let num = Mutex.execute mutex (fun () -> Hashtbl.fold (fun _ _ c -> 1 + c) 
cache 0) in 
-  debug "Number of entries in hashtbl: %d" num;
+  (* debug "Number of entries in hashtbl: %d" num; *)
 
   (* to avoid breakage whilst 'micro' is added to linux and windows agents, 
default this field
      to -1 if it's not present in xenstore *)
@@ -257,7 +257,7 @@
              Thread.delay Xapi_globs.guest_liveness_timeout;
              let doms = Xc.domain_getinfolist xc 1 in (* no guest agent in 
dom0 *)
              let now = Unix.gettimeofday () in
-             debug "Running liveness logic";
+             (* debug "Running liveness logic"; *)
              Mutex.execute mutex (fun () -> 
                List.iter (fun dom ->
                  let domid = dom.Xc.domid in
@@ -266,33 +266,33 @@
                    let dead = IntSet.mem domid !dead_domains in
                    if dead then
                      begin
-                       debug "Domain %d thought to be dead" domid;
+                       (* debug "Domain %d thought to be dead" domid; *)
                        (* If it's marked as dead, check if we've received any 
update recently *)
                        if now -. last_updated < 
Xapi_globs.guest_liveness_timeout then
                          begin
-                           debug "Marking as alive!";
+                           (* debug "Marking as alive!"; *)
                            (* Mark guest as alive! *)
                            dead_domains := IntSet.remove domid !dead_domains;
                                let vm = Db.VM.get_by_uuid ~__context 
~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle)) in
                            let vm_guest_metrics = Db.VM.get_guest_metrics 
~__context ~self:vm in
                            Db.VM_guest_metrics.set_live ~__context 
~self:vm_guest_metrics ~value:true;
-                           debug "Done"
+                           (* debug "Done" *)
                              
                          end                     
                      end
                    else
                      begin
-                       debug "Domain %d thought to be live" domid;
+                       (* debug "Domain %d thought to be live" domid; *)
                        (* If it's marked as alive, check if we've received any 
update recently *)
                        if now -. last_updated > 
Xapi_globs.guest_liveness_timeout then
                          begin
-                           debug "Marking as dead!";
+                           (* debug "Marking as dead!"; *)
                            (* Mark guest as dead! *)
                            dead_domains := IntSet.add domid !dead_domains;
                                let vm = Db.VM.get_by_uuid ~__context 
~uuid:(Uuid.string_of_uuid (Uuid.uuid_of_int_array dom.Xc.handle)) in           
                  
                            let vm_guest_metrics = Db.VM.get_guest_metrics 
~__context ~self:vm in
                            Db.VM_guest_metrics.set_live ~__context 
~self:vm_guest_metrics ~value:false;
-                           debug "Done"
+                           (* debug "Done" *)
                          end                     
                      end
                  with
diff -r 0dc60977336e -r 36c5ecfdb70f ocaml/xenops/watch.ml
--- a/ocaml/xenops/watch.ml     Wed Apr 14 18:04:48 2010 +0100
+++ b/ocaml/xenops/watch.ml     Wed Apr 14 22:13:57 2010 +0100
@@ -66,7 +66,7 @@
          failwith "internal error in Watch.wait: perhaps the list of paths was 
empty but the condition reports false?"
       end
   with Xs.Timeout -> 
-    debug "watch: timeout while watching xenstore after %f seconds" timeout;
+    error "watch: timeout while watching xenstore after %f seconds" timeout;
     (* Extra debugging to see if we've missed a watch somewhere *)
     (match x.evaluate ~xs with
      | KeepWaiting -> raise (Timeout timeout)
@@ -80,7 +80,7 @@
     evaluate = fun ~xs -> 
       try 
        let v = xs.Xs.read path in
-       debug "watch: value has appeared: %s = %s" path v;
+       (*debug "watch: value has appeared: %s = %s" path v;*)
        Result v
       with Xb.Noent -> KeepWaiting }
 
@@ -91,7 +91,7 @@
       try 
        ignore(xs.Xs.read path); KeepWaiting 
       with Xb.Noent ->
-       debug "watch: key has disappeared: %s" path;
+       (*debug "watch: key has disappeared: %s" path;*)
        Result () 
   }
 
@@ -102,7 +102,7 @@
       try 
        if xs.Xs.read path = v 
        then begin
-         debug "watch: value has become: %s = %s" path v;
+         (*debug "watch: value has become: %s = %s" path v;*)
          Result () 
        end else KeepWaiting 
       with Xb.Noent -> KeepWaiting }
14 files changed, 47 insertions(+), 42 deletions(-)
ocaml/database/db_cache_types.ml          |    2 +-
ocaml/idl/ocaml_backend/context.ml        |    3 ++-
ocaml/idl/ocaml_backend/context.mli       |    4 +++-
ocaml/idl/ocaml_backend/gen_server.ml     |    2 ++
ocaml/idl/ocaml_backend/server_helpers.ml |    6 +++---
ocaml/idl/ocaml_backend/session_check.ml  |    4 ++--
ocaml/idl/ocaml_backend/taskHelper.ml     |    4 +++-
ocaml/util/stats.ml                       |    3 +++
ocaml/xapi/events.ml                      |    2 +-
ocaml/xapi/helpers.ml                     |    6 +++---
ocaml/xapi/message_forwarding.ml          |   16 ++++++++--------
ocaml/xapi/vmops.ml                       |   13 ++++---------
ocaml/xapi/xapi_guest_agent.ml            |   16 ++++++++--------
ocaml/xenops/watch.ml                     |    8 ++++----


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

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.