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

Merge master into feature/pool-licensing #6234

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e8bde26
CA-403422: lengthen the timeout for xenopsd's serialized tasks
psafont Dec 18, 2024
a899232
xenopsd: remove unused subtask parameter
psafont Dec 19, 2024
4394f84
CA-404020: Do not fail when removing a non-existing datasource
psafont Dec 23, 2024
74fe427
rrd/lib: remove outdated functions from utils
psafont Dec 23, 2024
e4e20ad
rrdd: add more comments about its datastructures
psafont Dec 23, 2024
87013f1
CA-364194: use timespans for script timeouts
psafont Oct 12, 2022
0e8cc20
CA-404062: Wrongly restart xapi when receiving HTTP errors
minglumlu Dec 27, 2024
9a44916
CA-404062: Reformat
minglumlu Jan 2, 2025
2fafeb7
CP-51895: Drop FCoE support when fcoe_driver does not exists
liulinC Dec 31, 2024
e3f11da
Report memory available as Kib
gthvn1 Jan 2, 2025
6cf6b77
CA-403422: lengthen the timeout for xenopsd's serialized tasks (#6192)
psafont Jan 2, 2025
0f1f45c
Report memory available as Kib (#6204)
psafont Jan 2, 2025
5f6b500
CA-404062: Wrongly restart xapi when receiving HTTP errors (#6201)
minglumlu Jan 2, 2025
75f0b41
xenopsd: Avoid calling to_string every time
freddy77 Jan 2, 2025
34b5b63
xenopsd: Avoid calling to_string every time (#6206)
psafont Jan 2, 2025
c264219
CA-404020: Do not fail when removing a non-existing datasource (#6199)
psafont Jan 3, 2025
a2e04f9
CA-403620: Drop the usage of fuser in stunnel client proxy
minglumlu Dec 17, 2024
e7f2b70
CA-403620: Make the stunnel proxy local port configurable
minglumlu Dec 26, 2024
b245449
gencert: name the pem parsers
psafont Jan 2, 2025
2d84622
CA-404236, gencert: when parsing pems, ignore data between key and ce…
psafont Jan 2, 2025
71c87a1
CP-51895: Drop FCoE support when fcoe_driver does not exists
liulinC Jan 6, 2025
9a1a547
CA-404236, gencert: when parsing pems, ignore data between key and ce…
psafont Jan 6, 2025
5428164
CA-403344: Add `db_get_by_uuid_opt` to db_cache*
Vincent-lau Jan 3, 2025
eacc53b
Add unit test to the new `db_get_by_uuid_opt` function
Vincent-lau Jan 3, 2025
c69aec9
Style: Refactor using failwith_fmt
Vincent-lau Jan 6, 2025
769c863
Removed deprecated methods.
kc284 Dec 20, 2024
ad4f3d9
Cmdlet refactoring:
kc284 Dec 20, 2024
fa1bf90
CP-53003: Use JsonRpc v1.0 by default and switch to v2.0 once the API…
kc284 Dec 20, 2024
757079c
CA-403344: Add db_get_by_uuid_opt to db_cache* (#6209)
Vincent-lau Jan 6, 2025
dc565fd
CP-51895: Drop FCoE support when fcoe_driver does not exists (#6202)
liulinC Jan 7, 2025
e68cda7
Use Mtime.Span.to_float_ns instead of Mtime.Span.to_uint64_ns+Int64.…
freddy77 Jan 7, 2025
38a8f98
CA-404013: do not relock the mutex when backing up rrds
psafont Jan 7, 2025
77258a4
database: do not log when a field is dropped when loading from db_xml
psafont Jan 8, 2025
5efa5d0
CA-404013: replace Thread.delay with Delay module
gangj Jan 7, 2025
264ca76
CA-404013: replace Thread.delay with Delay module (#6213)
gangj Jan 8, 2025
5689150
CA-403700 use iso9660 file system for updates
Dec 17, 2024
32b154e
rrd2csv: Accept a trailing comma in metrics names
last-genius Jan 7, 2025
53a081c
rrd2csv: Accept a trailing comma in metrics names (#6214)
last-genius Jan 9, 2025
96f7cd1
Use Mtime.Span.to_float_ns instead of Mtime.Span.to_uint64_ns+Int64.…
lindig Jan 9, 2025
f9b5e52
CA-404013: do not relock the mutex when backing up rrds (#6215)
robhoes Jan 10, 2025
fbaad2b
CA-403620: Drop the usage of fuser in stunnel client proxy (#6197)
minglumlu Jan 13, 2025
8c9b754
SDK fixes including CP-53003 (#6210)
kc284 Jan 13, 2025
02ca33e
CA-404512: Add feature flag to the new clustering interface
Vincent-lau Jan 8, 2025
f2f6d20
CA-404512: Add feature flag to the new clustering interface (#6217)
Vincent-lau Jan 13, 2025
d8ac4d9
CA-403700 use iso9660 file system for updates (#6216)
robhoes Jan 13, 2025
f58d8d3
CA-364194: use timespans for script timeouts (#6200)
robhoes Jan 14, 2025
142137d
Remove unused Unixext.Direct module
robhoes Jan 14, 2025
7552baa
Remove unused Unixext.Direct module (#6224)
robhoes Jan 14, 2025
8992f9d
github: update release for ubuntu 24.04
psafont Jan 15, 2025
706b3b2
github: update release for ubuntu 24.04 (#6231)
last-genius Jan 15, 2025
de7e1eb
github: remove dependency of python wheel's on dune
psafont Jan 15, 2025
325febf
github: remove dependency of python wheel's on dune (#6232)
psafont Jan 15, 2025
aac5802
CA-404640 XSI-1781 accept in PEM key/cert in any order
Jan 14, 2025
609be92
CA-404640 XSI-1781 bring back fail-06.pem
Jan 14, 2025
5b86063
Log proper names for POSIX signals
psafont Jan 14, 2025
c0fbb69
Debug: add pretty-printing function for signals
psafont Jan 14, 2025
b41cfea
CA-404640 XSI-1781 accept in PEM key/cert in any order (#6227)
lindig Jan 16, 2025
0326d27
CA-404597: rrd/lib_test - Verify that RRD handles non-rate data sourc…
last-genius Jan 15, 2025
6c1e7ea
Log proper names for POSIX signals (#6228)
psafont Jan 16, 2025
73ca3cc
CA-404597: rrd - Pass Gauge and Absolute data source values as-is
last-genius Jan 16, 2025
43d01ca
CA-404597 - rrd: Fix incorrect processing of Gauge and Absolute data …
last-genius Jan 16, 2025
939a3da
Merge remote-tracking branch 'github/master' into private/changleli/p…
changlei-li Jan 17, 2025
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
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ jobs:
python-version: "3.x"

- name: Install build dependencies
run: |
pip install build
sudo apt-get install ocaml dune libfindlib-ocaml-dev libdune-ocaml-dev libcmdliner-ocaml-dev
run: pip install build

- name: Generate python package for XenAPI
run: |
./configure --xapi_version=${{ github.ref_name }}
echo "export XAPI_VERSION=${{ github.ref_name }}" > config.mk
make python

- name: Store python distribution artifacts
Expand Down
38 changes: 19 additions & 19 deletions doc/content/design/coverage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ revision: 2

We would like to add optional coverage profiling to existing [OCaml]
projects in the context of [XenServer] and [XenAPI]. This article
presents how we do it.
presents how we do it.

Binaries instrumented for coverage profiling in the XenServer project
need to run in an environment where several services act together as
Expand All @@ -21,7 +21,7 @@ isolation.
To build binaries with coverage profiling, do:

./configure --enable-coverage
make
make

Binaries will log coverage data to `/tmp/bisect*.out` from which a
coverage report can be generated in `coverage/`:
Expand All @@ -38,7 +38,7 @@ and logs during execution data to in-memory data structures. Before an
instrumented binary terminates, it writes the logged data to a file.
This data can then be analysed with the `bisect-ppx-report` tool, to
produce a summary of annotated code that highlights what part of a
codebase was executed.
codebase was executed.

[BisectPPX] has several desirable properties:

Expand All @@ -65,13 +65,13 @@ abstracted by OCamlfind (OCaml's library manager) and OCamlbuild

# build it with instrumentation from bisect_ppx
ocamlbuild -use-ocamlfind -pkg bisect_ppx -pkg unix example.native

# execute it - generates files ./bisect*.out
./example.native

# generate report
bisect-ppx-report -I _build -html coverage bisect000*

# view coverage/index.html

Summary:
Expand All @@ -86,7 +86,7 @@ will be instrumented during compilation. Behind the scenes `ocamlfind`
makes sure that the compiler uses a preprocessing step that instruments
the code.

## Signal Handling
## Signal Handling

During execution the code instrumentation leads to the collection of
data. This code registers a function with `at_exit` that writes the data
Expand All @@ -98,7 +98,7 @@ terminated by receiving the `TERM` signal, a signal handler must be
installed:

let stop signal =
printf "caught signal %d\n" signal;
printf "caught signal %a\n" Debug.Pp.signal signal;
exit 0

Sys.set_signal Sys.sigterm (Sys.Signal_handle stop)
Expand Down Expand Up @@ -149,8 +149,8 @@ environment variable. This can happen on the command line:

BISECT_FILE=/tmp/example ./example.native

In the context of XenServer we could do this in startup scripts.
However, we added a bit of code
In the context of XenServer we could do this in startup scripts.
However, we added a bit of code

val Coverage.init: string -> unit

Expand All @@ -176,12 +176,12 @@ Goals for instrumentation are:

* what files are instrumented should be obvious and easy to manage
* instrumentation must be optional, yet easy to activate
* avoid methods that require to keep several files in sync like multiple
* avoid methods that require to keep several files in sync like multiple
`_oasis` files
* avoid separate Git branches for instrumented and non-instrumented
code

In the ideal case, we could introduce a configuration switch
In the ideal case, we could introduce a configuration switch
`./configure --enable-coverage` that would prepare compilation for
coverage instrumentation. While [Oasis] supports the creation of such
switches, they cannot be used to control build dependencies like
Expand All @@ -196,7 +196,7 @@ rules in file `_tags.coverage` that cause files to be instrumented:

leads to the execution of this code during preparation:

coverage: _tags _tags.coverage
coverage: _tags _tags.coverage
test ! -f _tags.orig && mv _tags _tags.orig || true
cat _tags.coverage _tags.orig > _tags

Expand All @@ -207,7 +207,7 @@ could be tweaked to instrument only some files:
<**/*.native>: pkg_bisect_ppx

When `make coverage` is not called, these rules are not active and
hence, code is not instrumented for coverage. We believe that this
hence, code is not instrumented for coverage. We believe that this
solution to control instrumentation meets the goals from above. In
particular, what files are instrumented and when is controlled by very
few lines of declarative code that lives in the main repository of a
Expand All @@ -226,14 +226,14 @@ coverage analysis are:
The `_oasis` file bundles the files under `profiling/` into an internal
library which executables then depend on:

# Support files for profiling
# Support files for profiling
Library profiling
CompiledObject: best
Path: profiling
Install: false
Findlibname: profiling
Modules: Coverage
BuildDepends:
BuildDepends:

Executable set_domain_uuid
CompiledObject: best
Expand All @@ -243,16 +243,16 @@ library which executables then depend on:
MainIs: set_domain_uuid.ml
Install: false
BuildDepends:
xenctrl,
uuidm,
xenctrl,
uuidm,
cmdliner,
profiling # <-- here

The `Makefile` target `coverage` primes the project for a profiling build:

# make coverage - prepares for building with coverage analysis

coverage: _tags _tags.coverage
coverage: _tags _tags.coverage
test ! -f _tags.orig && mv _tags _tags.orig || true
cat _tags.coverage _tags.orig > _tags

Expand Down
91 changes: 42 additions & 49 deletions ocaml/database/database_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ let name_label = "name__label"

let name_description = "name__description"

let failwith_fmt fmt = Printf.ksprintf failwith fmt

module Tests =
functor
(Client : Db_interface.DB_ACCESS)
Expand Down Expand Up @@ -111,7 +113,7 @@ functor
; where_value= ""
}
in
failwith (Printf.sprintf "%s <invalid table>" fn_name)
failwith_fmt "%s <invalid table>" fn_name
) ;
Printf.printf
"%s <valid table> <invalid return> <valid field> <valid value>\n"
Expand All @@ -126,11 +128,9 @@ functor
; where_value= name
}
in
failwith
(Printf.sprintf
"%s <valid table> <invalid return> <valid field> <valid value>"
fn_name
)
failwith_fmt
"%s <valid table> <invalid return> <valid field> <valid value>"
fn_name
) ;
Printf.printf
"%s <valid table> <valid return> <invalid field> <valid value>\n"
Expand All @@ -145,11 +145,9 @@ functor
; where_value= ""
}
in
failwith
(Printf.sprintf
"%s <valid table> <valid return> <invalid field> <valid value>"
fn_name
)
failwith_fmt
"%s <valid table> <valid return> <invalid field> <valid value>"
fn_name
)

(* Verify the ref_index contents are correct for a given [tblname] and [key] (uuid/ref) *)
Expand All @@ -168,10 +166,9 @@ functor
| Some {Ref_index.name_label= name_label'; uuid; _ref} ->
(* key should be either uuid or _ref *)
if key <> uuid && key <> _ref then
failwith
(Printf.sprintf "check_ref_index %s key %s: got ref %s uuid %s"
tblname key _ref uuid
) ;
failwith_fmt "check_ref_index %s key %s: got ref %s uuid %s" tblname
key _ref uuid ;

let real_ref =
if Client.is_valid_ref t key then
key
Expand All @@ -183,14 +180,11 @@ functor
with _ -> None
in
if name_label' <> real_name_label then
failwith
(Printf.sprintf
"check_ref_index %s key %s: ref_index name_label = %s; db has \
%s"
tblname key
(Option.value ~default:"None" name_label')
(Option.value ~default:"None" real_name_label)
)
failwith_fmt
"check_ref_index %s key %s: ref_index name_label = %s; db has %s"
tblname key
(Option.value ~default:"None" name_label')
(Option.value ~default:"None" real_name_label)

open Db_cache_types

Expand Down Expand Up @@ -226,11 +220,9 @@ functor
in
let bar_foos = Row.find "foos" bar_1 in
if bar_foos <> Set ["foo:1"] then
failwith
(Printf.sprintf
"check_many_to_many: bar(bar:1).foos expected ('foo:1') got %s"
(Schema.Value.marshal bar_foos)
) ;
failwith_fmt
"check_many_to_many: bar(bar:1).foos expected ('foo:1') got %s"
(Schema.Value.marshal bar_foos) ;
(* set foo.bars to [] *)
(* let foo_1 = Table.find "foo:1" (TableSet.find "foo" (Database.tableset db)) in*)
let db = set_field "foo" "foo:1" "bars" (Set []) db in
Expand All @@ -240,11 +232,8 @@ functor
in
let bar_foos = Row.find "foos" bar_1 in
if bar_foos <> Set [] then
failwith
(Printf.sprintf
"check_many_to_many: bar(bar:1).foos expected () got %s"
(Schema.Value.marshal bar_foos)
) ;
failwith_fmt "check_many_to_many: bar(bar:1).foos expected () got %s"
(Schema.Value.marshal bar_foos) ;
(* add 'bar' to foo.bars *)
let db = set_field "foo" "foo:1" "bars" (Set ["bar:1"]) db in
(* check that 'bar.foos' includes 'foo' *)
Expand All @@ -253,11 +242,9 @@ functor
in
let bar_foos = Row.find "foos" bar_1 in
if bar_foos <> Set ["foo:1"] then
failwith
(Printf.sprintf
"check_many_to_many: bar(bar:1).foos expected ('foo:1') got %s - 2"
(Schema.Value.marshal bar_foos)
) ;
failwith_fmt
"check_many_to_many: bar(bar:1).foos expected ('foo:1') got %s - 2"
(Schema.Value.marshal bar_foos) ;
(* delete 'bar' *)
let db = remove_row "bar" "bar:1" db in
(* check that 'foo.bars' is empty *)
Expand All @@ -266,11 +253,8 @@ functor
in
let foo_bars = Row.find "bars" foo_1 in
if foo_bars <> Set [] then
failwith
(Printf.sprintf
"check_many_to_many: foo(foo:1).foos expected () got %s"
(Schema.Value.marshal foo_bars)
) ;
failwith_fmt "check_many_to_many: foo(foo:1).foos expected () got %s"
(Schema.Value.marshal foo_bars) ;
()

let check_events t =
Expand Down Expand Up @@ -503,8 +487,7 @@ functor
| None ->
Printf.printf "Reference '%s' has no associated table\n" invalid_ref
| Some t ->
failwith
(Printf.sprintf "Reference '%s' exists in table '%s'" invalid_ref t)
failwith_fmt "Reference '%s' exists in table '%s'" invalid_ref t
) ;
Printf.printf "is_valid_ref <invalid_ref>\n" ;
if Client.is_valid_ref t invalid_ref then
Expand Down Expand Up @@ -571,15 +554,25 @@ functor
Printf.printf "db_get_by_uuid <valid uuid>\n" ;
let r = Client.db_get_by_uuid t "VM" valid_uuid in
if r <> valid_ref then
failwith
(Printf.sprintf "db_get_by_uuid <valid uuid>: got %s; expected %s" r
valid_ref
) ;
failwith_fmt "db_get_by_uuid <valid uuid>: got %s; expected %s" r
valid_ref ;
Printf.printf "db_get_by_uuid <invalid uuid>\n" ;
expect_missing_uuid "VM" invalid_uuid (fun () ->
let (_ : string) = Client.db_get_by_uuid t "VM" invalid_uuid in
failwith "db_get_by_uuid <invalid uuid>"
) ;
Printf.printf "db_get_by_uuid_opt <valid uuid>\n" ;
let r = Client.db_get_by_uuid_opt t "VM" valid_uuid in
( if r <> Some valid_ref then
let rs = Option.value ~default:"None" r in
failwith_fmt "db_get_by_uuid_opt <valid uuid>: got %s; expected %s" rs
valid_ref
) ;
Printf.printf "db_get_by_uuid_opt <invalid uuid>\n" ;
let r = Client.db_get_by_uuid_opt t "VM" invalid_uuid in
if not (Option.is_none r) then
failwith_fmt "db_get_by_uuid_opt <invalid uuid>: got %s; expected None"
valid_ref ;
Printf.printf "get_by_name_label <invalid name label>\n" ;
if Client.db_get_by_name_label t "VM" invalid_name <> [] then
failwith "db_get_by_name_label <invalid name label>" ;
Expand Down
6 changes: 6 additions & 0 deletions ocaml/database/db_remote_cache_access_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ module DBCacheRemoteListener = struct
let s, e = unmarshall_db_get_by_uuid_args args in
success
(marshall_db_get_by_uuid_response (DBCache.db_get_by_uuid t s e))
| "db_get_by_uuid_opt" ->
let s, e = unmarshall_db_get_by_uuid_args args in
success
(marshall_db_get_by_uuid_opt_response
(DBCache.db_get_by_uuid_opt t s e)
)
| "db_get_by_name_label" ->
let s, e = unmarshall_db_get_by_name_label_args args in
success
Expand Down
2 changes: 2 additions & 0 deletions ocaml/database/db_remote_cache_access_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ let process_rpc (req : Rpc.t) =
Response.Read_field_where (DB.read_field_where t w)
| Request.Db_get_by_uuid (a, b) ->
Response.Db_get_by_uuid (DB.db_get_by_uuid t a b)
| Request.Db_get_by_uuid_opt (a, b) ->
Response.Db_get_by_uuid_opt (DB.db_get_by_uuid_opt t a b)
| Request.Db_get_by_name_label (a, b) ->
Response.Db_get_by_name_label (DB.db_get_by_name_label t a b)
| Request.Create_row (a, b, c) ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/database/db_rpc_client_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ functor
raise Remote_db_server_returned_bad_message

let db_get_by_uuid_opt _ t u =
match process (Request.Db_get_by_uuid (t, u)) with
match process (Request.Db_get_by_uuid_opt (t, u)) with
| Response.Db_get_by_uuid_opt y ->
y
| _ ->
Expand Down
2 changes: 2 additions & 0 deletions ocaml/database/db_rpc_common_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ let unmarshall_db_get_by_uuid_args xml = unmarshall_2strings xml

let marshall_db_get_by_uuid_response s = XMLRPC.To.string s

let marshall_db_get_by_uuid_opt_response = marshall_stringopt

let unmarshall_db_get_by_uuid_response xml = XMLRPC.From.string xml

let unmarshall_db_get_by_uuid_opt_response xml = unmarshall_stringopt xml
Expand Down
1 change: 1 addition & 0 deletions ocaml/database/db_rpc_common_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module Request = struct
| Find_refs_with_filter of string * Db_filter_types.expr
| Read_field_where of Db_cache_types.where_record
| Db_get_by_uuid of string * string
| Db_get_by_uuid_opt of string * string
| Db_get_by_name_label of string * string
| Create_row of string * (string * string) list * string
| Delete_row of string * string
Expand Down
Loading
Loading