Skip to content

Commit b3a7f19

Browse files
committed
Add additional tracing to VBD plug/unplug
Signed-off-by: Steven Woods <steven.woods@cloud.com>
1 parent c81536f commit b3a7f19

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

ocaml/xenopsd/xc/xenops_server_xen.ml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,6 +3650,7 @@ module VBD = struct
36503650
Device_common.backend_path_of_device ~xs device ^ "/vdi"
36513651

36523652
let plug task vm vbd =
3653+
with_tracing ~task ~name:"VBD_plug" @@ fun () ->
36533654
(* If the vbd isn't listed as "active" then we don't automatically plug this
36543655
one in *)
36553656
if not (get_active vm vbd) then
@@ -3720,6 +3721,7 @@ module VBD = struct
37203721
}
37213722
in
37223723
let dev =
3724+
with_tracing ~task ~name:"VBD_device_add" @@ fun () ->
37233725
Xenops_task.with_subtask task
37243726
(Printf.sprintf "Vbd.add %s" (id_of vbd))
37253727
(fun () ->
@@ -3729,13 +3731,16 @@ module VBD = struct
37293731
)
37303732
in
37313733
(* We store away the disk so we can implement VBD.stat *)
3732-
Option.iter
3733-
(fun d ->
3734-
xs.Xs.write
3735-
(vdi_path_of_device ~xs dev)
3736-
(d |> rpc_of disk |> Jsonrpc.to_string)
3737-
)
3738-
vbd.backend ;
3734+
( with_tracing ~task ~name:"VBD_xs_write" @@ fun () ->
3735+
Option.iter
3736+
(fun d ->
3737+
xs.Xs.write
3738+
(vdi_path_of_device ~xs dev)
3739+
(d |> rpc_of disk |> Jsonrpc.to_string)
3740+
)
3741+
vbd.backend
3742+
) ;
3743+
with_tracing ~task ~name:"VBD_attach_qemu" @@ fun () ->
37393744
(* NB now the frontend position has been resolved *)
37403745
let open Device_common in
37413746
let device_number =
@@ -3798,6 +3803,7 @@ module VBD = struct
37983803
vm
37993804

38003805
let unplug task vm vbd force =
3806+
with_tracing ~task ~name:"VBD_unplug" @@ fun () ->
38013807
with_xc_and_xs (fun xc xs ->
38023808
try
38033809
(* On destroying the datapath
@@ -3851,6 +3857,7 @@ module VBD = struct
38513857
(* this happens on normal shutdown too *)
38523858
(* Case (1): success; Case (2): success; Case (3): an exception is
38533859
thrown *)
3860+
with_tracing ~task ~name:"VBD_device_shutdown" @@ fun () ->
38543861
Xenops_task.with_subtask task
38553862
(Printf.sprintf "Vbd.clean_shutdown %s" (id_of vbd))
38563863
(fun () ->
@@ -3863,14 +3870,17 @@ module VBD = struct
38633870
the DP if the backend is of type VDI *)
38643871
finally
38653872
(fun () ->
3866-
Option.iter
3867-
(fun dev ->
3868-
Xenops_task.with_subtask task
3869-
(Printf.sprintf "Vbd.release %s" (id_of vbd))
3870-
(fun () -> Device.Vbd.release task ~xc ~xs dev)
3871-
)
3872-
dev ;
3873+
( with_tracing ~task ~name:"VBD_device_release" @@ fun () ->
3874+
Option.iter
3875+
(fun dev ->
3876+
Xenops_task.with_subtask task
3877+
(Printf.sprintf "Vbd.release %s" (id_of vbd))
3878+
(fun () -> Device.Vbd.release task ~xc ~xs dev)
3879+
)
3880+
dev
3881+
) ;
38733882
(* If we have a qemu frontend, detach this too. *)
3883+
with_tracing ~task ~name:"VBD_detach_qemu" @@ fun () ->
38743884
let _ =
38753885
DB.update vm
38763886
(Option.map (fun vm_t ->
@@ -3901,6 +3911,7 @@ module VBD = struct
39013911
()
39023912
)
39033913
(fun () ->
3914+
with_tracing ~task ~name:"VBD_dp_destroy" @@ fun () ->
39043915
match (domid, backend) with
39053916
| Some x, None | Some x, Some (VDI _) ->
39063917
Storage.dp_destroy task

0 commit comments

Comments
 (0)