Skip to content

Commit 281347b

Browse files
author
Christian Lindig
committed
CA-392163 clear scheduled assignments on startup
Clear all (stale) scheduled assignments for: VM, PCI, VGPU objects on startup. We were missing the latter two. Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
1 parent 09b4bdb commit 281347b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

ocaml/xapi/dbsync_master.ml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,20 @@ let release_locks ~__context =
156156
Xapi_vm_lifecycle.force_state_reset ~__context ~self ~value:`Halted
157157
)
158158
vms ;
159-
(* All VMs should have their scheduled_to_be_resident_on field cleared *)
160-
List.iter
161-
(fun self ->
162-
Db.VM.set_scheduled_to_be_resident_on ~__context ~self ~value:Ref.null
163-
)
164-
(Db.VM.get_all ~__context)
159+
(* Clear all assignments that are only scheduled *)
160+
let value = Ref.null in
161+
Db.VM.get_all ~__context
162+
|> List.iter (fun self ->
163+
Db.VM.set_scheduled_to_be_resident_on ~__context ~self ~value
164+
) ;
165+
Db.PCI.get_all ~__context
166+
|> List.iter (fun self ->
167+
Db.PCI.set_scheduled_to_be_attached_to ~__context ~self ~value
168+
) ;
169+
Db.VGPU.get_all ~__context
170+
|> List.iter (fun self ->
171+
Db.VGPU.set_scheduled_to_be_resident_on ~__context ~self ~value
172+
)
165173

166174
let create_tools_sr __context name_label name_description sr_introduce
167175
maybe_create_pbd =

0 commit comments

Comments
 (0)