Skip to content

Commit e862c4c

Browse files
committed
CP-49147: Reduce size of the pool record (uefi_certificates)
This field is very big and part of every pool.get_all_records() call (done by SM), which is currently >64KiB in size. TODO: the Changed field needs to match the (future!) tag that this will receive. Signed-off-by: Edwin Török <[email protected]>
1 parent 7d1bd4a commit e862c4c

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

ocaml/idl/datamodel_pool.ml

+5
Original file line numberDiff line numberDiff line change
@@ -2020,6 +2020,11 @@ let t =
20202020
, "22.16.0"
20212021
, "Became StaticRO to be editable through new method"
20222022
)
2023+
; ( Changed
2024+
, "25.12.0"
2025+
, "Field replaced with a digest. You can still get the actual \
2026+
value by calling Host.get_uefi_certificates"
2027+
)
20232028
]
20242029
~default_value:(Some (VString "")) "uefi_certificates"
20252030
"The UEFI certificates allowing Secure Boot"

ocaml/idl/json_backend/gen_json.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ module Version = struct
613613
try Scanf.sscanf name "%d.%d.%d%s" of_chunks
614614
with _ ->
615615
failwith
616-
(Printf.sprintf "Version schema changed, please change this code %s"
617-
__LOC__
616+
(Printf.sprintf "Version schema changed, please change this code %s: %s"
617+
name __LOC__
618618
)
619619

620620
let to_name_date (lst, str) =

ocaml/idl/schematest.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
33
(* BEWARE: if this changes, check that schema has been bumped accordingly in
44
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
55

6-
let last_known_schema_hash = "ad67a64cd47cdea32085518c1fb38d27"
6+
let last_known_schema_hash = "55f3fcbdb67344ba627fc1dec38fe232"
77

88
let current_schema_hash : string =
99
let open Datamodel_types in

ocaml/xapi/helpers.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,8 @@ let get_active_uefi_certificates ~__context ~self =
21272127
in
21282128
match (!Xapi_globs.allow_custom_uefi_certs, custom_uefi_certs) with
21292129
| false, _ | true, "" ->
2130-
Db.Pool.get_uefi_certificates ~__context ~self
2130+
let master = Db.Pool.get_master ~__context ~self in
2131+
Db.Host.get_uefi_certificates ~__context ~self:master
21312132
| true, _ ->
21322133
custom_uefi_certs
21332134

ocaml/xapi/xapi_host.ml

+6-1
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,12 @@ let write_uefi_certificates_to_disk ~__context ~host =
27572757
if Pool_role.is_master () then
27582758
Db.Pool.set_uefi_certificates ~__context
27592759
~self:(Helpers.get_pool ~__context)
2760-
~value:disk_uefi_certs_tar ;
2760+
~value:
2761+
( if disk_uefi_certs_tar = "" then
2762+
""
2763+
else
2764+
Digest.string disk_uefi_certs_tar |> Digest.to_hex
2765+
) ;
27612766
let pool_uefi_certs =
27622767
Db.Pool.get_custom_uefi_certificates ~__context
27632768
~self:(Helpers.get_pool ~__context)

0 commit comments

Comments
 (0)