Skip to content

Commit

Permalink
CA-384936 attach static VDIs for redo-log (#5235)
Browse files Browse the repository at this point in the history
* CA-384936 enable redo log logging

We have a case where we don't know why the redo log is not found on
boot. We need this log entry to understand if any VDIs are found.

Signed-off-by: Christian Lindig <[email protected]>

* CA-384936 attach static VDIs for redo-log

The redo-log without HA is missing to attach the static VDIs that
actually contain the redo log. Call the same code that we are using in
the HA case.

Signed-off-by: Christian Lindig <[email protected]>

---------

Signed-off-by: Christian Lindig <[email protected]>
Co-authored-by: Christian Lindig <[email protected]>
  • Loading branch information
lindig and Christian Lindig authored Nov 13, 2023
1 parent 03606d3 commit 893fd6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml/database/redo_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let get_static_device reason =
(Static_vdis_list.list ())
in
(* Return the path to the first attached VDI which matches the reason *)
R.debug "Found %d VDIs matching [%s]" (List.length vdis) reason ;
D.debug "Found %d VDIs matching [%s]" (List.length vdis) reason ;
match vdis with [] -> None | hd :: _ -> hd.Static_vdis_list.path

let mib megabytes =
Expand Down
1 change: 1 addition & 0 deletions ocaml/xapi/static_vdis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let gc () =
(** If we just rebooted and failed to attach our static VDIs then this can be called to reattempt the attach:
this is necessary for HA to start. *)
let reattempt_on_boot_attach () =
debug "%s" __FUNCTION__ ;
let script = "attach-static-vdis" in
try ignore (Helpers.call_script "/sbin/service" [script; "start"])
with e ->
Expand Down
1 change: 1 addition & 0 deletions ocaml/xapi/xapi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ let start_redo_log () =
&& not (bool_of_string (Localdb.get Constants.ha_armed))
then (
debug "Redo log was enabled when shutting down, so restarting it" ;
Static_vdis.reattempt_on_boot_attach () ;
(* enable the use of the redo log *)
Redo_log.enable_existing Xapi_ha.ha_redo_log
Xapi_globs.gen_metadata_vdi_reason ;
Expand Down

0 comments on commit 893fd6d

Please sign in to comment.