Skip to content

Commit

Permalink
Merge pull request #4870 from robhoes/master
Browse files Browse the repository at this point in the history
CA-373551: register for host events rather than task in events_from_xapi
  • Loading branch information
robhoes authored Dec 12, 2022
2 parents 4adbf80 + 6568cab commit 2784cf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
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

0 comments on commit 2784cf6

Please sign in to comment.