File tree Expand file tree Collapse file tree 1 file changed +18
-14
lines changed
Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -181,20 +181,24 @@ let assert_operation_valid ~__context ~self ~(op : API.host_allowed_operations)
181181 throw_error table op
182182
183183let update_allowed_operations ~__context ~self : unit =
184- let all = Db.Host. get_record_internal ~__context ~self in
185- let valid = valid_operations ~__context all self in
186- let keys =
187- Hashtbl. fold (fun k v acc -> if v = None then k :: acc else acc) valid []
188- in
189- (* CA-18377: If there's a rolling upgrade in progress, only send Miami keys across the wire. *)
190- let keys =
191- if Helpers. rolling_upgrade_in_progress ~__context then
192- Xapi_stdext_std.Listext.List. intersect keys
193- Xapi_globs. host_operations_miami
194- else
195- keys
196- in
197- Db.Host. set_allowed_operations ~__context ~self ~value: keys
184+ try
185+ (* This might fail if the coordinator has been updated *)
186+ let all = Db.Host. get_record_internal ~__context ~self in
187+ let valid = valid_operations ~__context all self in
188+ let keys =
189+ Hashtbl. fold (fun k v acc -> if v = None then k :: acc else acc) valid []
190+ in
191+ (* CA-18377: If there's a rolling upgrade in progress, only send Miami keys across the wire. *)
192+ let keys =
193+ if Helpers. rolling_upgrade_in_progress ~__context then
194+ Xapi_stdext_std.Listext.List. intersect keys
195+ Xapi_globs. host_operations_miami
196+ else
197+ keys
198+ in
199+ Db.Host. set_allowed_operations ~__context ~self ~value: keys
200+ with e ->
201+ error " Failed to update host.allowed_operations: %s" (Printexc. to_string e)
198202
199203let update_allowed_operations_all_hosts ~__context : unit =
200204 let hosts = Db.Host. get_all ~__context in
You can’t perform that action at this time.
0 commit comments