Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA-392163 clear scheduled assignments on startup #5602

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions ocaml/xapi/dbsync_master.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,20 @@ let release_locks ~__context =
Xapi_vm_lifecycle.force_state_reset ~__context ~self ~value:`Halted
)
vms ;
(* All VMs should have their scheduled_to_be_resident_on field cleared *)
List.iter
(fun self ->
Db.VM.set_scheduled_to_be_resident_on ~__context ~self ~value:Ref.null
)
(Db.VM.get_all ~__context)
(* Clear all assignments that are only scheduled *)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand these scheduled_* fields are used only by the coordinator to remember something within XAPI calls. So it will be safe to clean all of these fields when the xapi on coordinator is in starting up, as at the moment no any xapi calls are in progress.

let value = Ref.null in
Db.VM.get_all ~__context
|> List.iter (fun self ->
Db.VM.set_scheduled_to_be_resident_on ~__context ~self ~value
) ;
Db.PCI.get_all ~__context
|> List.iter (fun self ->
Db.PCI.set_scheduled_to_be_attached_to ~__context ~self ~value
) ;
Db.VGPU.get_all ~__context
|> List.iter (fun self ->
Db.VGPU.set_scheduled_to_be_resident_on ~__context ~self ~value
)

let create_tools_sr __context name_label name_description sr_introduce
maybe_create_pbd =
Expand Down