From e56cf2eb425e82b3e4b99759f27df5b8039f721e Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Thu, 17 Nov 2022 15:54:30 +0000 Subject: [PATCH 1/3] CA-369690: Prioritize loglines when backing up RRDs By default xcp-rrdd does not log debug lines, elevate two messages so it's easier to know when this operation starts happening and when it fails. Signed-off-by: Pau Ruiz Safont --- ocaml/xcp-rrdd/bin/rrdd/rrdd_server.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ocaml/xcp-rrdd/bin/rrdd/rrdd_server.ml b/ocaml/xcp-rrdd/bin/rrdd/rrdd_server.ml index 1f70cb5460f..8d76fa24bb5 100644 --- a/ocaml/xcp-rrdd/bin/rrdd/rrdd_server.ml +++ b/ocaml/xcp-rrdd/bin/rrdd/rrdd_server.ml @@ -112,11 +112,11 @@ let backup_rrds (remote_address : string option) () : unit = let destination = match remote_address with | None -> - "to local disk" + "local disk" | Some address -> - Printf.sprintf "to host %s" address + Printf.sprintf "host %s" address in - debug "backing up rrds %s" destination ; + info "%s: trying to back up RRDs to %s" __FUNCTION__ destination ; let total_cycles = 5 in let cycles_tried = ref 0 in while !cycles_tried < total_cycles do @@ -129,7 +129,7 @@ let backup_rrds (remote_address : string option) () : unit = Mutex.unlock mutex ; List.iter (fun (uuid, rrd) -> - debug "Backup: saving RRD for VM uuid=%s %s" uuid destination ; + debug "%s: saving RRD for VM uuid=%s" __FUNCTION__ uuid ; let rrd = with_lock mutex (fun () -> Rrd.copy_rrd rrd) in archive_rrd_internal ~transport ~uuid ~rrd () ) @@ -142,14 +142,14 @@ let backup_rrds (remote_address : string option) () : unit = Mutex.unlock mutex ; List.iter (fun (uuid, rrd) -> - debug "Backup: saving RRD for SR uuid=%s %s" uuid destination ; + debug "%s: saving RRD for SR uuid=%s" __FUNCTION__ uuid ; let rrd = with_lock mutex (fun () -> Rrd.copy_rrd rrd) in archive_rrd_internal ~transport ~uuid ~rrd () ) srrds ; match !host_rrd with | Some rrdi -> - debug "Backup: saving RRD for host %s" destination ; + debug "%s: saving RRD for host" __FUNCTION__ ; let rrd = with_lock mutex (fun () -> Rrd.copy_rrd rrdi.rrd) in archive_rrd_internal ~transport ~uuid:(Inventory.lookup Inventory._installation_uuid) @@ -159,7 +159,7 @@ let backup_rrds (remote_address : string option) () : unit = ) else ( cycles_tried := 1 + !cycles_tried ; if !cycles_tried >= total_cycles then - debug "Could not acquire RRD lock, skipping RRD backup" + warn "%s: Could not acquire RRD lock, skipping RRD backup" __FUNCTION__ else Thread.delay 1. ) From 9bb5ea763086a76a68904669b85763d164eecfdf Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Thu, 17 Nov 2022 16:14:32 +0000 Subject: [PATCH 2/3] CA-369690: Reduce logging produced by xmlrpc_client Two loglines per call removed: one is not really useful since the first logline already contains the most important information about the stunnel configuration and the one about the cache is not important as the code is known to work as intended. The main logline about stunnel has been changed to make it obvious there has been a change in the area about logging when triaging with logs Signed-off-by: Pau Ruiz Safont --- ocaml/libs/http-svr/xmlrpc_client.ml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ocaml/libs/http-svr/xmlrpc_client.ml b/ocaml/libs/http-svr/xmlrpc_client.ml index 62e9ebaff77..9c2b091480d 100644 --- a/ocaml/libs/http-svr/xmlrpc_client.ml +++ b/ocaml/libs/http-svr/xmlrpc_client.ml @@ -334,13 +334,11 @@ let with_transport ?(stunnel_wait_disconnect = true) transport f = st_proc' @@ fun st_proc -> let s = st_proc.Stunnel.fd in let s_pid = Stunnel.getpid st_proc.Stunnel.pid in - debug "stunnel pid: %d (cached = %b) connected to %s:%d" s_pid - use_stunnel_cache host port ; + debug "stunnel pid: %d (%scached) connected to %s:%d" s_pid + (if use_stunnel_cache then "" else "not ") + host port ; (* Call the {,un}set_stunnelpid_callback hooks around the remote call *) - let with_recorded_stunnelpid task_opt s_pid f = - debug "with_recorded_stunnelpid task_opt=%s s_pid=%d" - (Option.value ~default:"None" task_opt) - s_pid ; + let with_recorded_stunnelpid f = ( match !Internal.set_stunnelpid_callback with | Some f -> f task_id s_pid @@ -355,7 +353,7 @@ let with_transport ?(stunnel_wait_disconnect = true) transport f = () ) in - with_recorded_stunnelpid task_id s_pid (fun () -> + with_recorded_stunnelpid (fun () -> finally (fun () -> try f Unixfd.(!s) @@ -367,11 +365,9 @@ let with_transport ?(stunnel_wait_disconnect = true) transport f = raise e ) (fun () -> - if use_stunnel_cache then ( - Stunnel_cache.add st_proc ; - debug "stunnel pid: %d (cached = %b) returned stunnel to cache" - s_pid use_stunnel_cache - ) else ( + if use_stunnel_cache then + Stunnel_cache.add st_proc + else ( Unix.unlink st_proc.Stunnel.logfile ; Stunnel.disconnect ~wait:stunnel_wait_disconnect st_proc ) From 1623639f81bca1b7c979c4eb6bfc651a521c44ea Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Fri, 18 Nov 2022 11:46:33 +0000 Subject: [PATCH 3/3] CA-366735: Silence warning about duplicate sources This is generating a lot of spam which is interfering with testing. blocking releases. The root cause of duplication will be targeted in another PR Signed-off-by: Pau Ruiz Safont --- ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml b/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml index d7f351fc26c..cb356f5bee4 100644 --- a/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml +++ b/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml @@ -103,8 +103,6 @@ let update_rrds timestamp dss uuid_domids paused_vms = | None -> Some (add_ds_to StringMap.empty) | Some dss -> - warn {|%s: found duplicate datasource with key "%s" in owner "%a"|} - __FUNCTION__ ds.ds_name owner_to_string owner ; Some (add_ds_to dss) in OwnerMap.update owner merge all