Skip to content

Commit d052406

Browse files
authored
Merge pull request xapi-project#237 from jonludlam/CA-231357-ely-bugfix
CA-231357: Don't remove old pool_patch records until after RPU
2 parents 8714b64 + bc8fa2d commit d052406

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ocaml/xapi/xapi_pool_update.ml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,18 @@ let resync_host ~__context ~host =
463463
end
464464
else Db.Host.set_updates ~__context ~self:host ~value:[];
465465

466-
(* Remove any pool_patch objects that don't have a corresponding pool_update object *)
467-
Db.Pool_patch.get_all ~__context
468-
|> List.filter (fun self -> Db.Pool_patch.get_pool_update ~__context ~self = Ref.null)
469-
|> List.iter (fun self -> Db.Pool_patch.destroy ~__context ~self);
470-
471-
(* Clean updates that don't have a corresponding patch record *)
472-
Db.Pool_update.get_all ~__context
473-
|> List.filter (fun self -> Xapi_pool_patch.pool_patch_of_update ~__context self = Ref.null)
474-
|> List.iter (fun self -> destroy ~__context ~self)
466+
(* Only clean up existing patches if rolling upgrade has actually finished *)
467+
if not (Helpers.rolling_upgrade_in_progress ~__context) then begin
468+
(* Remove any pool_patch objects that don't have a corresponding pool_update object *)
469+
Db.Pool_patch.get_all ~__context
470+
|> List.filter (fun self -> Db.Pool_patch.get_pool_update ~__context ~self = Ref.null)
471+
|> List.iter (fun self -> Db.Pool_patch.destroy ~__context ~self);
472+
473+
(* Clean updates that don't have a corresponding patch record *)
474+
Db.Pool_update.get_all ~__context
475+
|> List.filter (fun self -> Xapi_pool_patch.pool_patch_of_update ~__context self = Ref.null)
476+
|> List.iter (fun self -> destroy ~__context ~self)
477+
end
475478

476479
let pool_update_download_handler (req: Request.t) s _ =
477480
debug "pool_update.pool_update_download_handler URL %s" req.Request.uri;

0 commit comments

Comments
 (0)