Skip to content

Commit ba202ba

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 9be7780 commit ba202ba

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

ocaml/idl/datamodel_common.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Datamodel_roles
1010
to leave a gap for potential hotfixes needing to increment the schema version.*)
1111
let schema_major_vsn = 5
1212

13-
let schema_minor_vsn = 785
13+
let schema_minor_vsn = 786
1414

1515
(* Historical schema versions just in case this is useful later *)
1616
let rio_schema_major_vsn = 5

ocaml/idl/datamodel_pool.ml

+5
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,11 @@ let t =
20062006
, "22.16.0"
20072007
, "Became StaticRO to be editable through new method"
20082008
)
2009+
; ( Changed
2010+
, "25.10.0"
2011+
, "Field replaced with a digest. You can still get the actual \
2012+
value by calling Host.get_uefi_certificates"
2013+
)
20092014
]
20102015
~default_value:(Some (VString "")) "uefi_certificates"
20112016
"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 = "458f20f5270a5615c7ee92be8a383172"
6+
let last_known_schema_hash = "04cff725020babbe2c6962885595a975"
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
@@ -2141,7 +2141,8 @@ let get_active_uefi_certificates ~__context ~self =
21412141
in
21422142
match (!Xapi_globs.allow_custom_uefi_certs, custom_uefi_certs) with
21432143
| false, _ | true, "" ->
2144-
Db.Pool.get_uefi_certificates ~__context ~self
2144+
let master = Db.Pool.get_master ~__context ~self in
2145+
Db.Host.get_uefi_certificates ~__context ~self:master
21452146
| true, _ ->
21462147
custom_uefi_certs
21472148

ocaml/xapi/xapi_host.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,7 @@ let write_uefi_certificates_to_disk ~__context ~host =
27782778
if Pool_role.is_master () then
27792779
Db.Pool.set_uefi_certificates ~__context
27802780
~self:(Helpers.get_pool ~__context)
2781-
~value:disk_uefi_certs_tar ;
2781+
~value:(if disk_uefi_certs_tar = "" then "" else Digest.string disk_uefi_certs_tar |> Digest.to_hex) ;
27822782
let pool_uefi_certs =
27832783
Db.Pool.get_custom_uefi_certificates ~__context
27842784
~self:(Helpers.get_pool ~__context)

0 commit comments

Comments
 (0)