From 5cc0fa339c740d196ea445ad9e50872522fc4c6b Mon Sep 17 00:00:00 2001 From: Vincent Liu Date: Fri, 25 Oct 2024 12:24:56 +0100 Subject: [PATCH] IH-728: Refactor tracing logic Previously a task was constructed based on the log and tracing of a dbg of the type Debug_info.t, and then later on a dbg is constructed based on the previously constructued task. Instead of that, just convert the first dbg into a string and thread it through the call. Signed-off-by: Vincent Liu --- ocaml/xapi/storage_migrate.ml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ocaml/xapi/storage_migrate.ml b/ocaml/xapi/storage_migrate.ml index 3609a8afb8..3279846a5a 100644 --- a/ocaml/xapi/storage_migrate.ml +++ b/ocaml/xapi/storage_migrate.ml @@ -456,12 +456,6 @@ let add_to_sm_config vdi_info key value = let vdi_info = remove_from_sm_config vdi_info key in {vdi_info with sm_config= (key, value) :: vdi_info.sm_config} -let dbg_and_tracing_of_task task = - Debug_info.make - ~log:(Storage_task.get_dbg task) - ~tracing:(Storage_task.tracing task) - |> Debug_info.to_string - (** This module [MigrateLocal] consists of the concrete implementations of the migration part of SMAPI. Functions inside this module are sender driven, which means they tend to be executed on the sender side. although there is not a hard rule @@ -716,7 +710,7 @@ module MigrateLocal = struct | e -> raise (Storage_error (Internal_error (Printexc.to_string e))) - let start ~task ~dbg:_ ~sr ~vdi ~dp ~url ~dest ~verify_dest = + let start ~task ~dbg ~sr ~vdi ~dp ~url ~dest ~verify_dest = SXM.info "%s sr:%s vdi:%s url:%s dest:%s verify_dest:%B" __FUNCTION__ (Storage_interface.Sr.string_of sr) (Storage_interface.Vdi.string_of vdi) @@ -730,7 +724,6 @@ module MigrateLocal = struct (Storage_utils.connection_args_of_uri ~verify_dest url) end)) in (* Find the local VDI *) - let dbg = dbg_and_tracing_of_task task in let vdis = Local.SR.scan dbg sr in let local_vdi = try List.find (fun x -> x.vdi = vdi) vdis @@ -1383,14 +1376,14 @@ let with_task_and_thread ~dbg f = let copy ~dbg ~sr ~vdi ~url ~dest ~verify_dest = with_task_and_thread ~dbg (fun task -> - MigrateLocal.copy_into_sr ~task ~dbg:dbg.Debug_info.log ~sr ~vdi ~url - ~dest ~verify_dest + MigrateLocal.copy_into_sr ~task ~dbg:(Debug_info.to_string dbg) ~sr ~vdi + ~url ~dest ~verify_dest ) let start ~dbg ~sr ~vdi ~dp ~url ~dest ~verify_dest = with_task_and_thread ~dbg (fun task -> - MigrateLocal.start ~task ~dbg:dbg.Debug_info.log ~sr ~vdi ~dp ~url ~dest - ~verify_dest + MigrateLocal.start ~task ~dbg:(Debug_info.to_string dbg) ~sr ~vdi ~dp ~url + ~dest ~verify_dest ) (* XXX: PR-1255: copy the xenopsd 'raise Exception' pattern *)