Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: c
sudo: require
install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
sudo: false
services:
- docker
install:
- wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
script: bash -ex .travis-docker.sh
env:
global:
- OCAML_VERSION=4.04.2
- DISTRO=debian-stable
- DISTRO=centos-7
- PACKAGE=xapi-nbd
matrix:
- BASE_REMOTE=git://github.com/xapi-project/xs-opam
Expand Down
4 changes: 2 additions & 2 deletions lib/vbd_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Make(Config : sig
Lwt.catch
(fun () -> Lwt_unix.mkdir vbd_list_dir 0o755)
(function
| Unix.(Unix_error (EEXIST, "mkdir", dir)) when dir = vbd_list_dir -> Lwt.return_unit
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just a compiler bug that it's moaning about this open?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, I found this very puzzling. Maybe I should undo this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the EEXIST variant is actually in the Unix module.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug that's affecting xcp-idl too - I've had to do precisely this change there. Quite annoying actually.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't despair... we will be able to move to 4.06.? soon ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that means this PR is good to go then? :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so

| Unix.Unix_error (EEXIST, "mkdir", dir) when dir = vbd_list_dir -> Lwt.return_unit
| e ->
(* In any other case we let the client fail. In this case the user/admin should go and fix the root cause of the issue *)
log_and_reraise_error ("Failed to create directory " ^ vbd_list_dir) e
Expand All @@ -38,7 +38,7 @@ module Make(Config : sig
Lwt.catch
(fun () -> Lwt_io.lines_of_file vbd_list_file |> Lwt_stream.to_list)
(function
| Unix.(Unix_error (ENOENT, "open", file)) when file = vbd_list_file -> Lwt.return []
| Unix.Unix_error (ENOENT, "open", file) when file = vbd_list_file -> Lwt.return []
| e ->
(* In any other case we let the client fail. In this case the user/admin should go and fix the root cause of the issue *)
log_and_reraise_error ("Failed to read file " ^ vbd_list_file) e
Expand Down
4 changes: 2 additions & 2 deletions src/cleanup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module VBD = struct
let vbds_to_clean_up = ref StringSet.empty
let vbds_to_clean_up_mutex = Lwt_mutex.create ()

let with_tracking rpc session_id vbd f =
let with_tracking vbd f =
Lwt_mutex.with_lock vbds_to_clean_up_mutex (fun () -> Lwt.wrap (fun () ->
vbds_to_clean_up := StringSet.add (API.Ref.string_of vbd) !vbds_to_clean_up))
>>= fun () ->
Expand Down Expand Up @@ -105,7 +105,7 @@ module VBD = struct
Xen_api.VBD.create ~rpc ~session_id ~vM ~vDI ~userdevice:"autodetect" ~bootable:false ~mode ~_type:`Disk ~unpluggable:true ~empty:false ~other_config:[] ~qos_algorithm_type:"" ~qos_algorithm_params:[]
>>= fun vbd ->
Persistent.with_tracking rpc session_id vbd (fun () ->
Runtime.with_tracking rpc session_id vbd (fun () ->
Runtime.with_tracking vbd (fun () ->
Lwt.finalize
(fun () ->
Lwt_log.notice_f "Plugging VBD %s" (API.Ref.string_of vbd) >>= fun () ->
Expand Down
7 changes: 4 additions & 3 deletions src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ let main port certfile ciphersuites =
Lwt_log.notice "Setting up server socket" >>= fun () ->
Lwt_unix.setsockopt sock Lwt_unix.SO_REUSEADDR true;
let sockaddr = Lwt_unix.ADDR_INET(Unix.inet_addr_any, port) in
Lwt_unix.bind sock sockaddr;
Lwt_unix.bind sock sockaddr >>= fun () ->
Lwt_unix.listen sock 5;
Lwt_log.notice "Listening for incoming connections" >>= fun () ->

Expand Down Expand Up @@ -165,13 +165,14 @@ let main port certfile ciphersuites =
(ignore_exn_delayed (fun () -> Lwt_unix.close sock))
in
(* Log unexpected exceptions *)
Lwt_main.run
let () = Lwt_main.run
(Lwt.catch t
(fun e ->
Lwt_log.fatal_f "Caught unexpected exception: %s" (Printexc.to_string e) >>= fun () ->
Lwt.fail e
)
);
)
in

`Ok ()

Expand Down