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-373551: register for host events rather than task in events_from_xapi #4870

Merged
merged 2 commits into from
Dec 12, 2022
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
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_lifecycle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let prototyped_of_field = function
| "host", "last_software_update" ->
Some "22.20.0"
| "pool", "migration_compression" ->
Some "22.32.0-next"
Some "22.33.0"
| _ ->
None

Expand Down
13 changes: 6 additions & 7 deletions ocaml/xapi/xapi_xenops.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3207,10 +3207,9 @@ end
(* XXX: PR-1255: we also want to only listen for events on VMs and fields we care about *)
let events_from_xapi () =
let open Event_types in
Server_helpers.exec_with_new_task ~task_in_database:true "xapi events"
(fun __context ->
let task = Context.get_task_id __context |> Ref.string_of in
Server_helpers.exec_with_new_task "xapi events" (fun __context ->
let localhost = Helpers.get_localhost ~__context in
let localhost' = Ref.string_of localhost in
let token = ref "" in
let stop = ref false in
while not !stop do
Expand All @@ -3223,8 +3222,8 @@ let events_from_xapi () =
injection" ;
try
let _ =
XenAPI.Event.inject ~rpc ~session_id ~_class:"task"
~_ref:task
XenAPI.Event.inject ~rpc ~session_id ~_class:"host"
~_ref:localhost'
in
()
with e ->
Expand Down Expand Up @@ -3252,7 +3251,7 @@ let events_from_xapi () =
error "events_from_xapi: extra items in the cache: [ %s ]"
(String.concat "; " (StringSet.elements extra_in_cache)) ;
let classes =
Printf.sprintf "task/%s" task
Printf.sprintf "host/%s" localhost'
:: List.map
(fun x -> Printf.sprintf "VM/%s" (Ref.string_of x))
resident_VMs
Expand Down Expand Up @@ -3310,7 +3309,7 @@ let events_from_xapi () =
raise e
)
)
| {ty= "task"; reference= t; _} when t = task ->
| {ty= "host"; reference= t; _} when t = localhost' ->
debug
"Woken event thread: updating list of event \
subscriptions" ;
Expand Down