Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
de02e53
CP-49953: Remove parse_uri, switch to using Uri module instead
Jun 25, 2024
5975562
CA-392887: set_tls_config immediately after enabling clustering
Vincent-lau Jun 18, 2024
e53ce67
Fix a bug noticed by a quicktest run
Jul 3, 2024
845ffdd
Eliminate unnecessary usage of List.length to check for empty lists
Jun 28, 2024
99c4356
Transition from exception-raising Unix.getenv to Sys.getenv_opt with
Jun 19, 2024
7be240f
Replace Hashtbl.find with Hashtbl.find_opt in trivial cases
Jun 26, 2024
1869b44
Refactor Hashtbl.find out of resources/table.ml
Jun 26, 2024
47f3c3d
Refactor Hashtbl.find out of xenopsd/xc/readln.ml
Jun 26, 2024
d4be15e
Add a gate for Hashbtl.find
Jun 27, 2024
6dd7a48
Merge pull request #5775 from last-genius/private/asultanov/uri-impro…
robhoes Jul 4, 2024
e11436e
CP-50135: Bump datamodel_lifecycle for anti-affinity
BengangY Jul 5, 2024
16b79a0
IH-621: Add IPMI host power on support and remove DRAC
alexbrett Jun 18, 2024
6e09fc5
opam: generate xapi-forkexecd with dune
psafont Jul 5, 2024
3f5e62d
opam: remove unversioned opam dependencies
psafont Jul 5, 2024
832fd36
opam: generate xapi-networkd using dune
psafont Jul 5, 2024
f2fb3a0
Merge pull request #5782 from psafont/nosystemd
psafont Jul 5, 2024
1b06e51
IH-621 Add changed line to power_on_mode
alexbrett Jul 5, 2024
77987d5
fe_test: print stacktrace on unit test failure
edwintorok Jul 5, 2024
4ea6089
fix(fe_test): make it compatible with fd-send-recv 2.0.2
edwintorok Jul 5, 2024
331c564
IH-621: Python tweaks suggested by pylint
alexbrett Jul 5, 2024
92c51d7
Fix indentation in C code
freddy77 Jul 8, 2024
edcc894
Merge pull request #5785 from edwintorok/private/edvint/ocaml5-compat
psafont Jul 8, 2024
1db8c1b
Merge pull request #5788 from freddy77/indentation
psafont Jul 8, 2024
af4860b
Merge pull request #5762 from last-genius/private/asultanov/empty-len…
last-genius Jul 8, 2024
76f232d
Merge branch 'master' into private/asultanov/opt-refactoring
last-genius Jul 8, 2024
caff014
Merge pull request #5751 from last-genius/private/asultanov/opt-refac…
last-genius Jul 8, 2024
eee3f80
Merge pull request #5783 from alexbrett/IH-621
robhoes Jul 8, 2024
5519cf9
Merge pull request #5644 from Vincent-lau/private/shul2/tls-config
Vincent-lau Jul 8, 2024
d26f870
Fixes: 99c43569a0 ("Transition from exception-raising Unix.getenv to …
Jul 9, 2024
9f9c338
Merge pull request #5797 from last-genius/private/asultanov/opt-fix
robhoes Jul 9, 2024
73f5a30
IH-642 Restructure xs-trace to use Cmdliner
Jul 4, 2024
b0e0bab
Merge pull request #5778 from contificate/IH-642
Jul 9, 2024
4c49af7
Merge remote-tracking branch 'xsu/master' into feature/perf
edwintorok Jul 10, 2024
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
17 changes: 9 additions & 8 deletions configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ let () =
in
List.iter print_endline lines ;
(* Expand @LIBEXEC@ in udev rules *)
try
let xenopsd_libexecdir = Hashtbl.find config "XENOPSD_LIBEXECDIR" in
expand "@LIBEXEC@" xenopsd_libexecdir "ocaml/xenopsd/scripts/vif.in"
"ocaml/xenopsd/scripts/vif" ;
expand "@LIBEXEC@" xenopsd_libexecdir
"ocaml/xenopsd/scripts/xen-backend.rules.in"
"ocaml/xenopsd/scripts/xen-backend.rules"
with Not_found -> failwith "xenopsd_libexecdir not set"
match Hashtbl.find_opt config "XENOPSD_LIBEXECDIR" with
| Some xenopsd_libexecdir ->
expand "@LIBEXEC@" xenopsd_libexecdir "ocaml/xenopsd/scripts/vif.in"
"ocaml/xenopsd/scripts/vif" ;
expand "@LIBEXEC@" xenopsd_libexecdir
"ocaml/xenopsd/scripts/xen-backend.rules.in"
"ocaml/xenopsd/scripts/xen-backend.rules"
| None ->
failwith "xenopsd_libexecdir not set"
44 changes: 42 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@

(package
(name xapi-networkd)
(authors "Jon Ludlam")
(synopsis "The XCP networking daemon")
(depends
(alcotest :with-test)
astring
base-threads
(forkexec (= :version))
(http-lib (= :version))
mtime
netlink
re
rpclib
(xapi-idl (= :version))
xapi-inventory
(xapi-stdext-pervasives (= :version))
(xapi-stdext-std (= :version))
(xapi-stdext-threads (= :version))
(xapi-stdext-unix (= :version))
xapi-test-utils
(xen-api-client (= :version))
)
)

(package
Expand All @@ -243,6 +264,14 @@

(package
(name xapi-forkexecd)
(synopsis "Sub-process control service for xapi")
(description "This daemon creates and manages sub-processes on behalf of xapi.")
(depends
astring
(forkexec (= :version))
(uuid (= :version))
(xapi-stdext-unix (= :version))
)
)

(package
Expand Down Expand Up @@ -446,6 +475,19 @@ This package provides an Lwt compatible interface to the library.")

(package
(name forkexec)
(synopsis "Process-spawning library")
(description "Client and server library to spawn processes.")
(depends
base-threads
(fd-send-recv (>= "2.0.0"))
ppx_deriving_rpc
rpclib
(uuid (= :version))
(xapi-log (= :version))
(xapi-stdext-pervasives (= :version))
(xapi-stdext-unix (= :version))
(xapi-tracing (= :version))
)
)

(package
Expand Down Expand Up @@ -515,7 +557,6 @@ This package provides an Lwt compatible interface to the library.")
(synopsis "Xapi's standard library extension, Threads")
(authors "Jonathan Ludlam")
(depends
ocaml
base-threads
base-unix
(odoc :with-doc)
Expand Down Expand Up @@ -552,7 +593,6 @@ This package provides an Lwt compatible interface to the library.")
(synopsis "Xapi's standard library extension, Zerocheck")
(authors "Jonathan Ludlam")
(depends
ocaml
(odoc :with-doc)
)
)
52 changes: 29 additions & 23 deletions forkexec.opam
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
# This file is generated by dune, edit dune-project instead
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
opam-version: "2.0"
maintainer: "[email protected]"
authors: "[email protected]"
homepage: "https://github.com/xapi-project/"
synopsis: "Process-spawning library"
description: "Client and server library to spawn processes."
maintainer: ["Xapi project maintainers"]
authors: ["[email protected]"]
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
homepage: "https://xapi-project.github.io/"
bug-reports: "https://github.com/xapi-project/xen-api/issues"
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
tags: [ "org:xapi-project" ]

build: [[ "dune" "build" "-p" name "-j" jobs ]]

depends: [
"ocaml"
"dune"
"dune" {>= "3.0"}
"base-threads"
"fd-send-recv"
"fd-send-recv" {>= "2.0.0"}
"ppx_deriving_rpc"
"rpclib"
"uuid"
"xapi-log"
"xapi-stdext-pervasives"
"xapi-stdext-unix"
"xapi-tracing"
"uuid" {= version}
"xapi-log" {= version}
"xapi-stdext-pervasives" {= version}
"xapi-stdext-unix" {= version}
"xapi-tracing" {= version}
"odoc" {with-doc}
]
synopsis: "Sub-process control service for xapi"
description:
"This daemon creates and manages sub-processes on behalf of xapi."
url {
src: "https://github.com/xapi-project/xen-api/archive/master.tar.gz"
}
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
29 changes: 0 additions & 29 deletions forkexec.opam.template

This file was deleted.

5 changes: 1 addition & 4 deletions ocaml/database/db_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,5 @@ let is_session_registered session =

let get_registered_database session =
with_lock db_registration_mutex (fun () ->
if Hashtbl.mem foreign_databases session then
Some (Hashtbl.find foreign_databases session)
else
None
Hashtbl.find_opt foreign_databases session
)
14 changes: 8 additions & 6 deletions ocaml/database/db_conn_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ let read_db_connections () = !db_connections
let with_db_conn_lock db_conn f =
let db_conn_m =
with_lock db_conn_locks_m (fun () ->
try Hashtbl.find db_conn_locks db_conn
with _ ->
(* If we don't have a lock already for this connection then go make one dynamically and use that from then on *)
let new_dbconn_mutex = Mutex.create () in
Hashtbl.replace db_conn_locks db_conn new_dbconn_mutex ;
new_dbconn_mutex
match Hashtbl.find_opt db_conn_locks db_conn with
| Some x ->
x
| None ->
(* If we don't have a lock already for this connection then go make one dynamically and use that from then on *)
let new_dbconn_mutex = Mutex.create () in
Hashtbl.replace db_conn_locks db_conn new_dbconn_mutex ;
new_dbconn_mutex
)
in
with_lock db_conn_m (fun () -> f ())
7 changes: 3 additions & 4 deletions ocaml/database/stats.ml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ let sample (name : string) (x : float) : unit =
let x' = log x in
with_lock timings_m (fun () ->
let p =
if Hashtbl.mem timings name then
Hashtbl.find timings name
else
Normal_population.empty
Option.value
(Hashtbl.find_opt timings name)
~default:Normal_population.empty
in
let p' = Normal_population.sample p x' in
Hashtbl.replace timings name p'
Expand Down
3 changes: 2 additions & 1 deletion ocaml/forkexecd/test/fe_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ let test_internal_failure_error () =
Forkhelpers.safe_close_and_exec None (Some fd) None [] exe args |> ignore ;
fail "Expected an exception"
with
| Fd_send_recv.Unix_error _ ->
| Fd_send_recv.Unix_error _ | Unix.Unix_error (Unix.EBADF, _, _) ->
leak_fd_detect ()
| e ->
Printexc.print_backtrace stderr ;
fail "Failed with unexpected exception: %s" (Printexc.to_string e)

let master fds =
Expand Down
3 changes: 2 additions & 1 deletion ocaml/idl/datamodel_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,7 @@ let set_power_on_mode =
[
(Published, rel_cowley, "")
; (Changed, rel_stockholm, "Removed iLO script")
; (Changed, "24.19.0", "Replaced DRAC mode with IPMI")
]
~in_product_since:rel_midnight_ride
~doc:"Set the power-on-mode, host, user and password"
Expand All @@ -1375,7 +1376,7 @@ let set_power_on_mode =
(Ref _host, "self", "The host")
; ( String
, "power_on_mode"
, "power-on-mode can be empty, wake-on-lan, DRAC or other"
, "power-on-mode can be empty, wake-on-lan, IPMI or other"
)
; (Map (String, String), "power_on_config", "Power on config")
]
Expand Down
12 changes: 12 additions & 0 deletions ocaml/idl/datamodel_lifecycle.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
let prototyped_of_class = function
| "VM_group" ->
Some "24.18.0-next"
| "Observer" ->
Some "23.14.0"
| "VTPM" ->
Expand All @@ -7,6 +9,10 @@ let prototyped_of_class = function
None

let prototyped_of_field = function
| "VM_group", "VMs" ->
Some "24.18.0-next"
| "VM_group", "placement" ->
Some "24.18.0-next"
| "Observer", "enabled" ->
Some "23.14.0"
| "Observer", "components" ->
Expand Down Expand Up @@ -55,6 +61,8 @@ let prototyped_of_field = function
Some "22.27.0"
| "host", "last_software_update" ->
Some "22.20.0"
| "VM", "groups" ->
Some "24.18.0-next"
| "VM", "pending_guidances_full" ->
Some "24.10.0"
| "VM", "pending_guidances_recommended" ->
Expand All @@ -63,6 +71,8 @@ let prototyped_of_field = function
Some "23.18.0"
| "VM", "actions__after_softreboot" ->
Some "23.1.0"
| "pool", "recommendations" ->
Some "24.18.0-next"
| "pool", "update_sync_enabled" ->
Some "23.18.0"
| "pool", "update_sync_day" ->
Expand Down Expand Up @@ -139,6 +149,8 @@ let prototyped_of_message = function
Some "24.17.0"
| "VM", "restart_device_models" ->
Some "23.30.0"
| "VM", "set_groups" ->
Some "24.18.0-next"
| "pool", "get_guest_secureboot_readiness" ->
Some "24.17.0"
| "pool", "set_ext_auth_max_threads" ->
Expand Down
19 changes: 9 additions & 10 deletions ocaml/idl/dtd_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let is_element = function Element (_, _, _) -> true | _ -> false
let string_of_attribute = function
| Attribute (n, options, default) ->
let opt_string =
if List.length options = 0 then
if options = [] then
"CDATA"
else
"(" ^ String.concat " | " options ^ ")"
Expand All @@ -59,7 +59,7 @@ let string_of_attribute = function
sprintf "%s %s %s" n opt_string def_string

let strings_of_attributes parent atts =
if List.length atts > 0 then
if atts <> [] then
let prefix = sprintf "<!ATTLIST %s " parent in
let body = List.map string_of_attribute atts in
(prefix :: body) @ [">"]
Expand Down Expand Up @@ -110,14 +110,13 @@ let rec strings_of_dtd_element known_els = function

let element known_els name children atts =
let existing_children =
if Hashtbl.mem known_els name then
match Hashtbl.find known_els name with
| Element (_, c, att) ->
(c, att)
| _ ->
assert false
else
([], [])
match Hashtbl.find_opt known_els name with
| Some (Element (_, c, att)) ->
(c, att)
| None ->
([], [])
| _ ->
assert false
in
let open Xapi_stdext_std.Listext in
let el =
Expand Down
2 changes: 1 addition & 1 deletion ocaml/libs/ezxenstore/core/watch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let wait_for ~xs ?(timeout = 300.) (x : 'a t) =
Thread.create
(fun () ->
let r, _, _ = Unix.select [p1] [] [] timeout in
if List.length r > 0 then
if r <> [] then
()
else
try Xs_client_unix.Task.cancel task with _ -> ()
Expand Down
2 changes: 1 addition & 1 deletion ocaml/libs/http-lib/buf_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let fill_buf ~buffered ic timeout =
let buf_size = Bytes.length ic.buf in
let fill_no_exc timeout len =
let l, _, _ = Unix.select [ic.fd] [] [] timeout in
if List.length l <> 0 then (
if l <> [] then (
let n = Unix.read ic.fd ic.buf ic.max len in
ic.max <- n + ic.max ;
if n = 0 && len <> 0 then raise Eof ;
Expand Down
Loading