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 #6111

Merged
merged 50 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8eb26b6
CP-50475: Remove unnecessary Parallel atoms from the xenopsd queues
psafont Oct 16, 2024
0425b0b
CP-50475: parallelize device ops during VM lifecycle ops
psafont Oct 15, 2024
7ad5f95
xapi_stdext_unix/test: Fix intermittent systemd cram test failure
last-genius Oct 17, 2024
e83ba5e
Fix a build warning with GCC 12.3.0
rosslagerwall Oct 18, 2024
e3f9213
Remove use of deprecated syslog Standard* type
rosslagerwall Oct 18, 2024
1bdb22a
CA-400860: rrdp-netdev - drop xenctrl, use xenstore to get UUIDs from…
last-genius Oct 21, 2024
d157db0
CP-51870: Delegate restarting systemd services order to systemd
liulinC Oct 17, 2024
2c99f2d
CA-400199: open /dev/urandom on first use
edwintorok Oct 25, 2024
760c355
CP-51938: Generate XML alert for cluster health
Vincent-lau Oct 22, 2024
c122bc4
CP-50546: Remove initscripts family
liulinC Oct 29, 2024
137160e
CA-400199: open /dev/urandom on first use and use an input channel to…
lindig Oct 29, 2024
36f9993
Remove notion of weird string from sexpr library
contificate Oct 29, 2024
82b2113
Remove notion of weird string from sexpr library (#6091)
contificate Oct 29, 2024
58b9acc
CA-400860: rrdp-netdev - drop xenctrl, use xenstore to get UUIDs from…
robhoes Oct 29, 2024
df30b80
CP-51938: Generate XML alert for cluster health (#6074)
robhoes Oct 29, 2024
2ed1166
CP-50475: parallelize device ops during VM lifecycle ops (#6057)
robhoes Oct 29, 2024
94dc48c
xapi_stdext_unix/test: Fix intermittent systemd cram test failure (#6…
psafont Oct 29, 2024
19ad403
CA-399396: Adjust the jemalloc parameters for memory performance
stephenchengCloud Oct 30, 2024
176c9e3
CP-52039: Drop Semaphore from Xapi_stdext_threads
contificate Oct 29, 2024
864ecdd
CP-52039: Drop Semaphore from Xapi_stdext_threads (#6094)
contificate Oct 30, 2024
395d5ad
CA-400560: Fix version segment division error
changlei-li Oct 29, 2024
a767100
CP-51870: Refresh toolstack services (#6060)
robhoes Oct 30, 2024
5609e49
Do not include xapi-clusterd.service in toolstack.target
robhoes Oct 30, 2024
6c08d45
CP-50546: Remove initscripts family (#6090)
robhoes Oct 30, 2024
07aeb76
Do not include xapi-clusterd.service in toolstack.target (#6096)
psafont Oct 31, 2024
c0482fe
CA-401324: Update pvsproxy socket location
rosslagerwall Oct 30, 2024
b6619b5
CA-401324: Update pvsproxy socket location (#6098)
lindig Nov 1, 2024
a6187d5
CA-400560: Support tilde in RPM version/release comparison
changlei-li Oct 30, 2024
e376e96
CA-401404: Only check previous active service status
liulinC Nov 4, 2024
61e655d
CA-401404: Only check previous active service status (#6100)
robhoes Nov 4, 2024
8e89449
CA-400560: Support tilde in RPM version/release comparison (#6092)
minglumlu Nov 5, 2024
0149ee5
CA-401242: avoid long-running, idle connections on VDI.pool_migrate
psafont Oct 29, 2024
3ca39ec
xapi_vdi: replaces nested if-elses with monadic Result
psafont Oct 30, 2024
e40b3fc
datamodel: Add all VDI operations to the SR operations variant
psafont Oct 31, 2024
3a776c0
CA-401242: avoid long-running, idle connections on VDI.pool_migrate (…
psafont Nov 5, 2024
8b7cfd6
CA-401498: Fix test_systemd occasional timeout
changlei-li Nov 6, 2024
baf7cbd
CA-401498: Fix test_systemd occasional timeout (#6105)
psafont Nov 6, 2024
3d3bd23
Fix some XS9 warnings (#6066)
psafont Nov 6, 2024
6a66682
CA-399629: make daily-license-check aware of never
psafont Nov 5, 2024
b4f9028
license_check: clean up interface
psafont Sep 30, 2024
365af69
license_check: update the concept of "never"
psafont Sep 30, 2024
7db5e8b
daily_license_check: Do not use floats for handling time
psafont Nov 5, 2024
85c8bcd
CA-399629: make daily-license-check aware of never (#6104)
psafont Nov 6, 2024
901f1d4
CA-399396: Adjust the jemalloc parameters for memory performance (#6093)
liulinC Nov 7, 2024
77e3a3e
CA-400060: Introduce new field for sm class
Vincent-lau Oct 21, 2024
7f14bfc
CA-400060: Sm feature intersection
Vincent-lau Oct 21, 2024
2ec0ac6
CA-400060: Reject pool join if sm features mismatch
Vincent-lau Oct 21, 2024
670d811
CA-400060: Sm feature intersection (#6069)
Vincent-lau Nov 7, 2024
3e2e970
Document Rbac module
contificate Nov 7, 2024
cbdc58f
Document Rbac module (#6107)
contificate Nov 7, 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
2 changes: 0 additions & 2 deletions ocaml/forkexecd/lib/fe_systemctl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ let start_transient ?(env = Array.of_list default_env) ?(properties = [])
)
; ("SyslogIdentifier", syslog_key)
; ("SyslogLevel", "debug")
; ("StandardOutput", "syslog")
; ("StandardError", "inherit")
; ("StartLimitInterval", "0") (* no rate-limit, for bootstorms *)
; ("ExecStart", String.concat " " (cmd :: List.map Filename.quote args))
; ("Type", Type.to_string exec_ty)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/forkexecd/test/fe_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ let slave = function
(*
Printf.fprintf stderr "%s %d\n" total_fds (List.length present - 1)
*)
if total_fds + 1 (* Uuid.dev_urandom *) <> List.length filtered then
if total_fds <> List.length filtered then
fail "Expected %d fds; /proc/self/fd has %d: %s" total_fds
(List.length filtered) ls

Expand Down
17 changes: 17 additions & 0 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4181,6 +4181,13 @@ module SR = struct
, "Exporting a bitmap that shows the changed blocks between two VDIs"
)
; ("vdi_set_on_boot", "Setting the on_boot field of the VDI")
; ("vdi_blocked", "Blocking other operations for a VDI")
; ("vdi_copy", "Copying the VDI")
; ("vdi_force_unlock", "Forcefully unlocking the VDI")
; ("vdi_forget", "Forgetting about the VDI")
; ("vdi_generate_config", "Generating the configuration of the VDI")
; ("vdi_resize_online", "Resizing the VDI online")
; ("vdi_update", "Refreshing the fields on the VDI")
; ("pbd_create", "Creating a PBD for this SR")
; ("pbd_destroy", "Destroying one of this SR's PBDs")
]
Expand Down Expand Up @@ -4994,11 +5001,21 @@ module SM = struct
, "capabilities of the SM plugin, with capability version \
numbers"
)
; ( Changed
, "24.37.0"
, "features are now pool-wide, instead of what is available on \
the coordinator sm"
)
]
~ty:(Map (String, Int))
"features"
"capabilities of the SM plugin, with capability version numbers"
~default_value:(Some (VMap []))
; field ~in_oss_since:None ~qualifier:DynamicRO ~lifecycle:[]
~ty:(Map (Ref _host, Set String))
~internal_only:true "host_pending_features"
"SM features that are waiting to be declared per host."
~default_value:(Some (VMap []))
; field
~lifecycle:[(Published, rel_miami, "additional configuration")]
~default_value:(Some (VMap []))
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open Datamodel_roles
to leave a gap for potential hotfixes needing to increment the schema version.*)
let schema_major_vsn = 5

let schema_minor_vsn = 783
let schema_minor_vsn = 785

(* Historical schema versions just in case this is useful later *)
let rio_schema_major_vsn = 5
Expand Down
7 changes: 7 additions & 0 deletions ocaml/idl/datamodel_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,13 @@ let _ =
"The host joining the pool has different CA certificates from the pool \
coordinator while using the same name, uninstall them and try again."
() ;
error Api_errors.pool_joining_sm_features_incompatible
["pool_sm_ref"; "candidate_sm_ref"]
~doc:
"The host joining the pool has an incompatible set of sm features from \
the pool coordinator. Make sure the sm are of the same versions and try \
again."
() ;

(* External directory service *)
error Api_errors.subject_cannot_be_resolved []
Expand Down
2 changes: 2 additions & 0 deletions ocaml/idl/datamodel_lifecycle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ let prototyped_of_field = function
Some "22.26.0"
| "VTPM", "persistence_backend" ->
Some "22.26.0"
| "SM", "host_pending_features" ->
Some "24.36.0-next"
| "host", "last_update_hash" ->
Some "24.10.0"
| "host", "pending_guidances_full" ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/schematest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
(* BEWARE: if this changes, check that schema has been bumped accordingly in
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)

let last_known_schema_hash = "8fcd8892ec0c7d130b0da44c5fd3990b"
let last_known_schema_hash = "18df8c33434e3df1982e11ec55d1f3f8"

let current_schema_hash : string =
let open Datamodel_types in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/libs/http-lib/http_svr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ let start ?header_read_timeout ?header_total_timeout ?max_header_length
; body=
handle_connection ~header_read_timeout ~header_total_timeout
~max_header_length x
; lock= Xapi_stdext_threads.Semaphore.create conn_limit
; lock= Semaphore.Counting.make conn_limit
}
in
let server = Server_io.server handler socket in
Expand Down
6 changes: 3 additions & 3 deletions ocaml/libs/http-lib/server_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ type handler = {
name: string
; (* body should close the provided fd *)
body: Unix.sockaddr -> Unix.file_descr -> unit
; lock: Xapi_stdext_threads.Semaphore.t
; lock: Semaphore.Counting.t
}

let handler_by_thread (h : handler) (s : Unix.file_descr)
(caller : Unix.sockaddr) =
Thread.create
(fun () ->
Fun.protect
~finally:(fun () -> Xapi_stdext_threads.Semaphore.release h.lock 1)
~finally:(fun () -> Semaphore.Counting.release h.lock)
(Debug.with_thread_named h.name (fun () -> h.body caller s))
)
()
Expand All @@ -49,7 +49,7 @@ let establish_server ?(signal_fds = []) forker handler sock =
@@ Polly.wait epoll 2 (-1) (fun _ fd _ ->
(* If any of the signal_fd is active then bail out *)
if List.mem fd signal_fds then raise PleaseClose ;
Xapi_stdext_threads.Semaphore.acquire handler.lock 1 ;
Semaphore.Counting.acquire handler.lock ;
let s, caller = Unix.accept ~cloexec:true sock in
try ignore (forker handler s caller)
with exc ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/libs/http-lib/server_io.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type handler = {
name: string (** used for naming the thread *)
; body: Unix.sockaddr -> Unix.file_descr -> unit
(** function called in a thread for each connection*)
; lock: Xapi_stdext_threads.Semaphore.t
; lock: Semaphore.Counting.t
}

type server = {
Expand Down
35 changes: 3 additions & 32 deletions ocaml/libs/sexpr/sExpr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
type t =
| Node of t list
| Symbol of string
| String of string
| WeirdString of string * string
type t = Node of t list | Symbol of string | String of string

let unescape_buf buf s =
let aux esc = function
Expand Down Expand Up @@ -84,31 +80,13 @@ let string_of sexpr =
List.iter (fun i -> Buffer.add_char buf ' ' ; __string_of_rec i) l
) ;
Buffer.add_char buf ')'
| Symbol s | String s | WeirdString (_, s) ->
| Symbol s | String s ->
Buffer.add_string buf "\'" ;
Buffer.add_string buf (escape s) ;
Buffer.add_string buf "\'"
in
__string_of_rec sexpr ; Buffer.contents buf

let weird_of_string x =
let random_chars = "abcdefghijklmnopqrstuvwxyz" in
let randchar () =
String.sub random_chars (Random.int (String.length random_chars)) 1
in
(* true if the parent string contains child as a substring, starting the
search forward from offset *)
let rec has_substring parent offset child =
String.length parent - offset >= String.length child
&& (String.sub parent offset (String.length child) = child
|| has_substring parent (offset + 1) child
)
in
let rec find delim =
if has_substring x 0 delim then find (delim ^ randchar ()) else delim
in
WeirdString (find "xxx", x)

let rec output_fmt ff = function
| Node list ->
let rec aux ?(first = true) = function
Expand All @@ -121,12 +99,5 @@ let rec output_fmt ff = function
aux ~first t
in
Format.fprintf ff "@[(" ; aux list ; Format.fprintf ff ")@]"
| Symbol s | String s | WeirdString (_, s) ->
| Symbol s | String s ->
Format.fprintf ff "\"%s\"" (escape s)

(*
| Symbol s ->
Format.fprintf ff "%s" s
| WeirdString(tag, s) ->
Format.fprintf ff "<<%s<%s<%s<" tag s tag
*)
8 changes: 1 addition & 7 deletions ocaml/libs/sexpr/sExpr.mli
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
type t =
| Node of t list
| Symbol of string
| String of string
| WeirdString of string * string
type t = Node of t list | Symbol of string | String of string

val mkstring : string -> t

val string_of : t -> string

val weird_of_string : string -> t

val output_fmt : Format.formatter -> t -> unit
7 changes: 0 additions & 7 deletions ocaml/libs/sexpr/sExprLexer.mli

This file was deleted.

7 changes: 1 addition & 6 deletions ocaml/libs/sexpr/sExprLexer.mll
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
open SExprParser
let line = ref 1
}

rule token = parse
| [' ' '\t' '\r'] { token lexbuf }
| ';' [^ '\n']* '\n' { incr line; token lexbuf }
| '\n' { incr line; token lexbuf }
| "<<" ([^ '<']+ as tag1) '<' ([^ '<']* as s) '<' ([^ '<']+ as tag2) '<'
{ if tag1=tag2 then WEIRD(tag1, s) else invalid_arg "Weird tag" }
| [' ' '\t' '\r' '\n']+ | ';' [^ '\n']* '\n' { token lexbuf }
| '"' (([^ '"' '\\'] | ('\\' _))* as s) '"' { STRING s }
| '\'' (([^ '\'' '\\'] | ('\\' _))* as s) '\'' { STRING s }
| [^ '"' ' ' '\t' '\n' '(' ')']+ as s { SYMBOL s }
Expand Down
14 changes: 4 additions & 10 deletions ocaml/libs/sexpr/sExprParser.mly
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
%token <string> SYMBOL STRING
%token <string * string> WEIRD
%token OPEN CLOSE

%start expr
%type <SExpr.t> expr
%start<SExpr.t> expr

%%

expr_list: { [] }
| expr expr_list { $1 :: $2 };

expr:
| OPEN expr_list CLOSE { SExpr.Node $2 }
| SYMBOL { SExpr.Symbol $1 }
| STRING { SExpr.mkstring $1 }
| WEIRD { (fun (tag, s) -> SExpr.WeirdString(tag, s)) $1 };
| OPEN es = list(expr) CLOSE { SExpr.Node es }
| s = SYMBOL { SExpr.Symbol s }
| s = STRING { SExpr.mkstring s }
71 changes: 31 additions & 40 deletions ocaml/libs/uuid/uuidx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,48 +116,39 @@ let is_uuid str = match of_string str with None -> false | Some _ -> true

let dev_urandom = "/dev/urandom"

let dev_urandom_fd = Unix.openfile dev_urandom [Unix.O_RDONLY] 0o640
(* we can't close this in at_exit, because Crowbar runs at_exit, and
it'll fail because this FD will then be closed
*)

let read_bytes dev n =
let buf = Bytes.create n in
let read = Unix.read dev buf 0 n in
if read <> n then
raise End_of_file
else
Bytes.to_string buf

let make_uuid_urnd () = of_bytes (read_bytes dev_urandom_fd 16) |> Option.get

(* State for random number generation. Random.State.t isn't thread safe, so
only use this via with_non_csprng_state, which takes care of this.
*)
let rstate = Random.State.make_self_init ()

let rstate_m = Mutex.create ()

let with_non_csprng_state =
(* On OCaml 5 we could use Random.State.split instead,
and on OCaml 4 the mutex may not be strictly needed
*)
let finally () = Mutex.unlock rstate_m in
fun f ->
Mutex.lock rstate_m ;
Fun.protect ~finally (f rstate)

(** Use non-CSPRNG by default, for CSPRNG see {!val:make_uuid_urnd} *)
let make_uuid_fast () = with_non_csprng_state Uuidm.v4_gen

let make_default = ref make_uuid_urnd

let make () = !make_default ()
let generate =
let mutex = Mutex.create () in
let dev_urandom_ic = ref None in
let finally () = Mutex.unlock mutex in
let with_mutex fn = Mutex.lock mutex ; Fun.protect ~finally fn in
let close_ic () =
with_mutex @@ fun () ->
!dev_urandom_ic |> Option.iter close_in_noerr ;
dev_urandom_ic := None
in
fun n ->
with_mutex @@ fun () ->
let ic =
match !dev_urandom_ic with
| None ->
let ic = open_in_bin dev_urandom in
at_exit close_ic ;
dev_urandom_ic := Some ic ;
ic
| Some ic ->
ic
in
really_input_string ic n

let make_uuid_urnd () = of_bytes (generate 16) |> Option.get

let make_uuid_fast = make_uuid_urnd

let make = make_uuid_urnd

let make_v7_uuid_from_parts time_ns rand_b = Uuidm.v7_ns ~time_ns ~rand_b

let rand64 () =
with_non_csprng_state (fun rstate () -> Random.State.bits64 rstate)
let rand64 () = String.get_int64_ne (generate 8) 0

let now_ns =
let start = Mtime_clock.counter () in
Expand All @@ -174,7 +165,7 @@ let make_v7_uuid () = make_v7_uuid_from_parts (now_ns ()) (rand64 ())
type cookie = string

let make_cookie () =
read_bytes dev_urandom_fd 64
generate 64
|> String.to_seq
|> Seq.map (fun c -> Printf.sprintf "%1x" (int_of_char c))
|> List.of_seq
Expand Down
5 changes: 0 additions & 5 deletions ocaml/libs/uuid/uuidx.mli
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,3 @@ module Hash : sig
(* UUID Version 5 derived from argument string and namespace UUID *)
val string : string -> [< not_secret] t
end

(**/**)

(* just for feature flag, to be removed *)
val make_default : (unit -> [< not_secret] t) ref
Loading
Loading