File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ external flush : name:string -> unit = ""
3232(* * [flush lv] processes all pending allocations for this LV, such that
3333 future calls to [get_lv] will return accurate metadata. *)
3434
35- external shutdown : unit -> unit = " "
35+ (* * [shutdown ()] will cause xenvmd to exit shortly after returning.
36+ The returned value is the pid of the process to enable the caller
37+ to wait until the process has actually exitted. *)
38+ external shutdown : unit -> int = " "
3639
3740type queue = {
3841 lv : string ;
Original file line number Diff line number Diff line change @@ -124,10 +124,19 @@ let host_list copts (vg_name,_) =
124124 Lwt_main. run t
125125
126126let shutdown copts (vg_name ,_ ) =
127+ let is_alive pid =
128+ try Unix. kill pid 0 ; true with _ -> false
129+ in
130+ let lwt_while guard body =
131+ let rec inner () =
132+ if guard () then body () >> = inner else Lwt. return ()
133+ in inner ()
134+ in
127135 let t =
128136 get_vg_info_t copts vg_name >> = fun info ->
129137 set_uri copts info;
130- Client. shutdown ()
138+ Client. shutdown () >> = fun pid ->
139+ lwt_while (fun () -> is_alive pid) (fun () -> Lwt_unix. sleep 1.0 )
131140 in Lwt_main. run t
132141
133142let benchmark copts (vg_name ,_ ) =
Original file line number Diff line number Diff line change @@ -661,7 +661,7 @@ module Impl = struct
661661 Lwt_unix. sleep 1.
662662 >> = fun () ->
663663 exit 0 in
664- return ()
664+ return (Unix. getpid () )
665665
666666 module Host = struct
667667 let create context ~name = VolumeManager.Host. create name
You can’t perform that action at this time.
0 commit comments