Skip to content

Commit

Permalink
Check for used UEFI certificates when updating vm platform
Browse files Browse the repository at this point in the history
Signed-off-by: BenjiReis <[email protected]>
  • Loading branch information
benjamreis committed Dec 21, 2023
1 parent 5196f53 commit dfa9b94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ocaml/xapi/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2047,3 +2047,13 @@ let unit_test ~__context : bool =
true
| None ->
false

let get_active_uefi_certificates ~__context ~self =
let custom_uefi_certs =
Db.Pool.get_custom_uefi_certificates ~__context ~self
in
match (!Xapi_globs.allow_custom_uefi_certs, custom_uefi_certs) with
| false, _ | true, "" ->
Db.Pool.get_uefi_certificates ~__context ~self
| true, _ ->
custom_uefi_certs
5 changes: 2 additions & 3 deletions ocaml/xapi/xapi_vm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,8 @@ let update_platform_secureboot ~__context ~self platform =
| exception Not_found ->
platform
| "auto" ->
( "secureboot"
, string_of_bool (Db.Pool.get_uefi_certificates ~__context ~self <> "")
)
let uefi_certs = Helpers.get_active_uefi_certificates ~__context ~self in
("secureboot", string_of_bool (uefi_certs <> ""))
:: List.remove_assoc "secureboot" platform
| _ ->
platform
Expand Down

0 comments on commit dfa9b94

Please sign in to comment.