Skip to content

Commit f2542e8

Browse files
author
David Scott
committed
xenvmd, local allocator: log all the metadata updates on the rings
Signed-off-by: David Scott <[email protected]>
1 parent 9fa1755 commit f2542e8

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

idl/log.ml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
open Sexplib.Std
2+
3+
type traced_operation = [
4+
| `Set of string * string * [ `Producer | `Consumer | `Suspend | `Suspend_ack ] * [ `Int64 of int64 | `Bool of bool ]
5+
| `Get of string * string * [ `Producer | `Consumer | `Suspend | `Suspend_ack ] * [ `Int64 of int64 | `Bool of bool ]
6+
] with sexp
7+
type traced_operation_list = traced_operation list with sexp
8+
19
let debug fmt = Printf.ksprintf (fun s -> print_endline s) fmt
210
let info fmt = Printf.ksprintf (fun s -> print_endline s) fmt
311
let error fmt = Printf.ksprintf (fun s -> print_endline s) fmt
12+
13+
let trace ts =
14+
let string_of_key = function
15+
| `Producer -> "producer"
16+
| `Consumer -> "consumer"
17+
| `Suspend -> "suspend"
18+
| `Suspend_ack -> "suspend_ack" in
19+
let string_of_value = function
20+
| `Int64 x -> Int64.to_string x
21+
| `Bool b -> string_of_bool b in
22+
let one = function
23+
| `Set (_, queue, key, value) ->
24+
Printf.sprintf "%s.%s := %s" queue (string_of_key key) (string_of_value value)
25+
| `Get (__, queue, key, value) ->
26+
Printf.sprintf "%s.%s == %s" queue (string_of_key key) (string_of_value value) in
27+
info "%s" (String.concat ", " (List.map one ts))

test/common.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ open Lwt
2020
(* Mock kernel devices so we can run as a regular user *)
2121
let use_mock = ref true
2222

23-
module Log = struct
24-
let debug fmt = Printf.ksprintf (fun s -> print_endline s) fmt
25-
let info fmt = Printf.ksprintf (fun s -> print_endline s) fmt
26-
let error fmt = Printf.ksprintf (fun s -> print_endline s) fmt
27-
end
28-
2923
module Time = struct
3024
type 'a io = 'a Lwt.t
3125
let sleep = Lwt_unix.sleep

xenvm-local-allocator/local_allocator.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ let main use_mock config daemon socket journal fromLVM toLVM =
384384
) >>= fun device ->
385385

386386
(* We must replay the journal before resynchronising free blocks *)
387-
J.start device perform
387+
J.start ~client:"xenvm-local-allocator" ~name:"local allocator journal" device perform
388388
>>|= fun j ->
389389

390390
FreePool.start config vg

xenvmd/xenvmd.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ module FreePool = struct
538538
| `Error _ -> fatal_error_t ("open " ^ name)
539539
| `Ok x -> return x )
540540
>>= fun device ->
541-
J.start device perform
541+
J.start ~client:"xenvmd" ~name:"allocation journal" device perform
542542
>>|= fun j' ->
543543
journal := Some j';
544544
return ()

0 commit comments

Comments
 (0)