Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ocaml/xapi/repository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,12 @@ let apply_updates' ~__context ~host ~updates_info ~livepatches ~acc_rpm_updates
=
(* This function runs on coordinator host *)
let open Guidance in
let livepatches =
if can_avoid_live_patching ~updates_info ~updates:acc_rpm_updates then
[]
else
livepatches
in
let guidance' =
reduce_guidance ~updates_info ~updates:acc_rpm_updates ~livepatches
in
Expand All @@ -835,7 +841,6 @@ let apply_updates' ~__context ~host ~updates_info ~livepatches ~acc_rpm_updates
Helpers.call_api_functions ~__context (fun rpc session_id ->
Client.Client.Repository.apply ~rpc ~session_id ~host
) ;
(* Always apply livepatches even if host will reboot *)
let applied_livepatches, failed_livepatches =
apply_livepatches' ~__context ~host ~livepatches
in
Expand Down
11 changes: 10 additions & 1 deletion ocaml/xapi/repository_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,11 @@ let reduce_guidance ~updates_info ~updates ~livepatches =
|> GuidanceSet.reduce_cascaded_list
|> List.map (fun (kind, s) -> (kind, GuidanceSet.elements s))

(* Do not apply any live patches when RebootHost is in mandatory guidance. *)
let can_avoid_live_patching ~updates_info ~updates =
eval_guidances ~updates_info ~updates ~kind:Mandatory ~livepatches:[]
|> GuidanceSet.mem RebootHost

let consolidate_updates_of_host ~repository_name ~updates_info host
updates_of_host =
let latest_updates =
Expand Down Expand Up @@ -1305,7 +1310,11 @@ let consolidate_updates_of_host ~repository_name ~updates_info host
* They are only to be returned in the update list.
*)
let livepatches =
retrieve_livepatches_from_updateinfo ~updates_info ~updates:updates_of_host
if can_avoid_live_patching ~updates_info ~updates then
[]
else
retrieve_livepatches_from_updateinfo ~updates_info
~updates:updates_of_host
in
let guidance = reduce_guidance ~updates_info ~updates ~livepatches in
let upd_ids_of_livepatches, lps = merge_livepatches ~livepatches in
Expand Down
Loading