Skip to content

Commit 8cc7bf0

Browse files
committed
CP-53951: Drop SSL and Lwt dependency from XAPI
XAPI dependended on vhd_lib, which depends on ssl and lwt. XAPI is not yet ready for Lwt (and mixing Lwt with blocking code is not a good idea). The library was only used to gain access to 1 variant used for parameter passing inside XAPI. Replace this with a polymorphic variant, and drop the dependency. Also allows to drop a match case that was dead code (proto was only ever set to NBD). Fixes: 044dc15 ("CP-45016: Add support for specifying nbd export in sparse_dd") Signed-off-by: Edwin Török <[email protected]>
1 parent bfa179f commit 8cc7bf0

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

ocaml/xapi/check-no-lwtssl.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
SSL=libssl
4+
CRYPTO=libcrypto
5+
# This is an OCaml library, but when it is linked
6+
# we also configure it to link libev, so look for that
7+
LWT=libev
8+
DEPS="${SSL}|${CRYPTO}|${LWT}"
9+
10+
ldd "$1" | grep -q -E "${DEPS}" 2>&1
11+
if [ $? -eq 1 ]; then
12+
echo -e "\n\033[32;1m[OK]\033[0m $1 does not depend on ${DEPS}";
13+
exit 0
14+
else
15+
echo -e "\n\033[31;1m[ERROR]\033[0m $1 depends on ${DEPS}";
16+
exit 1
17+
fi

ocaml/xapi/dune

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@
189189
uri
190190
uuid
191191
uuidm
192-
vhd_lib
193192
x509
194193
xapi_aux
195194
xapi-backtrace
@@ -331,3 +330,11 @@
331330
xapi-idl
332331
xapi-log
333332
xapi-stdext-unix))
333+
334+
(rule
335+
(alias runtest)
336+
(package xapi)
337+
(deps
338+
(:x xapi_main.exe))
339+
(action
340+
(run ./check-no-lwtssl.sh %{x})))

ocaml/xapi/sparse_dd_wrapper.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ let dd_internal progress_cb base prezeroed verify_cert ?(proto = None) infile
9292
match proto with
9393
| None ->
9494
[]
95-
| Some (StreamCommon.Nbd export) ->
95+
| Some (`NBD export) ->
9696
["-dest-proto"; "nbd"; "-nbd-export"; export]
97-
| Some p ->
98-
["-dest-proto"; StreamCommon.string_of_protocol p]
9997
in
10098
let verify_args =
10199
match verify_cert with

ocaml/xapi/storage_migrate.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ module MigrateLocal = struct
572572
None
573573
| uri :: _ ->
574574
let _socket, export = Storage_interface.parse_nbd_uri uri in
575-
Some (StreamCommon.Nbd export)
575+
Some (`NBD export)
576576
in
577577
Remote.VDI.activate3 dbg remote_dp dest dest_vdi vm ;
578578
with_activated_disk ~dbg ~sr ~vdi:base_vdi ~dp:base_dp ~vm

0 commit comments

Comments
 (0)