Skip to content

Commit 8073b33

Browse files
committed
CA-383867: Allow xapi-guard to disable the disk cache
This is done through the fist point. Xapi_fist is not used directly because it needs to a new opam package, creating a lot of churn which is currently unwanted. Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent a01b80a commit 8073b33

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ocaml/xapi-guard/lib/disk_cache.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ type t = Uuidm.t * Mtime.t * Types.Tpm.key
2525

2626
let cache_of service = runtime_data // Types.Service.to_string service
2727

28+
let fistpoint () =
29+
let name = "/tmp/fist_disable_xapi_guard_cache" in
30+
try
31+
let* () = Lwt_unix.access name [Unix.F_OK] in
32+
Lwt.return true
33+
with _ -> Lwt.return false
34+
2835
let files_in dir ~otherwise =
2936
Lwt.catch
3037
(fun () ->
@@ -292,7 +299,8 @@ end = struct
292299
let* () = persist () in
293300
Lwt_result.return ()
294301
in
295-
let on_exception = engage_and_persist in
302+
let* cache_disabled = fistpoint () in
303+
let on_exception = if cache_disabled then fail else engage_and_persist in
296304
let lock_and_push () =
297305
with_lock queue.lock (read_state_and_push on_exception)
298306
in

ocaml/xapi/xapi_fist.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ let int_seed name : int option =
160160
let exchange_certificates_in_pool () : int option =
161161
let name = "exchange_certificates_in_pool" in
162162
int_seed name
163+
164+
let disable_xapi_guard_cache () = fistpoint "disable_xapi_guard_cache"

0 commit comments

Comments
 (0)