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

Update feature/perf from master #6167

Merged
merged 102 commits into from
Dec 10, 2024

Conversation

edwintorok
Copy link
Contributor

And solve conflicts.

The conflict resolution can be reviewed locally with this command if you have a new enough version of git:

git log --remerge-diff -1 81146d223d3d5cd449105ecef713cfd57e2c1853

The conflicts are mostly due to:

  • with_tracing being removed from the Http library
  • the xapi_periodic_scheduler being moved to xapi-stdext-threads
  • a slightly different version of the concurrent PR being merged between the 2 branches (vm instead of vm')

For convenience here is the output of that command:

commit 81146d223d3d5cd449105ecef713cfd57e2c1853
Merge: 59da2e0fdb d8baca7840
Author: Edwin Török <[email protected]>
Date:   Tue Dec 10 13:43:23 2024 +0000

    Merge master into feature/perf

    Fix conflicts in http.ml (with_tracing got moved),
    and periodic scheduler (got moved to xapi-stdext-threads).

    Signed-off-by: Edwin Török <[email protected]>

diff --git a/ocaml/libs/http-lib/http.ml b/ocaml/libs/http-lib/http.ml
remerge CONFLICT (content): Merge conflict in ocaml/libs/http-lib/http.ml
index ca635e2ba0..c979e1f7d9 100644
--- a/ocaml/libs/http-lib/http.ml
+++ b/ocaml/libs/http-lib/http.ml
@@ -132,16 +132,8 @@ module Hdr = struct

   let location = "location"

-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let originator = "originator"

-  let traceparent = "traceparent"
-
-||||||| 77dd47498e
-  let traceparent = "traceparent"
-
-=======
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
   let hsts = "strict-transport-security"
 end

@@ -684,7 +676,6 @@ module Request = struct
     let headers, body = to_headers_and_body x in
     let frame_header = if x.frame then make_frame_header headers else "" in
     frame_header ^ headers ^ body
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))

   let with_originator_of req f =
     Option.iter
@@ -693,55 +684,6 @@ module Request = struct
         f originator
       )
       req
-
-  let traceparent_of req =
-    let open Tracing in
-    let ( let* ) = Option.bind in
-    let* traceparent = req.traceparent in
-    let* span_context = SpanContext.of_traceparent traceparent in
-    let span = Tracer.span_of_span_context span_context req.uri in
-    Some span
-
-  let with_tracing ?attributes ~name req f =
-    let open Tracing in
-    let parent = traceparent_of req in
-    with_child_trace ?attributes parent ~name (fun (span : Span.t option) ->
-        match span with
-        | Some span ->
-            let traceparent =
-              Some (span |> Span.get_context |> SpanContext.to_traceparent)
-            in
-            let req = {req with traceparent} in
-            f req
-        | None ->
-            f req
-    )
-||||||| 77dd47498e
-
-  let traceparent_of req =
-    let open Tracing in
-    let ( let* ) = Option.bind in
-    let* traceparent = req.traceparent in
-    let* span_context = SpanContext.of_traceparent traceparent in
-    let span = Tracer.span_of_span_context span_context req.uri in
-    Some span
-
-  let with_tracing ?attributes ~name req f =
-    let open Tracing in
-    let parent = traceparent_of req in
-    with_child_trace ?attributes parent ~name (fun (span : Span.t option) ->
-        match span with
-        | Some span ->
-            let traceparent =
-              Some (span |> Span.get_context |> SpanContext.to_traceparent)
-            in
-            let req = {req with traceparent} in
-            f req
-        | None ->
-            f req
-    )
-=======
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
 end

 module Response = struct
diff --git a/ocaml/libs/http-lib/http.mli b/ocaml/libs/http-lib/http.mli
remerge CONFLICT (content): Merge conflict in ocaml/libs/http-lib/http.mli
index e77a9ebd5a..114ddbc4f4 100644
--- a/ocaml/libs/http-lib/http.mli
+++ b/ocaml/libs/http-lib/http.mli
@@ -126,22 +126,8 @@ module Request : sig

   val to_wire_string : t -> string
   (** [to_wire_string t] returns a string which could be sent to a server *)
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))

   val with_originator_of : t option -> (string option -> unit) -> unit
-
-  val traceparent_of : t -> Tracing.Span.t option
-
-  val with_tracing :
-    ?attributes:(string * string) list -> name:string -> t -> (t -> 'a) -> 'a
-||||||| 77dd47498e
-
-  val traceparent_of : t -> Tracing.Span.t option
-
-  val with_tracing :
-    ?attributes:(string * string) list -> name:string -> t -> (t -> 'a) -> 'a
-=======
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
 end

 (** Parsed form of the HTTP response *)
diff --git a/ocaml/tests/dune b/ocaml/tests/dune
index b51bbca8b8..ce8fe96c19 100644
--- a/ocaml/tests/dune
+++ b/ocaml/tests/dune
@@ -118,6 +118,7 @@
     xapi-types
     xapi-stdext-date
     xapi-stdext-threads
+    xapi-stdext-threads.scheduler
     xapi-stdext-unix
     xml-light2
     yojson
diff --git a/ocaml/tests/test_event.ml b/ocaml/tests/test_event.ml
index d36dba90ef..821bb3bb52 100644
--- a/ocaml/tests/test_event.ml
+++ b/ocaml/tests/test_event.ml
@@ -287,7 +287,7 @@ let test_short_oneshot () =
     started := true ;
     Condition.broadcast cond ;
     Mutex.unlock m ;
-    Xapi_periodic_scheduler.loop ()
+    Xapi_stdext_threads_scheduler.Scheduler.loop ()
   in
   ignore (Thread.create scheduler ()) ;
   (* ensure scheduler sees an empty queue , by waiting for it to start *)
@@ -303,8 +303,8 @@ let test_short_oneshot () =
   let fired = Atomic.make false in
   let fire () = Atomic.set fired true in
   let task = "test_oneshot" in
-  Xapi_periodic_scheduler.add_to_queue task Xapi_periodic_scheduler.OneShot 1.
-    fire ;
+  Xapi_stdext_threads_scheduler.Scheduler.add_to_queue task
+    Xapi_stdext_threads_scheduler.Scheduler.OneShot 1. fire ;
   Thread.delay 2. ;
   assert (Atomic.get fired)

diff --git a/ocaml/xapi-storage-script/main.ml b/ocaml/xapi-storage-script/main.ml
remerge CONFLICT (content): Merge conflict in ocaml/xapi-storage-script/main.ml
index 1ec4d9dcb1..cba7ec89d5 100644
--- a/ocaml/xapi-storage-script/main.ml
+++ b/ocaml/xapi-storage-script/main.ml
@@ -66,7 +66,6 @@ let backend_backtrace_error name args backtrace =
 let missing_uri () =
   backend_error "MISSING_URI" ["Please include a URI in the device-config"]

-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
 (** return a unique 'domain' string for Dom0, so that we can plug disks
   multiple times (e.g. for copy).

@@ -84,26 +83,6 @@ let domain_of ~dp ~vm =
   | _ ->
       vm

-||||||| 77dd47498e
-=======
-(** return a unique 'domain' string for Dom0, so that we can plug disks
-  multiple times (e.g. for copy).
-
-  XAPI should give us a unique 'dp' (datapath) string, e.g. a UUID for storage migration,
-  or vbd/domid/device.
-  For regular guests keep the domain as passed by XAPI (an integer).
- *)
-let domain_of ~dp ~vm' =
-  let vm = Storage_interface.Vm.string_of vm' in
-  match vm with
-  | "0" ->
-      (* SM tries to use this in filesystem paths, so cannot have /,
-         and systemd might be a bit unhappy with - *)
-      "u0-" ^ dp |> String.map (function '/' | '-' -> '_' | c -> c)
-  | _ ->
-      vm
-
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
 (** Functions to wrap calls to the above client modules and convert their
     exceptions and errors into SMAPIv2 errors of type
     [Storage_interface.Exception.exnty]. The above client modules should only
@@ -1476,21 +1455,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.introduce vdi_introduce_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_attach3_impl dbg dp sr vdi' vm _readwrite =
-||||||| 77dd47498e
-  let vdi_attach3_impl dbg _dp sr vdi' vm' _readwrite =
-=======
-  let vdi_attach3_impl dbg dp sr vdi' vm' _readwrite =
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd47498e
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
      vdi_attach_common dbg sr vdi domain >>>= fun response ->
      let convert_implementation = function
        | Xapi_storage.Data.XenDisk {params; extra; backend_type} ->
@@ -1512,21 +1479,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.attach3 vdi_attach3_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_activate_common dbg dp sr vdi' vm readonly =
-||||||| 77dd47498e
-  let vdi_activate_common dbg sr vdi' vm' readonly =
-=======
-  let vdi_activate_common dbg dp sr vdi' vm' readonly =
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd47498e
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1551,45 +1506,17 @@ let bind ~volume_script_dir =
     )
     |> wrap
   in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_activate3_impl dbg dp sr vdi' vm =
     vdi_activate_common dbg dp sr vdi' vm false
-||||||| 77dd47498e
-  let vdi_activate3_impl dbg _dp sr vdi' vm' =
-    vdi_activate_common dbg sr vdi' vm' false
-=======
-  let vdi_activate3_impl dbg dp sr vdi' vm' =
-    vdi_activate_common dbg dp sr vdi' vm' false
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
   in
   S.VDI.activate3 vdi_activate3_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_activate_readonly_impl dbg dp sr vdi' vm =
     vdi_activate_common dbg dp sr vdi' vm true
-||||||| 77dd47498e
-  let vdi_activate_readonly_impl dbg _dp sr vdi' vm' =
-    vdi_activate_common dbg sr vdi' vm' true
-=======
-  let vdi_activate_readonly_impl dbg dp sr vdi' vm' =
-    vdi_activate_common dbg dp sr vdi' vm' true
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
   in
   S.VDI.activate_readonly vdi_activate_readonly_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_deactivate_impl dbg dp sr vdi' vm =
-||||||| 77dd47498e
-  let vdi_deactivate_impl dbg _dp sr vdi' vm' =
-=======
-  let vdi_deactivate_impl dbg dp sr vdi' vm' =
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd47498e
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1610,21 +1537,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.deactivate vdi_deactivate_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let vdi_detach_impl dbg dp sr vdi' vm =
-||||||| 77dd47498e
-  let vdi_detach_impl dbg _dp sr vdi' vm' =
-=======
-  let vdi_detach_impl dbg dp sr vdi' vm' =
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd47498e
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1732,21 +1647,9 @@ let bind ~volume_script_dir =
   S.VDI.epoch_end vdi_epoch_end_impl ;
   let vdi_set_persistent_impl _dbg _sr _vdi _persistent = return () |> wrap in
   S.VDI.set_persistent vdi_set_persistent_impl ;
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let dp_destroy2 dbg dp sr vdi' vm _allow_leak =
-||||||| 77dd47498e
-  let dp_destroy2 dbg _dp sr vdi' vm' _allow_leak =
-=======
-  let dp_destroy2 dbg dp sr vdi' vm' _allow_leak =
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd47498e
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1888,17 +1791,7 @@ let rec diff a b =
   | a :: aa ->
       if List.mem a b then diff aa b else a :: diff aa b

-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
 let concurrent = ref true
-||||||| 77dd47498e
-(* default false due to bugs in SMAPIv3 plugins,
-   once they are fixed this should be set to true *)
-let concurrent = ref false
-=======
-(* default false due to bugs in SMAPIv3 plugins,
-   once they are fixed this should be set to true *)
-let concurrent = ref true
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))

 type reload = All | Files of string list | Nothing

diff --git a/ocaml/xapi/helpers.ml b/ocaml/xapi/helpers.ml
remerge CONFLICT (content): Merge conflict in ocaml/xapi/helpers.ml
index ca57afb8d8..1175b6aa03 100644
--- a/ocaml/xapi/helpers.ml
+++ b/ocaml/xapi/helpers.ml
@@ -410,20 +410,14 @@ let make_rpc ~__context rpc : Rpc.response =
   let subtask_of = Ref.string_of (Context.get_task_id __context) in
   let open Xmlrpc_client in
   let tracing = Context.set_client_span __context in
-<<<<<<< 59da2e0fdb (CA-388564: move qemu-dm to vm.slice (#6150))
   let dorpc, path =
     if !Xapi_globs.use_xmlrpc then
       (XMLRPC_protocol.rpc, "/")
     else
       (JSONRPC_protocol.rpc, "/jsonrpc")
   in
-  let http = xmlrpc ~subtask_of ~version:"1.1" path ~tracing in
-||||||| 77dd47498e
-  let http = xmlrpc ~subtask_of ~version:"1.1" "/" ~tracing in
-=======
-  let http = xmlrpc ~subtask_of ~version:"1.1" "/" in
+  let http = xmlrpc ~subtask_of ~version:"1.1" path in
   let http = TraceHelper.inject_span_into_req tracing http in
->>>>>>> d8baca7840 (CA-390025: do not override SR's client-set metadata on update  (#6165))
   let transport =
     if Pool_role.is_master () then
       Unix Xapi_globs.unix_domain_socket
diff --git a/ocaml/xapi/xapi_periodic_scheduler_init.ml b/ocaml/xapi/xapi_periodic_scheduler_init.ml
index 6300f89db2..1bd13d5f6d 100644
--- a/ocaml/xapi/xapi_periodic_scheduler_init.ml
+++ b/ocaml/xapi/xapi_periodic_scheduler_init.ml
@@ -129,9 +129,10 @@ let register ~__context =
       )
   ) ;
   let stunnel_period = !Stunnel_cache.max_idle /. 2. in
-  Xapi_periodic_scheduler.add_to_queue "Check stunnel cache expiry"
-    (Xapi_periodic_scheduler.Periodic stunnel_period) stunnel_period
-    Stunnel_cache.gc ;
+  Xapi_stdext_threads_scheduler.Scheduler.add_to_queue
+    "Check stunnel cache expiry"
+    (Xapi_stdext_threads_scheduler.Scheduler.Periodic stunnel_period)
+    stunnel_period Stunnel_cache.gc ;
   if
     master
     && Db.Pool.get_update_sync_enabled ~__context

danilo-delbusso and others added 30 commits October 1, 2024 11:25
This enables extending the type without causing performance issues,
and should reduce the work for the garbage collector.

Signed-off-by: Edwin Török <[email protected]>
Instead of getting one timestamp for all collectors, get them closer to the
actual measurement time.

Signed-off-by: Andrii Sultanov <[email protected]>
Instead of timestamps taken at read time in xcp-rrdd, propagate timestamps
taken by plugins (or collectors in xcp-rrdd itself) and use these when
updating values.

Also process datasources without flattening them all into one list.

This allows to process datasources with the same timestamp (provided by the
plugin or dom0 collector in xcp_rrdd) at once.

Co-authored-by: Edwin Török <[email protected]>
Signed-off-by: Edwin Török <[email protected]>
Signed-off-by: Andrii Sultanov <[email protected]>
RRDs can have different owners, and new ones can show up without new domids
being involved (SRs, VMs are also owner types).

Signed-off-by: Andrii Sultanov <[email protected]>
ds_update* functions previously relied on being called for the entirety of
datasources of a certain RRD. Instead, operate on chunks of datasources
provided by the same plugin. These chunks are not contiguous (more detailed
explanation in the comments in the code), so indices to rrd_dss and the
associated structures need to be carried with each datasource.

Also turns the value*transform tuple into a type for more explicit accesses.

Signed-off-by: Andrii Sultanov <[email protected]>
…and archiving

This ensures that the interval between the current timestamp and previous
update is calculated correctly.

Keep the same external interface through rrdd_http_handler by adding an
'internal' parameter to xml exporting functions.

Signed-off-by: Andrii Sultanov <[email protected]>
Add an "unsafe" version of rrd_add_ds to avoid checking if the datasource
already exists twice.

Signed-off-by: Andrii Sultanov <[email protected]>
…m explicitly

If RRD's datasource disappears and is not reported by the plugin (or collected
by xcp-rrdd), then it's not going to be refreshed, keeping its old value and
timestamp. Previously, this was handled nicely because the whole RRD was
updated at once, and updates were defaulted to VT_Unknown, Identity before
being assigned actually collected values. After RRD collection was changed to
process datasources in chunks per source, we need to explicitly find the ones
that weren't updated on this iteration, and explicitly reset them.

(This is not just a theoretical exercise, it can happen when a VIF gets
unplugged or destroyed, for example, with its stats not being reset and
continuing to display old values)

Signed-off-by: Andrii Sultanov <[email protected]>
Instead of writing Int64 (truncated from timestamp floats) into the
memory-mapped files, keep the precision of the timestamp.

Signed-off-by: Andrii Sultanov <[email protected]>
RRDD, aside from the OCaml library, exposes two interfaces. This changes the
Python one. The C one lives in rrd-client-lib and needs to be changed at the
same time and coordinated during updating.

Signed-off-by: Andrii Sultanov <[email protected]>
When a host starts, the systemd service xapi-wait-init-complete waiting
on the creation of the xapi init cookie file may fail on timeout for a
matter of seconds. This patch adds 1 minute (300 seconds total) to the
timeout passed to the script xapi-wait-init-complete.

Signed-off-by: Thierry Escande <[email protected]>
Without the change, the tests only pass when running on a runner with UTC as a timezone

Signed-off-by: Danilo Del Busso <[email protected]>
Previously the SM feature check was done in two parts, fetch all the SM
ref from the coordinator, and then fetch their information such as types
and features from the coordinator basedon the refs. This can cause race
conditions, where the previously fetched refs might have been deleted
when we fetch the SM features. The deletion might happen due to the way
SM registeration works for shared SRs such as GFS2, where each
`PBD.plug` will trigger a deregister of existing SM and re-register
(which will delete existing SMs), and create another (very likely) identical
SM.

To avoid this race, instead of fetch SM refs and their features
separately, do this in one go so we get a consistent snapshot of the db
state.

Also add a bit more debugging messages.

Signed-off-by: Vincent Liu <[email protected]>
Bake in assumptions that have been constant ever since xenstore was created:
getdomainpath always returns "/local/domain/<domid>", /local/domain/domid/vm
returns "/vm/<uuid>", so there's no need to look up that path to get the uuid
again

This reduces the number of xenstore accesses from 3 to 1 with no functional
change.

As suggested in: xapi-project#6068 (review)

Signed-off-by: Andrii Sultanov <[email protected]>
…pi-project#6127)

Previously the SM feature check was done in two parts, fetch all the SM
ref from the coordinator, and then fetch their information such as types
and features from the coordinator basedon the refs. This can cause race
conditions, where the previously fetched refs might have been deleted
when we fetch the SM features. The deletion might happen due to the way
SM registeration works for shared SRs such as GFS2, where each
`PBD.plug` will trigger a deregister of existing SM and re-register
(which will delete existing SMs), and create another (very likely)
identical SM.

To avoid this race, instead of fetch SM refs and their features
separately, do this in one go so we get a consistent snapshot of the db
state.
Completes the 15+ years old TODO, at the expense of removing an ultimate
example of a "not invented here" attitude.

Signed-off-by: Andrii Sultanov <[email protected]>
Issue an alert about a broken host kernel if bits 4, 5, 7, 9, or 14 are set in
/proc/sys/kernel/tainted, indicating some kind of error was encountered and the
future behaviour of the kernel might not be predictable or safe anymore (though
it generally should reasonably recover).

Only one alert per tainted bit per boot can be present (more than one can be
issued, if the user dismissed the alerts and restarted the toolstack).

Distinguish between Major (4,5,7 - these are all things that might cause a
host crash, but are unlikely to corrupt whatever data has been written out) and
Warning (9, 14 - might be a concern and could be raised to Support but usually
are not severe enough to crash the host) levels of errors as
suggested by the Foundations team.

This should serve as an indicator during issue investigation to look for the
cause of the taint.

Signed-off-by: Andrii Sultanov <[email protected]>
The manual notes that `Lazy.from_fun` "should only be used if the function f
is already defined. In particular it is always less efficient to write
`from_fun (fun () -> expr)` than `lazy expr`.

So, replace `Lazy.from_fun` with `lazy` in this particular case

Compare the lambda dump for `lazy (fun () -> [| 1;2;3 |] |> Array.map (fun x -> x+1))`:
```
(seq
  (let
    (l/269 =
       (function param/319[int]
         (apply (field_imm 12 (global Stdlib__Array!))
           (function x/318[int] : int (+ x/318 1)) (makearray[int] 1 2 3))))
    (setfield_ptr(root-init) 0 (global Main!) l/269))
  0)
```

with the lambda dump of the `let x = Lazy.from_fun (fun () -> [| 1;2;3 |] |>
Array.map (fun x -> x+1))`:
```
(seq
  (let
    (x/269 =
       (apply (field_imm 5 (global Stdlib__Lazy!))
         (function param/332[int]
           (apply (field_imm 12 (global Stdlib__Array!))
             (function x/331[int] : int (+ x/331 1)) (makearray[int] 1 2 3)))))
    (setfield_ptr(root-init) 0 (global Main!) x/269))
  0)
```

See: https://patricoferris.github.io/js_of_ocamlopt/#code=bGV0IGwgPSBsYXp5IChmdW4gKCkgLT4gW3wgMTsyOzMgfF0gfD4gQXJyYXkubWFwIChmdW4geCAtPiB4KzEpKQoKbGV0IHggPSBMYXp5LmZyb21fZnVuIChmdW4gKCkgLT4gW3wgMTsyOzMgfF0gfD4gQXJyYXkubWFwIChmdW4geCAtPiB4KzEpKQ%3D%3D

Signed-off-by: Andrii Sultanov <[email protected]>
A module binding appeared to be unused but was being evaluated for its
effect alone. We reintroduce it here and don't bind a name.

Signed-off-by: Colin James <[email protected]>
A module binding appeared to be unused but was being evaluated for its
effect alone. We reintroduce it here and don't bind a name.
last-genius and others added 25 commits December 4, 2024 10:25
`xcp-rrdd` used to ignore timestamps of measurement times provided by
the RRDD plugins, and always calculated change in all values against a
single timestamp captured at the time of reading on the server. This can
potentially trigger a case where the time that passed between
measurements is not equal to the time that passed between readings (or
other measurements), and values would be calculated incorrectly. This
can be triggered on a host with 100% CPU load, where `cpu0-P0` derived
metric, for example, would often be > 1.0.

This PR reworks `xcp-rrdd` and the plugin infrastructure to calculate
values based on the actual length of time passed since the last value
for this particular metric was recorded. This required extensive
architectural changes, explained in detail in commits themselves - *so
best reviewed by commit*.

I've tested this over the weekend, and haven't registered any spikes in
metrics on a fully-loaded host. Will run BST+BVT as well, since RRDD is
at the center of a lot of other things and is quite fragile.
…#6134)

### NUMA docs: Fix typos and simplify some parts

Hi, in this PR for
https://xapi-project.github.io/new-docs/toolstack/features/NUMA/index.html,
I'd like to:
- Add more sections to improve the document structure
- Fix a few typos
- Simplify some parts
Signed-off-by: Rob Hoes <[email protected]>
This appears to be entirely unused.
Recent changes to Http_client were made to log errors and backtraces in
case of unusual errors, in order to better diagnose problems.
Unfortunately, this also led to benign exceptions being logged, which
caused people to suspect problems where the exception was actually
"expected". In particular the following error started appearing in the
logs many times:

    Raised Http_client.Parse_error("Expected initial header []")

The case here is that the client has sent an HTTP request, but the
server disconnects before sending a response.

It turns out that this happens commonly when an external connection is
received by xapi and handed over to another process, such as xcp-rrdd.
The connection's file descriptor is passed to the other process, and the
original HTTP request is forwarded over a local socket. The other process
continues to handle the request and sends responses to the forwarded
socket, but never to the local socket, where xapi is waiting for the
response.

This is a quick change that makes the caller of the receive function
aware that no response was sent, without logging scary errors, to fix
the immediate problem. In addition, we should enhance the handover
process to actually send responses, although funcionally this is not an
issue.

Signed-off-by: Rob Hoes <[email protected]>
As per the new design, we are no longer telling user that their
cluster stack version is out of date, since the corosync upgrade will be
part of the compulsory actions enforced by XC upgrade wizard and the
host installer.

Signed-off-by: Vincent Liu <[email protected]>
Recent changes to Http_client were made to log errors and backtraces in
case of unusual errors, in order to better diagnose problems.
Unfortunately, this also led to benign exceptions being logged, which
caused people to suspect problems where the exception was actually
"expected". In particular the following error started appearing in the
logs many times:

    Raised Http_client.Parse_error("Expected initial header []")

The case here is that the client has sent an HTTP request, but the
server disconnects before sending a response.

It turns out that this happens commonly when an external connection is
received by xapi and handed over to another process, such as xcp-rrdd.
The connection's file descriptor is passed to the other process, and the
original HTTP request is forwarded over a local socket. The other
process continues to handle the request and sends responses to the
forwarded socket, but never to the local socket, where xapi is waiting
for the response.

This is a quick change that makes the caller of the receive function
aware that no response was sent, without logging scary errors, to fix
the immediate problem. In addition, we should enhance the handover
process to actually send responses, although funcionally this is not an
issue.
Old implementation had different issues.
Just use mutexes and conditions using C stubs.
Current Ocaml Condition module does not have support for timeout waiting
for conditions, so use C stubs.
This implementation does not require opening a pipe.
This reduces the possibilities of errors calling "wait" to zero.
Mostly of the times it does not require kernel calls.

Signed-off-by: Frediano Ziglio <[email protected]>
Default empty allowed_operations on a cloned VBD means that XenCenter
does not display the DVD option in the console tab for VMs cloned from
templates, for example.

Follow the practice in xapi_vbd, and update_allowed_operations immediately
after Db.VBD.create.

Signed-off-by: Andrii Sultanov <[email protected]>
Previously a `CLUSTER_STACK_OUT_OF_DATE` is rasied when the user is
running corosync 2 as the cluster stack, while corosync3 is available on
the system. This is to nag people to upgrade their cluster stack to
corosync 3, on XS 9.

As per the new design, we are no longer telling user that their cluster
stack version is out of date, since the corosync upgrade will be part of
the compulsory actions enforced by XC upgrade wizard and the host
installer.
… during sync_updates (xapi-project#6137)

The new version of yum-utils introduced to xenserver enhances the
--download-metadata functionality to align with **dnf reposync** (refer
to: https://dnf-plugins-core.readthedocs.io/en/latest/reposync.html) by
fully downloading repository metadata.
Consequently, _create_pool_repository_ is no longer required.
The PR introduces a check to verify whether the **repodata** already
exists before proceeding to create repository metadata.
…6159)

Default empty `allowed_operations` on a cloned VBD means that XenCenter
does not display the DVD option in the console tab for VMs cloned from
templates, for example.

Follow the practice in `xapi_vbd`, and `update_allowed_operations`
immediately after `Db.VBD.create`.

---

I've tested this fix and XC displays the ISO selection on the cloned VM
now, and allowed operations on the cloned VBDs are correct as well.
In some environments the time ranges checked are too strict causing test to
fail.
Previously the maximum error accepted was 10 ms, increase to 50 ms.
Also increase timeouts to reduce error/value ratio.

Signed-off-by: Frediano Ziglio <[email protected]>
Old implementation had different issues.
Just use mutexes and conditions using C stubs.
Current Ocaml Condition module does not have support for timeout waiting
for conditions, so use C stubs.
This implementation does not require opening a pipe. This reduces the
possibilities of errors calling "wait" to zero. Mostly of the times it
does not require kernel calls.
When a host starts, the systemd service xapi-wait-init-complete waiting
on the creation of the xapi init cookie file may fail on timeout for a
matter of seconds. This patch adds 1 minute (300 seconds total) to the
timeout passed to the script xapi-wait-init-complete.
In some environments the time ranges checked are too strict causing test
to fail.
Previously the maximum error accepted was 10 ms, increase to 50 ms.
Also increase timeouts to reduce error/value ratio.
Some plugins may not store the client-set metadata, and return a static value
when replying to the update. This would override the values that a client
used when the SR was created, or set afterwards, which is unexpected.

Now name_label and name_description fields returned by the plugins are ignored
on update.

Current set_name_label and set_name_description rely on the update mechanism to
work. Instead add database call at the end of the methods to ensure both xapi
and the SR backend are synchronized, even when the latter fails to update the
values.

Signed-off-by: Pau Ruiz Safont <[email protected]>
Though the majority of completions were already using set_completions and the
like to add completion suggestions, there were two leftovers still needlessly
changing COMPREPLY themselves. This caused bugs, as in the case of

xe vm-import filename=<TAB>

autocompleting all of the filenames into the prompt instead of presenting
the choice. Let only these functions operate on COMPREPLY directly.

Signed-off-by: Andrii Sultanov <[email protected]>
**xe-cli completion: Use grep -E instead of egrep**

Otherwise newer packages in XS9 issue
"egrep: warning: egrep is obsolescent; using grep -E"
warnings all over the place

---

**xe-cli completion: Hide COMPREPLY manipulation behind functions**

Though the majority of completions were already using set_completions
and the
like to add completion suggestions, there were two leftovers still
needlessly
changing COMPREPLY themselves. This caused bugs, as in the case of

`xe vm-import filename=<TAB>`

autocompleting all of the filenames into the prompt instead of
presenting
the choice. Let only these functions operate on COMPREPLY directly.
…roject#6165)

Some plugins may not store the client-set metadata, and return a static
value
when replying to the update. This would override the values that a
client
used when the SR was created, or set afterwards, which is unexpected.

Now name_label and name_description fields returned by the plugins are
ignored
on update.

Current set_name_label and set_name_description rely on the update
mechanism to
work. Instead, add database call at the end of the methods to ensure
both xapi
and the SR backend are synchronized, even when the latter fails to
update the
values.

Tested on GFS2 tests (JR 4175192), as well as ring3 bvt + bst (209177),
and storage validation tests (SR 209180)
Fix conflicts in http.ml (with_tracing got moved),
and periodic scheduler (got moved to xapi-stdext-threads).

The conflict resolution can be reviewed with a recent version of git:
```
git log --remerge-diff -1 81146d223d3d5cd449105ecef713cfd57e2c1853
```

Signed-off-by: Edwin Török <[email protected]>
@edwintorok edwintorok merged commit ce5abab into xapi-project:feature/perf Dec 10, 2024
15 checks passed
edwintorok added a commit to edwintorok/xen-api that referenced this pull request Dec 10, 2024
And solve conflicts.

The conflict resolution can be reviewed locally with this command if you
have a new enough version of `git`:
```
git log --remerge-diff -1 81146d223d3d5cd449105ecef713cfd57e2c1853
```

The conflicts are mostly due to:
* with_tracing being removed from the Http library
* the xapi_periodic_scheduler being moved to xapi-stdext-threads
* a slightly different version of the concurrent PR being merged between
the 2 branches (`vm` instead of `vm'`)

For convenience here is the output of that command:
```diff
commit 81146d223d3d5cd449105ecef713cfd57e2c1853
Merge: 59da2e0 d8baca7
Author: Edwin Török <[email protected]>
Date:   Tue Dec 10 13:43:23 2024 +0000

    Merge master into feature/perf

    Fix conflicts in http.ml (with_tracing got moved),
    and periodic scheduler (got moved to xapi-stdext-threads).

    Signed-off-by: Edwin Török <[email protected]>

diff --git a/ocaml/libs/http-lib/http.ml b/ocaml/libs/http-lib/http.ml
remerge CONFLICT (content): Merge conflict in ocaml/libs/http-lib/http.ml
index ca635e2ba0..c979e1f7d9 100644
--- a/ocaml/libs/http-lib/http.ml
+++ b/ocaml/libs/http-lib/http.ml
@@ -132,16 +132,8 @@ module Hdr = struct

   let location = "location"

-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let originator = "originator"

-  let traceparent = "traceparent"
-
-||||||| 77dd474
-  let traceparent = "traceparent"
-
-=======
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
   let hsts = "strict-transport-security"
 end

@@ -684,7 +676,6 @@ module Request = struct
     let headers, body = to_headers_and_body x in
     let frame_header = if x.frame then make_frame_header headers else "" in
     frame_header ^ headers ^ body
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))

   let with_originator_of req f =
     Option.iter
@@ -693,55 +684,6 @@ module Request = struct
         f originator
       )
       req
-
-  let traceparent_of req =
-    let open Tracing in
-    let ( let* ) = Option.bind in
-    let* traceparent = req.traceparent in
-    let* span_context = SpanContext.of_traceparent traceparent in
-    let span = Tracer.span_of_span_context span_context req.uri in
-    Some span
-
-  let with_tracing ?attributes ~name req f =
-    let open Tracing in
-    let parent = traceparent_of req in
-    with_child_trace ?attributes parent ~name (fun (span : Span.t option) ->
-        match span with
-        | Some span ->
-            let traceparent =
-              Some (span |> Span.get_context |> SpanContext.to_traceparent)
-            in
-            let req = {req with traceparent} in
-            f req
-        | None ->
-            f req
-    )
-||||||| 77dd474
-
-  let traceparent_of req =
-    let open Tracing in
-    let ( let* ) = Option.bind in
-    let* traceparent = req.traceparent in
-    let* span_context = SpanContext.of_traceparent traceparent in
-    let span = Tracer.span_of_span_context span_context req.uri in
-    Some span
-
-  let with_tracing ?attributes ~name req f =
-    let open Tracing in
-    let parent = traceparent_of req in
-    with_child_trace ?attributes parent ~name (fun (span : Span.t option) ->
-        match span with
-        | Some span ->
-            let traceparent =
-              Some (span |> Span.get_context |> SpanContext.to_traceparent)
-            in
-            let req = {req with traceparent} in
-            f req
-        | None ->
-            f req
-    )
-=======
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
 end

 module Response = struct
diff --git a/ocaml/libs/http-lib/http.mli b/ocaml/libs/http-lib/http.mli
remerge CONFLICT (content): Merge conflict in ocaml/libs/http-lib/http.mli
index e77a9ebd5a..114ddbc4f4 100644
--- a/ocaml/libs/http-lib/http.mli
+++ b/ocaml/libs/http-lib/http.mli
@@ -126,22 +126,8 @@ module Request : sig

   val to_wire_string : t -> string
   (** [to_wire_string t] returns a string which could be sent to a server *)
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))

   val with_originator_of : t option -> (string option -> unit) -> unit
-
-  val traceparent_of : t -> Tracing.Span.t option
-
-  val with_tracing :
-    ?attributes:(string * string) list -> name:string -> t -> (t -> 'a) -> 'a
-||||||| 77dd474
-
-  val traceparent_of : t -> Tracing.Span.t option
-
-  val with_tracing :
-    ?attributes:(string * string) list -> name:string -> t -> (t -> 'a) -> 'a
-=======
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
 end

 (** Parsed form of the HTTP response *)
diff --git a/ocaml/tests/dune b/ocaml/tests/dune
index b51bbca8b8..ce8fe96c19 100644
--- a/ocaml/tests/dune
+++ b/ocaml/tests/dune
@@ -118,6 +118,7 @@
     xapi-types
     xapi-stdext-date
     xapi-stdext-threads
+    xapi-stdext-threads.scheduler
     xapi-stdext-unix
     xml-light2
     yojson
diff --git a/ocaml/tests/test_event.ml b/ocaml/tests/test_event.ml
index d36dba90ef..821bb3bb52 100644
--- a/ocaml/tests/test_event.ml
+++ b/ocaml/tests/test_event.ml
@@ -287,7 +287,7 @@ let test_short_oneshot () =
     started := true ;
     Condition.broadcast cond ;
     Mutex.unlock m ;
-    Xapi_periodic_scheduler.loop ()
+    Xapi_stdext_threads_scheduler.Scheduler.loop ()
   in
   ignore (Thread.create scheduler ()) ;
   (* ensure scheduler sees an empty queue , by waiting for it to start *)
@@ -303,8 +303,8 @@ let test_short_oneshot () =
   let fired = Atomic.make false in
   let fire () = Atomic.set fired true in
   let task = "test_oneshot" in
-  Xapi_periodic_scheduler.add_to_queue task Xapi_periodic_scheduler.OneShot 1.
-    fire ;
+  Xapi_stdext_threads_scheduler.Scheduler.add_to_queue task
+    Xapi_stdext_threads_scheduler.Scheduler.OneShot 1. fire ;
   Thread.delay 2. ;
   assert (Atomic.get fired)

diff --git a/ocaml/xapi-storage-script/main.ml b/ocaml/xapi-storage-script/main.ml
remerge CONFLICT (content): Merge conflict in ocaml/xapi-storage-script/main.ml
index 1ec4d9dcb1..cba7ec89d5 100644
--- a/ocaml/xapi-storage-script/main.ml
+++ b/ocaml/xapi-storage-script/main.ml
@@ -66,7 +66,6 @@ let backend_backtrace_error name args backtrace =
 let missing_uri () =
   backend_error "MISSING_URI" ["Please include a URI in the device-config"]

-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
 (** return a unique 'domain' string for Dom0, so that we can plug disks
   multiple times (e.g. for copy).

@@ -84,26 +83,6 @@ let domain_of ~dp ~vm =
   | _ ->
       vm

-||||||| 77dd474
-=======
-(** return a unique 'domain' string for Dom0, so that we can plug disks
-  multiple times (e.g. for copy).
-
-  XAPI should give us a unique 'dp' (datapath) string, e.g. a UUID for storage migration,
-  or vbd/domid/device.
-  For regular guests keep the domain as passed by XAPI (an integer).
- *)
-let domain_of ~dp ~vm' =
-  let vm = Storage_interface.Vm.string_of vm' in
-  match vm with
-  | "0" ->
-      (* SM tries to use this in filesystem paths, so cannot have /,
-         and systemd might be a bit unhappy with - *)
-      "u0-" ^ dp |> String.map (function '/' | '-' -> '_' | c -> c)
-  | _ ->
-      vm
-
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
 (** Functions to wrap calls to the above client modules and convert their
     exceptions and errors into SMAPIv2 errors of type
     [Storage_interface.Exception.exnty]. The above client modules should only
@@ -1476,21 +1455,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.introduce vdi_introduce_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_attach3_impl dbg dp sr vdi' vm _readwrite =
-||||||| 77dd474
-  let vdi_attach3_impl dbg _dp sr vdi' vm' _readwrite =
-=======
-  let vdi_attach3_impl dbg dp sr vdi' vm' _readwrite =
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd474
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
      vdi_attach_common dbg sr vdi domain >>>= fun response ->
      let convert_implementation = function
        | Xapi_storage.Data.XenDisk {params; extra; backend_type} ->
@@ -1512,21 +1479,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.attach3 vdi_attach3_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_activate_common dbg dp sr vdi' vm readonly =
-||||||| 77dd474
-  let vdi_activate_common dbg sr vdi' vm' readonly =
-=======
-  let vdi_activate_common dbg dp sr vdi' vm' readonly =
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd474
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1551,45 +1506,17 @@ let bind ~volume_script_dir =
     )
     |> wrap
   in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_activate3_impl dbg dp sr vdi' vm =
     vdi_activate_common dbg dp sr vdi' vm false
-||||||| 77dd474
-  let vdi_activate3_impl dbg _dp sr vdi' vm' =
-    vdi_activate_common dbg sr vdi' vm' false
-=======
-  let vdi_activate3_impl dbg dp sr vdi' vm' =
-    vdi_activate_common dbg dp sr vdi' vm' false
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
   in
   S.VDI.activate3 vdi_activate3_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_activate_readonly_impl dbg dp sr vdi' vm =
     vdi_activate_common dbg dp sr vdi' vm true
-||||||| 77dd474
-  let vdi_activate_readonly_impl dbg _dp sr vdi' vm' =
-    vdi_activate_common dbg sr vdi' vm' true
-=======
-  let vdi_activate_readonly_impl dbg dp sr vdi' vm' =
-    vdi_activate_common dbg dp sr vdi' vm' true
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
   in
   S.VDI.activate_readonly vdi_activate_readonly_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_deactivate_impl dbg dp sr vdi' vm =
-||||||| 77dd474
-  let vdi_deactivate_impl dbg _dp sr vdi' vm' =
-=======
-  let vdi_deactivate_impl dbg dp sr vdi' vm' =
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd474
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1610,21 +1537,9 @@ let bind ~volume_script_dir =
     |> wrap
   in
   S.VDI.deactivate vdi_deactivate_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let vdi_detach_impl dbg dp sr vdi' vm =
-||||||| 77dd474
-  let vdi_detach_impl dbg _dp sr vdi' vm' =
-=======
-  let vdi_detach_impl dbg dp sr vdi' vm' =
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd474
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1732,21 +1647,9 @@ let bind ~volume_script_dir =
   S.VDI.epoch_end vdi_epoch_end_impl ;
   let vdi_set_persistent_impl _dbg _sr _vdi _persistent = return () |> wrap in
   S.VDI.set_persistent vdi_set_persistent_impl ;
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let dp_destroy2 dbg dp sr vdi' vm _allow_leak =
-||||||| 77dd474
-  let dp_destroy2 dbg _dp sr vdi' vm' _allow_leak =
-=======
-  let dp_destroy2 dbg dp sr vdi' vm' _allow_leak =
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
     (let vdi = Storage_interface.Vdi.string_of vdi' in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
      let domain = domain_of ~dp ~vm in
-||||||| 77dd474
-     let domain = Storage_interface.Vm.string_of vm' in
-=======
-     let domain = domain_of ~dp ~vm' in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
      Attached_SRs.find sr >>>= fun sr ->
      (* Discover the URIs using Volume.stat *)
      stat ~dbg ~sr ~vdi >>>= fun response ->
@@ -1888,17 +1791,7 @@ let rec diff a b =
   | a :: aa ->
       if List.mem a b then diff aa b else a :: diff aa b

-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
 let concurrent = ref true
-||||||| 77dd474
-(* default false due to bugs in SMAPIv3 plugins,
-   once they are fixed this should be set to true *)
-let concurrent = ref false
-=======
-(* default false due to bugs in SMAPIv3 plugins,
-   once they are fixed this should be set to true *)
-let concurrent = ref true
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))

 type reload = All | Files of string list | Nothing

diff --git a/ocaml/xapi/helpers.ml b/ocaml/xapi/helpers.ml
remerge CONFLICT (content): Merge conflict in ocaml/xapi/helpers.ml
index ca57afb8d8..1175b6aa03 100644
--- a/ocaml/xapi/helpers.ml
+++ b/ocaml/xapi/helpers.ml
@@ -410,20 +410,14 @@ let make_rpc ~__context rpc : Rpc.response =
   let subtask_of = Ref.string_of (Context.get_task_id __context) in
   let open Xmlrpc_client in
   let tracing = Context.set_client_span __context in
-<<<<<<< 59da2e0 (CA-388564: move qemu-dm to vm.slice (xapi-project#6150))
   let dorpc, path =
     if !Xapi_globs.use_xmlrpc then
       (XMLRPC_protocol.rpc, "/")
     else
       (JSONRPC_protocol.rpc, "/jsonrpc")
   in
-  let http = xmlrpc ~subtask_of ~version:"1.1" path ~tracing in
-||||||| 77dd474
-  let http = xmlrpc ~subtask_of ~version:"1.1" "/" ~tracing in
-=======
-  let http = xmlrpc ~subtask_of ~version:"1.1" "/" in
+  let http = xmlrpc ~subtask_of ~version:"1.1" path in
   let http = TraceHelper.inject_span_into_req tracing http in
->>>>>>> d8baca7 (CA-390025: do not override SR's client-set metadata on update  (xapi-project#6165))
   let transport =
     if Pool_role.is_master () then
       Unix Xapi_globs.unix_domain_socket
diff --git a/ocaml/xapi/xapi_periodic_scheduler_init.ml b/ocaml/xapi/xapi_periodic_scheduler_init.ml
index 6300f89db2..1bd13d5f6d 100644
--- a/ocaml/xapi/xapi_periodic_scheduler_init.ml
+++ b/ocaml/xapi/xapi_periodic_scheduler_init.ml
@@ -129,9 +129,10 @@ let register ~__context =
       )
   ) ;
   let stunnel_period = !Stunnel_cache.max_idle /. 2. in
-  Xapi_periodic_scheduler.add_to_queue "Check stunnel cache expiry"
-    (Xapi_periodic_scheduler.Periodic stunnel_period) stunnel_period
-    Stunnel_cache.gc ;
+  Xapi_stdext_threads_scheduler.Scheduler.add_to_queue
+    "Check stunnel cache expiry"
+    (Xapi_stdext_threads_scheduler.Scheduler.Periodic stunnel_period)
+    stunnel_period Stunnel_cache.gc ;
   if
     master
     && Db.Pool.get_update_sync_enabled ~__context
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.