Skip to content

Commit 76f232d

Browse files
authored
Merge branch 'master' into private/asultanov/opt-refactoring
Signed-off-by: Andriy Sultanov <53952748+last-genius@users.noreply.github.com>
2 parents d4be15e + af4860b commit 76f232d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+317
-362
lines changed

dune-project

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,27 @@
225225

226226
(package
227227
(name xapi-networkd)
228+
(authors "Jon Ludlam")
229+
(synopsis "The XCP networking daemon")
230+
(depends
231+
(alcotest :with-test)
232+
astring
233+
base-threads
234+
(forkexec (= :version))
235+
(http-lib (= :version))
236+
mtime
237+
netlink
238+
re
239+
rpclib
240+
(xapi-idl (= :version))
241+
xapi-inventory
242+
(xapi-stdext-pervasives (= :version))
243+
(xapi-stdext-std (= :version))
244+
(xapi-stdext-threads (= :version))
245+
(xapi-stdext-unix (= :version))
246+
xapi-test-utils
247+
(xen-api-client (= :version))
248+
)
228249
)
229250

230251
(package
@@ -241,6 +262,14 @@
241262

242263
(package
243264
(name xapi-forkexecd)
265+
(synopsis "Sub-process control service for xapi")
266+
(description "This daemon creates and manages sub-processes on behalf of xapi.")
267+
(depends
268+
astring
269+
(forkexec (= :version))
270+
(uuid (= :version))
271+
(xapi-stdext-unix (= :version))
272+
)
244273
)
245274

246275
(package
@@ -444,6 +473,19 @@ This package provides an Lwt compatible interface to the library.")
444473

445474
(package
446475
(name forkexec)
476+
(synopsis "Process-spawning library")
477+
(description "Client and server library to spawn processes.")
478+
(depends
479+
base-threads
480+
(fd-send-recv (>= "2.0.0"))
481+
ppx_deriving_rpc
482+
rpclib
483+
(uuid (= :version))
484+
(xapi-log (= :version))
485+
(xapi-stdext-pervasives (= :version))
486+
(xapi-stdext-unix (= :version))
487+
(xapi-tracing (= :version))
488+
)
447489
)
448490

449491
(package
@@ -513,7 +555,6 @@ This package provides an Lwt compatible interface to the library.")
513555
(synopsis "Xapi's standard library extension, Threads")
514556
(authors "Jonathan Ludlam")
515557
(depends
516-
ocaml
517558
base-threads
518559
base-unix
519560
(odoc :with-doc)
@@ -541,7 +582,6 @@ This package provides an Lwt compatible interface to the library.")
541582
(synopsis "Xapi's standard library extension, Zerocheck")
542583
(authors "Jonathan Ludlam")
543584
(depends
544-
ocaml
545585
(odoc :with-doc)
546586
)
547587
)

forkexec.opam

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
# This file is generated by dune, edit dune-project instead
2-
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
32
opam-version: "2.0"
4-
maintainer: "xen-api@lists.xen.org"
5-
authors: "xen-api@lists.xen.org"
6-
homepage: "https://github.com/xapi-project/"
3+
synopsis: "Process-spawning library"
4+
description: "Client and server library to spawn processes."
5+
maintainer: ["Xapi project maintainers"]
6+
authors: ["xen-api@lists.xen.org"]
7+
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
8+
homepage: "https://xapi-project.github.io/"
79
bug-reports: "https://github.com/xapi-project/xen-api/issues"
8-
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
9-
tags: [ "org:xapi-project" ]
10-
11-
build: [[ "dune" "build" "-p" name "-j" jobs ]]
12-
1310
depends: [
14-
"ocaml"
15-
"dune"
11+
"dune" {>= "3.0"}
1612
"base-threads"
17-
"fd-send-recv"
13+
"fd-send-recv" {>= "2.0.0"}
1814
"ppx_deriving_rpc"
1915
"rpclib"
20-
"uuid"
21-
"xapi-log"
22-
"xapi-stdext-pervasives"
23-
"xapi-stdext-unix"
24-
"xapi-tracing"
16+
"uuid" {= version}
17+
"xapi-log" {= version}
18+
"xapi-stdext-pervasives" {= version}
19+
"xapi-stdext-unix" {= version}
20+
"xapi-tracing" {= version}
21+
"odoc" {with-doc}
2522
]
26-
synopsis: "Sub-process control service for xapi"
27-
description:
28-
"This daemon creates and manages sub-processes on behalf of xapi."
29-
url {
30-
src: "https://github.com/xapi-project/xen-api/archive/master.tar.gz"
31-
}
23+
build: [
24+
["dune" "subst"] {dev}
25+
[
26+
"dune"
27+
"build"
28+
"-p"
29+
name
30+
"-j"
31+
jobs
32+
"@install"
33+
"@runtest" {with-test}
34+
"@doc" {with-doc}
35+
]
36+
]
37+
dev-repo: "git+https://github.com/xapi-project/xen-api.git"

forkexec.opam.template

Lines changed: 0 additions & 29 deletions
This file was deleted.

ocaml/forkexecd/test/fe_test.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ let test_internal_failure_error () =
221221
Forkhelpers.safe_close_and_exec None (Some fd) None [] exe args |> ignore ;
222222
fail "Expected an exception"
223223
with
224-
| Fd_send_recv.Unix_error _ ->
224+
| Fd_send_recv.Unix_error _ | Unix.Unix_error (Unix.EBADF, _, _) ->
225225
leak_fd_detect ()
226226
| e ->
227+
Printexc.print_backtrace stderr ;
227228
fail "Failed with unexpected exception: %s" (Printexc.to_string e)
228229

229230
let master fds =

ocaml/idl/datamodel_lifecycle.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
let prototyped_of_class = function
2+
| "VM_group" ->
3+
Some "24.18.0-next"
24
| "Observer" ->
35
Some "23.14.0"
46
| "VTPM" ->
@@ -7,6 +9,10 @@ let prototyped_of_class = function
79
None
810

911
let prototyped_of_field = function
12+
| "VM_group", "VMs" ->
13+
Some "24.18.0-next"
14+
| "VM_group", "placement" ->
15+
Some "24.18.0-next"
1016
| "Observer", "enabled" ->
1117
Some "23.14.0"
1218
| "Observer", "components" ->
@@ -55,6 +61,8 @@ let prototyped_of_field = function
5561
Some "22.27.0"
5662
| "host", "last_software_update" ->
5763
Some "22.20.0"
64+
| "VM", "groups" ->
65+
Some "24.18.0-next"
5866
| "VM", "pending_guidances_full" ->
5967
Some "24.10.0"
6068
| "VM", "pending_guidances_recommended" ->
@@ -63,6 +71,8 @@ let prototyped_of_field = function
6371
Some "23.18.0"
6472
| "VM", "actions__after_softreboot" ->
6573
Some "23.1.0"
74+
| "pool", "recommendations" ->
75+
Some "24.18.0-next"
6676
| "pool", "update_sync_enabled" ->
6777
Some "23.18.0"
6878
| "pool", "update_sync_day" ->
@@ -139,6 +149,8 @@ let prototyped_of_message = function
139149
Some "24.17.0"
140150
| "VM", "restart_device_models" ->
141151
Some "23.30.0"
152+
| "VM", "set_groups" ->
153+
Some "24.18.0-next"
142154
| "pool", "get_guest_secureboot_readiness" ->
143155
Some "24.17.0"
144156
| "pool", "set_ext_auth_max_threads" ->

ocaml/idl/dtd_backend.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let is_element = function Element (_, _, _) -> true | _ -> false
4141
let string_of_attribute = function
4242
| Attribute (n, options, default) ->
4343
let opt_string =
44-
if List.length options = 0 then
44+
if options = [] then
4545
"CDATA"
4646
else
4747
"(" ^ String.concat " | " options ^ ")"
@@ -59,7 +59,7 @@ let string_of_attribute = function
5959
sprintf "%s %s %s" n opt_string def_string
6060

6161
let strings_of_attributes parent atts =
62-
if List.length atts > 0 then
62+
if atts <> [] then
6363
let prefix = sprintf "<!ATTLIST %s " parent in
6464
let body = List.map string_of_attribute atts in
6565
(prefix :: body) @ [">"]

ocaml/libs/ezxenstore/core/watch.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ let wait_for ~xs ?(timeout = 300.) (x : 'a t) =
5151
Thread.create
5252
(fun () ->
5353
let r, _, _ = Unix.select [p1] [] [] timeout in
54-
if List.length r > 0 then
54+
if r <> [] then
5555
()
5656
else
5757
try Xs_client_unix.Task.cancel task with _ -> ()

ocaml/libs/http-lib/buf_io.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ let fill_buf ~buffered ic timeout =
8080
let buf_size = Bytes.length ic.buf in
8181
let fill_no_exc timeout len =
8282
let l, _, _ = Unix.select [ic.fd] [] [] timeout in
83-
if List.length l <> 0 then (
83+
if l <> [] then (
8484
let n = Unix.read ic.fd ic.buf ic.max len in
8585
ic.max <- n + ic.max ;
8686
if n = 0 && len <> 0 then raise Eof ;

ocaml/libs/http-lib/http.ml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,6 @@ let parse_keyvalpairs xs =
208208
)
209209
kvpairs
210210

211-
let parse_uri x =
212-
match Astring.String.cuts ~sep:"?" x with
213-
| [uri] ->
214-
(uri, [])
215-
| [uri; params] ->
216-
(uri, parse_keyvalpairs params)
217-
| _ ->
218-
raise Http_parse_failure
219-
220211
type authorization = Basic of string * string | UnknownAuth of string
221212
[@@deriving rpc]
222213

@@ -629,42 +620,6 @@ module Request = struct
629620

630621
let get_version x = x.version
631622

632-
let of_request_line x =
633-
match Astring.String.fields ~empty:false x with
634-
| [m; uri; version] -> (
635-
(* Request-Line = Method SP Request-URI SP HTTP-Version CRLF *)
636-
let uri, query = parse_uri uri in
637-
(* strip the "HTTP/" prefix from the version string *)
638-
match Astring.String.cut ~sep:"/" version with
639-
| Some (_, version) ->
640-
{
641-
m= method_t_of_string m
642-
; frame= false
643-
; uri
644-
; query
645-
; content_length= None
646-
; transfer_encoding= None
647-
; accept= None
648-
; version
649-
; cookie= []
650-
; auth= None
651-
; task= None
652-
; subtask_of= None
653-
; content_type= None
654-
; host= None
655-
; user_agent= None
656-
; close= false
657-
; additional_headers= []
658-
; body= None
659-
; traceparent= None
660-
}
661-
| None ->
662-
error "Failed to parse: %s" x ;
663-
raise Http_parse_failure
664-
)
665-
| _ ->
666-
raise Http_parse_failure
667-
668623
let to_string x =
669624
let kvpairs x =
670625
String.concat "; " (List.map (fun (k, v) -> k ^ "=" ^ v) x)

ocaml/libs/http-lib/http.mli

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ module Request : sig
119119
val get_version : t -> string
120120
(** [get_version t] returns the HTTP protocol version *)
121121

122-
val of_request_line : string -> t
123-
(** [of_request_line l] parses [l] of the form "METHOD HTTP/VERSION" and
124-
returns the corresponding [t] *)
125-
126122
val to_string : t -> string
127123
(** [to_string t] returns a short string summarising [t] *)
128124

@@ -176,8 +172,6 @@ end
176172

177173
val authorization_of_string : string -> authorization
178174

179-
val parse_uri : string -> string * (string * string) list
180-
181175
val http_403_forbidden : ?version:string -> unit -> string list
182176

183177
val http_200_ok : ?version:string -> ?keep_alive:bool -> unit -> string list

0 commit comments

Comments
 (0)